Generate python documentation with sphinx#5233
Conversation
|
My proposed reordering would be the following:
The resulting class / section order should be reflected in Reorder within the classes:
Here's a branch where I played that out once (for reference, not for merging). The first commit reorders the classes, the second the functions. I don't think this is the way to reorder, just one way to do it. I think at least some ideas have merit, so feel free to choose whatever you feel is best and rely on intuition otherwise c: |
063339f to
f0ffec2
Compare
f0ffec2 to
87a03f1
Compare
29d403f to
d6638e7
Compare
|
@randombit just fyi, without this the python |
d6638e7 to
c590c3a
Compare
2612f56 to
eee1c53
Compare
|
@randombit I've rebased against master to include the padded nist key wrap, could you take a look sometime? |
|
@arckoor Sorry finally taking the time to really think about this and our doc situation in general. Yes change makes sense and mostly looks good. There does seem to be a problem building the docs if PYTHONPATH is not set to include I think in |
|
[CI passes because CI runs everything with |
58c817b to
6a317a0
Compare
|
I was for some reason testing with |
There was a problem hiding this comment.
Pull request overview
This PR transitions the Python API reference documentation to be generated via Sphinx autodoc, relying on inline docstrings in botan3.py and updating the RST to use autofunction/autoclass directives.
Changes:
- Move/expand several docstrings from
__init__methods into class docstrings to improve autodoc output. - Enable Sphinx autodoc and add a ctypes-based mock to allow importing
botan3.pyduring doc builds without a Botan shared library present. - Rewrite
doc/api_ref/python.rstto rely on autodoc directives (and add sections for newly documented features like TOTP and key wrapping).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/python/botan3.py | Updates docstrings to improve Sphinx autodoc coverage and visibility. |
| src/configs/sphinx/conf.py | Enables autodoc and adds import/mocking logic so botan3 can be imported during documentation builds. |
| doc/api_ref/python.rst | Replaces hand-written API listings with autofunction/autoclass autodoc directives. |
Comments suppressed due to low confidence (2)
src/python/botan3.py:1291
- Single-backtick markup is interpreted as a cross-reference in Sphinx/reST and may warn if the target can't be resolved. Use double backticks for the inline-literal parameter name.
Set `encrypt` to False for decryption."""
src/python/botan3.py:2750
- For reST/Sphinx docstrings, use double backticks for inline literals. Single backticks are interpreted as a cross-reference and can generate warnings depending on default_role.
The ``radix`` value should be set to 16 when initializing from a base 16 `str` value.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The complaint about turning single backticks into double backticks was warranted, even if copilot did miss a lot of instances of it :p |
Changes the python documentation to be generated by sphinx.
I added mentions in the doc for things that were previously not there, e.g. TOTP, key wrapping, ...
I also moved a few doc comments from
__init__to the class itself, I had incorrectly assumed that sphinx would generate an extra constructor for those, it does not (so the doc would not be visible at all). At least my intellisense also doesn't pick up on any comments in the init, so I think this is better.