Skip to content
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

Remove type annotations from docstrings given that we use type hints? #464

Open
dylanhmorris opened this issue Oct 1, 2024 · 4 comments
Labels
discussion documentation Improvements or additions to documentation

Comments

@dylanhmorris
Copy link
Collaborator

dylanhmorris commented Oct 1, 2024

Context: it is possible to generate type information for Sphinx docs directly from type hints, rather than relying on docstrings. See https://github.com/tox-dev/sphinx-autodoc-typehints

I lean yes but want to hear what others think.

see e.g. executablebooks/MyST-Parser#228 (comment)

@dylanhmorris dylanhmorris added documentation Improvements or additions to documentation discussion labels Oct 1, 2024
@dylanhmorris
Copy link
Collaborator Author

@CDCgov/pyrenew-devs

@AFg6K7h4fhy2
Copy link
Collaborator

AFg6K7h4fhy2 commented Oct 3, 2024

My inclination has been to use both type annotations and type hints in the docstrings. Reasoning: Without the type hints, I would have to read the full docstring more often, so having the hint was a more efficient way to get a sense of the function or class, and without the docstring type annotations, the rendered documentation on the website seemed incomplete. If the rendered documentation is not too heavily compromised in utility were the type annotations removed, I would support the change.

Screenshot 2024-10-03 at 10 00 13

From PEP 484. Confusingly the "annotation syntax" in this screenshot refer to type hints where the function is defined.

@dylanhmorris
Copy link
Collaborator Author

@AFg6K7h4fhy2 apologies, I should have clarified that it is possible to generate argument type documentation directly from type hints

@AFg6K7h4fhy2
Copy link
Collaborator

@AFg6K7h4fhy2 apologies, I should have clarified that it is possible to generate argument type documentation directly from type hints

Np. If this is the case then I "lean yes" as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants