Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Separate class and __init__ docs
- Conceptually, class documentation describes the class usage and `__init__` describes constructor usage. It was previously decided to merge them because having them separated would list their signatures twice. Once in the class description, and once in the `__init__` method. A side-effect of this previous workaround was that the merged content, if `__init__` does not have a docstring, would try to inherit the `__init__` docstring from the parent class. That means suppressing this inheritance would require a vacuous `__init__`. This has to be duplicated in, for example, all unit tests, because they do not require custom constructors. Maintaining this is takes more effort and scaffolding than it is worth. So it is now separated and the signature will be duplicated in the documentation instead, albeit not a desired outcome. Ideally, the class heading would not list the signature. There is an open issue for this. See: <sphinx-doc/sphinx#4257> - Show dunder (and base classes) in documentation This is necessary to show documentation for `__init__` separately, now that it is not included in the class documentation part. As a side-effect, this also shows other custom dunder methods. However, `__dict__`, `__module__` and `__weakref__` are excluded still, as they are not generally useful. - Ignore inherited methods. In particular, do not inherit documentation for the newly shown `__init__`. This is usually undesirable, as the documentations may be third-party, and may break builds if their docstrings are not compatible. Note that this flag does not stop the merged class docstring from inheriting `__init__`, so this alone would not solve the aforementioned issue. - Remove types from signature. This will add parameter and return types into description if the parameters are not there already. Previously, the types are included in the signature, which makes the signature unreadable. This should help with the duplication mentioned above by reducing the duplicated noise a little.
- Loading branch information
1 parent
1c4dba4
commit c75a2a0
Showing
11 changed files
with
49 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters