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.
Hi all,
I was looking at how to document the constants module.
From what I found, I dont think it is possible to document a module attribute in the pybind11 exposure directly, since these are represented by variables in Python. When trying to document them in Sphinx using autodoc, the docstring will then just show the generic docstring of the variable type (e.g. float or complex), similar to what is returned by the help() function.
To avoid this, I would propose to overwrite these automatically-generated docstrings in Sphinx with just the type information and then add the docstrings in the .rst file. This breaks the philosophy of having the docstrings right next to the exposures, and creates a mismatch between the docstrings shown on the API reference and returned by the help() function (and in the future possible stubs/type-hints).
But since there is (seemingly) no way around this at the moment and the constants module doesn't change frequently, I would argue that this acceptable at the moment and outweighed by having a module documentation at all (?).
What do you think? See a draft version of the docs here: