-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Updates the py api doc build #14173
Updates the py api doc build #14173
Conversation
For the API documentation as sphinx autogenerates the api docs from the code it needs the dependent Python packages. This change adds those to the tox docs build environment.
Bring Sphinx version up to the latest Python 3.8 suported version, v7.1.2. This change was made within py/docs/requirements.txt. It should be noted that there is a seperate version requirement given within py/tox.ini which I need to test and see which one is grabed using the selenium build process. (I supsect it will be the one within py/tox.ini.)
Instead of using the commited stub files which contain "pre-compiled" outlines for the api doc this will regenrate them. It should be noted this might add some time to the build process so a future change might be to see how store and update either commited files or previous build artifacts. I also and working though the output directory which is currently set to `-o docs/source`. This seem to dump all the sub files into the main source directory insted of neatly organied into child directories. Going to try to reowrk this but wanted to commit so as not to lose how I did this the first time ;)
Credit goes to @iampopovich for these changes
Credit goes to @iampopovich for these changes
Prefer instead to auto-generate these as part of the build. Also ignore those sub-directories.
- Use the docs/requirements.txt file instead of repeating the build versions for jinja and sphinx - Removed the output directory option on sphinx-autogen as that was putting everything in a flat directory structure at the root instead of the well organized folders
PR Reviewer Guide 🔍
|
PR Code Suggestions ✨
|
If one wants to easily test or reproduce the steps this is doing, the following commands will setup an virtualenv, grab the latest code and run the doc generation through tox; similar to what the official build does. virtualenv test-py38-env
source test-py38-env/bin/activate
pip install tox
git clone git@github.com:emanlove/selenium.git se-api-docs-test
cd se-api-docs-test/
git switch -c py-api-doc-13910 origin/py-api-doc-13910
tox -c py/tox.ini |
Oh wow, yeah, this looks great. When looking at the diff I'm seeing several things in the current docs that still reference Selenium 4.17 |
Also can you create another issue for auto-generating the api.rst file so we can track it? |
@titusfortner Fixed the conflict. Sorry about that one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've verified this works and is an improvement on what we have now. Thanks.
@iampopovich I know you did the work to update the api.rst file here, do you want me to merge your file and rebase this on top of it, or can I just merge this? Also are you in our chat room? (https://www.selenium.dev/support/#ChatRoom) We can discuss more there if you'd like. |
These changes are better than mine. It's fine to use them, no worries. They also include part of my work, so it's all fair 🤝 |
Now I just need to see about retroactively generating docs from the 4.22 tag😁 |
* Added requirements.txt to doc build environment For the API documentation as sphinx autogenerates the api docs from the code it needs the dependent Python packages. This change adds those to the tox docs build environment. * Updated Sphinx version within docs/requirements.txt Bring Sphinx version up to the latest Python 3.8 suported version, v7.1.2. This change was made within py/docs/requirements.txt. It should be noted that there is a seperate version requirement given within py/tox.ini which I need to test and see which one is grabed using the selenium build process. (I supsect it will be the one within py/tox.ini.) * Added step in api doc build to regenerate the autodoc stub pages Instead of using the commited stub files which contain "pre-compiled" outlines for the api doc this will regenrate them. It should be noted this might add some time to the build process so a future change might be to see how store and update either commited files or previous build artifacts. I also and working though the output directory which is currently set to `-o docs/source`. This seem to dump all the sub files into the main source directory insted of neatly organied into child directories. Going to try to reowrk this but wanted to commit so as not to lose how I did this the first time ;) * wip adding new files in api.rst Credit goes to @iampopovich for these changes * wip alphabetical order in api.rst Credit goes to @iampopovich for these changes * Removed previous generated api doc stub files Prefer instead to auto-generate these as part of the build. Also ignore those sub-directories. * Updated the tox api doc build steps - Use the docs/requirements.txt file instead of repeating the build versions for jinja and sphinx - Removed the output directory option on sphinx-autogen as that was putting everything in a flat directory structure at the root instead of the well organized folders
User description
Description
These changes regenerate the api stub files - those template files which give the base structure for the api docs - each time instead of using outdated checked in version from previous builds. Essentially we treat these like new builds which need to be regenerated versus updating and storing old build artifacts.
The base API template (py/docs/source/api.rst) has been updated to match current high level python modules which the api doc is built from. Ideally this should be autogenerated itself simply matching the Python codebase. Leaving that for another body of work to do sometime in the future.
Also updated the versions of the documentation tool (sphinx) and template packages (jinja) to more recent version. (Due to using Python 3.8 the latest sphinx version can't be used but this is ok.).
Motivation and Context
The API changes with each release as it matches the code. So essentially each time a new release comes out a new build of the documentation should be generated.
Types of changes
Checklist
PR Type
Bug fix, Enhancement
Description
py/docs/requirements.txt
from 1.8.2 to 7.1.2 to support Python 3.8.py/docs/source/api.rst
by adding new modules and reordering them alphabetically.py/tox.ini
to usedocs/requirements.txt
for dependencies, added a step to regenerate autodoc stub pages, and set thePYTHONPATH
environment variable.Changes walkthrough 📝
requirements.txt
Update Sphinx version in documentation requirements
py/docs/requirements.txt
api.rst
Update API documentation structure and modules
py/docs/source/api.rst
tox.ini
Update tox configuration for documentation build
py/tox.ini
docs/requirements.txt
for dependencies.PYTHONPATH
environment variable.