-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-28859: [Doc][Python] Use only code-block directive and set up doctest for the python user guide #48619
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
base: main
Are you sure you want to change the base?
GH-28859: [Doc][Python] Use only code-block directive and set up doctest for the python user guide #48619
Conversation
|
Converting this PR to draft till I figure out what would be the best way to run RST doctest on 3.12 Sphinx Documentation CI job and not on the Python 3.10 Sphinx & Numpydoc. |
|
@raulcd the main pain point why I think the easiest solution would be to run Sphinx & Numpydoc on Python 3.11, or even Python 3.12 (I am not aware of any reason we would need the olderst Python version we support here. Sphinx Documentation runs on docs changes only while Sphinx & Numpydoc runs on any Python or C++ changes and validates the docstrings). |
|
Thanks for checking that @AlenkaF ! So currently we are providing a snippet on our documentation: that will fail for some users as we are still supporting Python 3.10, right? Is it worth for the example to add the I am ok to just bump the Python version of the job but we probably should not provide examples that will fail on some of the supported versions. |
|
Yeah, you are right. Changing to |
|
Ha ha, the example would fail anyways as the year changed in the meantime 🤣 |
Yes, we don't want to have to update this every year because the data changes 😄 |
Rationale for this change
In many places in the Python User Guide the code exampels are written with IPython directive (elsewhere code-block is used). IPython directives are converted to IPython format (
InandOutduring the doc build). This can lead to slower builds.What changes are included in this PR?
IPython directives are converted to runnable code-block (with
>>>and...) and pytest doctest support for.rstfiles is added to theconda-python-docsCI job. This means the code in the Python User Guide is tested separately to the building of the documentation.Are these changes tested?
Yes, with the CI.
Are there any user-facing changes?
Changes to the Python User Guide examples will have to be tested with
pytest --doctest-glob='*.rst' docs/source/python/file.rst