blob: 8b58a410e00ffaf8758fc8ed281e6d7eb6748691 [file] [log] [blame] [edit]
==========================
About Python Documentation
==========================
This directory, ``py/docs``, is the source for the API Reference Documentation
and basic Python documentation as well as the main README for the GitHub and
PyPI package.
How to build docs
=================
One can build the Python documentation without doing a full bazel build. The
following instructions will build the setup a virtual environment and installs tox, clones the
selenium repo and then runs ``tox -c py/tox.ini`` building the Python documentation.
.. code-block:: console
virtualenv test-py38-env
source test-py38-env/bin/activate
pip install tox
git clone git@github.com:SeleniumHQ/selenium.git
cd selenium/
# uncomment and switch to your development branch if needed
#git switch -c feature-branch origin/feature-branch
tox -c py/tox.ini
Works in similar manner as the larger selenium bazel doing just the python documentation portion.
What is happening under the covers of tox, sphinx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tox is essentially a build tool for Python. Here it setups its own virtualenv and installs the
documentation packages (sphinx and jinja2) as well as the required selenium python
dependencies. Then tox runs the sphinx generate autodoc stub files and then builds the docs.
Sphinx is .. well a much larger topic then what we could cover here. Most important to say
here is that the docs are using the "classic" theme and than the majority of the api documentation
is autogenerated. There is plenty of information available and currently the documentation is
fairly small and not complex. So some basic understanding of restructed text and the Sphinx tool chain
should be sufficient to contribute and develop the Python docs.
To clean up the build / tox cache
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Although there is a Sphinx Makefile option to clean up using the tox environment above one can
manually clean the build by deleting the build directory on the root (selenium/build using the
default directory on git clone). Noting that both Sphinx and tox cache parts of their build and
recognize changes to speed up their respective builds. But at times one wants to start fresh
deleting the aformentioned directory will clean the Sphinx cache or removing selenium/py/.tox
directory for cleaning the tox environment.
Known documentation issues
==========================
The API Reference primarily builds from the source code. But currently the initial template stating
which modules to document is hard coded within py/docs/source/api.rst. So if modules are added or
removed then the generated docs will be inaccurate. It would be preferred that the API docs generate
soley from the code if possible. This is being tracked in `#14178 <https://github.com/SeleniumHQ/selenium/issues/14178>`_
We are working through the Sphinx build Warnings and Errors trying to clean up botht the syntax and
the build.
Contributing to Python docs
===========================
First it is recommended that you read the main `CONTRIBUTING.md <https://github.com/SeleniumHQ/selenium/blob/trunk/CONTRIBUTING.md>`_.
Some steps for contibuting to the Python documentation ..
- Check out changes locally using instruction above.
- Try to resolve any warnings/issues.
- If too arduous either ask for help or add to list of known issue.
- If this process is updated please update this doc as well to help the next person.