|
| 1 | +========================== |
| 2 | +About Python Documentation |
| 3 | +========================== |
| 4 | + |
| 5 | +This directory, ``py/docs``, is the source for the API Reference Documentation |
| 6 | +and basic Python documentation as well as the main README for the GitHub and |
| 7 | +PyPI package. |
| 8 | + |
| 9 | + |
| 10 | +How to build docs |
| 11 | +================= |
| 12 | + |
| 13 | +One can build the Python documentation without doing a full bazel build. The |
| 14 | +following instructions will build the setup a virtual environment and installs tox, clones the |
| 15 | +selenium repo and then runs ``tox -c py/tox.ini`` building the Python documentation. |
| 16 | + |
| 17 | +.. code-block:: console |
| 18 | +
|
| 19 | + virtualenv test-py38-env |
| 20 | + source test-py38-env/bin/activate |
| 21 | + pip install tox |
| 22 | + git clone [email protected]:SeleniumHQ/selenium.git |
| 23 | + cd selenium/ |
| 24 | + # uncomment and switch to your development branch if needed |
| 25 | + #git switch -c feature-branch origin/feature-branch |
| 26 | + tox -c py/tox.ini |
| 27 | +
|
| 28 | +Works in similar manner as the larger selenium bazel doing just the python documentation portion. |
| 29 | + |
| 30 | +What is happening under the covers of tox, sphinx |
| 31 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 32 | +tox is essentially a build tool for Python. Here it setups its own virtualenv and installs the |
| 33 | +documentation packages (sphinx and jinja2) as well as the required selenium python |
| 34 | +dependencies. Then tox runs the sphinx generate autodoc stub files and then builds the docs. |
| 35 | + |
| 36 | +Sphinx is .. well a much larger topic then what we could cover here. Most important to say |
| 37 | +here is that the docs are using the "classic" theme and than the majority of the api documentation |
| 38 | +is autogenerated. There is plenty of information available and currently the documentation is |
| 39 | +fairly small and not complex. So some basic understanding of restructed text and the Sphinx tool chain |
| 40 | +should be sufficient to contribute and develop the Python docs. |
| 41 | + |
| 42 | +To clean up the build / tox cache |
| 43 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 44 | +Although there is a Sphinx Makefile option to clean up using the tox environment above one can |
| 45 | +manually clean the build by deleting the build directory on the root (selenium/build using the |
| 46 | +default directory on git clone). Noting that both Sphinx and tox cache parts of their build and |
| 47 | +recognize changes to speed up their respective builds. But at times one wants to start fresh |
| 48 | +deleting the aformentioned directory will clean the Sphinx cache or removing selenium/py/.tox |
| 49 | +directory for cleaning the tox environment. |
| 50 | + |
| 51 | + |
| 52 | +Known documentation issues |
| 53 | +========================== |
| 54 | +The API Reference primarily builds from the source code. But currently the initial template stating |
| 55 | +which modules to document is hard coded within py/docs/source/api.rst. So if modules are added or |
| 56 | +removed then the generated docs will be inaccurate. It would be preferred that the API docs generate |
| 57 | +soley from the code if possible. This is being tracked in `#14178 <https://github.com/SeleniumHQ/selenium/issues/14178>`_ |
| 58 | + |
| 59 | +We are working through the Sphinx build Warnings and Errors trying to clean up botht the syntax and |
| 60 | +the build. |
| 61 | + |
| 62 | +Contributing to Python docs |
| 63 | +=========================== |
| 64 | +First it is recommended that you read the main `CONTRIBUTING.md <https://github.com/SeleniumHQ/selenium/blob/trunk/CONTRIBUTING.md>`_. |
| 65 | + |
| 66 | +Some steps for contibuting to the Python documentation .. |
| 67 | + |
| 68 | +- Check out changes locally using instruction above. |
| 69 | +- Try to resolve any warnings/issues. |
| 70 | + - If too arduous either ask for help or add to list of known issue. |
| 71 | +- If this process is updated please update this doc as well to help the next person. |
0 commit comments