-
Notifications
You must be signed in to change notification settings - Fork 24
DM-54027: add docs on writing docs with type annotations #737
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?
Conversation
5aaaee4 to
23d127e
Compare
Almost nobody knows that Sphinx normally pays no attention to your import statements, and I didn't even notice the existing text on this when I went to add new text on it.
23d127e to
bb20124
Compare
| .. note:: | ||
| Attributes without default values (or some sort of ``= RHS``) are not | ||
| included in documentation *at all*, except for those on `~dataclasses.dataclass` types. | ||
| Important instance attributes that cannot have a class-level default value should be made into properties so they can be documented. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like a really significant recommendation to be making about Python code style for something that seems like a limitation in the documentation build system, but I also don't really see that we have a much of a choice; not documenting public attributes doesn't really seem like a viable option, either.
This is not clear from the Sphinx output unless you know what you're looking for, but nitpick mode complains if you don't use types.
dbbfc06 to
8112aed
Compare
| [sphinx] | ||
| nitpick_ignore = [ | ||
| ["py:class", "T"], # type variables don't resolve | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This recommendation works well enough for per-package builds, but I suspect it doesn't scale up to pipelines_lsst_io, and I'm not sure what to do about that. Maybe it's a moot point because it's hard to imagine pipelines_lsst_io ever running nitpick-clean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. There is no way that nitpick is ever passing. (and now it's impossible because of the way the pybind11 docs from C++ aren't really known to sphinx).
No description provided.