refactor(docs): move enum documentation to docstrings #1243
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This moves all1 the previous enum documentation from the
api/*.rst
files into docstrings of their respective enum class, and uses autodoc for them instead. The point of this is allowing IDEs to show descriptions on enum members.The built result isn't much different, with only a few minor changes:
operations
block onMessageType
has been removedThe purpose of the sphinx extension is to hide the enum values, i.e. making enum member headers just
category
instead ofcategory = 4
, matching the previous docs.It also patches
_EnumValueBase.__repr__
to use the__str__
representation instead, which is what sphinx would've done automatically if we were using stdlib enums. This only affects how enum default values are rendered within signatures:ref: #1188 (comment)
Checklist
pdm lint
pdm pyright
Footnotes
only
AuditLogAction
remains where it was, as it alone is ~1400-1500 lines of documentation (more than all other enums combined), andenums.py
is already large enough ↩