CDCgov / PyRenew

Python package for multi-signal Bayesian renewal modeling with JAX and NumPyro.
https://cdcgov.github.io/PyRenew/
Apache License 2.0
14 stars 2 forks source link

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

Open dylanhmorris opened 3 days ago

dylanhmorris commented 3 days ago

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. https://github.com/executablebooks/MyST-Parser/issues/228#issuecomment-1449869862

dylanhmorris commented 3 days ago

@CDCgov/pyrenew-devs

AFg6K7h4fhy2 commented 1 day ago

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 commented 17 hours ago

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

AFg6K7h4fhy2 commented 13 hours ago

@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.