Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[py] Update Python documentation (modernization) #15459

Merged
merged 14 commits into from
Mar 20, 2025

Conversation

cgoldberg
Copy link
Contributor

@cgoldberg cgoldberg commented Mar 19, 2025

User description

Motivation and Context

This PR updates the Python API documentation. Previously, the docs looked pretty dated. They now use the "Material for Sphinx" theme, which is responsive (looks much better on mobile) and generally has a cleaner and more modern look.

Changes in this PR include:

  • Changed the Sphinx theme from default to sphinx-material: https://pypi.org/project/sphinx-material
  • Updated instructions for building/developing the documentation in py/docs/README.rst.
  • Bumped Sphinx and Jinja2 versions to the latest in py/docs/requirements.txt
  • Added latest sphinx-material as a new requirement in py/docs/requirements.txt.
  • Added py/docs/selenium_logo_small.png as the logo for the docs.
  • Updated the the main documentatrion page (generated from py/docs/README.rst) with:
    • link to the API docs
    • removed instructions for installing selenium via sdist package, since that no longer works
    • explanation of Selenium Manager and driver installation
    • updated the code examples since most were no longer working

I built and tested the docs locally with tox -c py/tox.ini -e docs.

See screenshot in comments below.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR Type

Documentation, Enhancement


Description

  • Updated Python documentation with modernized theme and improved content.

  • Switched Sphinx theme to sphinx-material for better aesthetics.

  • Enhanced documentation build instructions and examples for clarity.

  • Bumped Sphinx and Jinja2 versions and added sphinx-material dependency.


Changes walkthrough 📝

Relevant files
Enhancement
conf.py
Updated Sphinx configuration for modernized documentation

py/docs/source/conf.py

  • Changed Sphinx theme to sphinx_material.
  • Updated copyright year to 2025.
  • Enabled HTML index splitting and domain indices.
  • Added a logo for the documentation.
  • +7/-8     
    Documentation
    README.rst
    Enhanced README with updated build instructions                   

    py/docs/README.rst

  • Updated build instructions for Python documentation.
  • Clarified tox and Sphinx usage details.
  • Added cleanup instructions for build assets and tox cache.
  • Improved formatting and fixed typos.
  • +41/-30 
    index.rst
    Refined main documentation page with updated examples       

    py/docs/source/index.rst

  • Added link to API documentation.
  • Updated driver installation instructions with Selenium Manager
    details.
  • Modernized example code snippets with updated browser usage.
  • Improved formatting and fixed typos.
  • +42/-33 
    Dependencies
    requirements.txt
    Updated documentation dependencies                                             

    py/docs/requirements.txt

  • Bumped Jinja2 to version 3.1.6.
  • Bumped Sphinx to version 8.2.3.
  • Added sphinx-material as a new dependency.
  • +3/-2     
    Configuration changes
    tox.ini
    Adjusted tox configuration for documentation build             

    py/tox.ini

  • Removed unnecessary blank line.
  • Updated commands for building documentation.
  • +0/-1     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Typo

    There are a few typos in the documentation that should be fixed: "viiolations" should be "violations", "styke violations" should be "style violations", and "abnd" should be "and".

    - If tox exits `0`, commit and push. Otherwise fix the newly introduced styke violations.
    - `flake8` requires manual fixes
    - `black` will rewrite the violations automatically, however the files are unstaged and should staged again.
    - `isort` will rewrite the viiolations automatically, however the files are unstaged and should staged again.
    Inconsistent Formatting

    The documentation uses inconsistent formatting for the Selenium Manager link. It would be better to use a proper link format with backticks and angle brackets for consistency with other links in the document.

    driver installation for you with `Selenium Manager <https://www.selenium.dev/documentation/selenium_manager>`_. You generally
    don't have to worry about driver installation or configuration now that it's done for you when you instantiate a WebDriver.
    Incorrect Theme Name

    The README mentions using the "sphinx_rtd_theme" theme, but the actual change in conf.py shows "sphinx_material" is being used. This inconsistency should be corrected.

    here is that the docs are using the "sphinx_rtd_theme" theme (AKA "Read the Docs" theme) and
    the the majority of the api documentation is autogenerated. There is plenty of information

    Copy link
    Contributor

    qodo-merge-pro bot commented Mar 19, 2025

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @cgoldberg
    Copy link
    Contributor Author

    Screenshot:

    Screenshot 2025-03-19 6 34 10 PM

    @cgoldberg
    Copy link
    Contributor Author

    Note: I already fixed the issues in the PR Reviewers Guide above.

    @AutomatedTester
    Copy link
    Member

    This looks good but there are version incompatibilities. Can you look into that and we can get it merged

    @cgoldberg
    Copy link
    Contributor Author

    @AutomatedTester I rolled back the Sphinx version to 7.4.7 and everything should work now.That's weird it couldn't find the latest version.

    @cgoldberg
    Copy link
    Contributor Author

    I'm merging this to make it into the 4.30 release.. I think it should be good.

    @cgoldberg cgoldberg merged commit c43af38 into SeleniumHQ:trunk Mar 20, 2025
    16 of 17 checks passed
    @cgoldberg cgoldberg deleted the py-docs-theme branch March 20, 2025 17:04
    sandeepsuryaprasad pushed a commit to sandeepsuryaprasad/selenium that referenced this pull request Mar 23, 2025
    * [py] Remove blank line in tox.ini
    
    * [py] Update instructions for docs
    
    * [py] Bump Sphinx and Jinja2 versions for building docs
    
    * [py] Change permissions of index.rst
    
    * [py] Update instructions for building docs
    
    * [py] Update Python documentation (modernization)
    
    * [py] fix typos in README
    
    * [py] Fix theme name
    
    * [py] Update browser names in README
    
    * [py] Add virtual env name
    
    * [py] Change Sphinx version for docs
    
    * [py] tiny fix in README
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants