-
Notifications
You must be signed in to change notification settings - Fork 9
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
gh-346: enforce NumPy
docstrings + use static typing in docs
#347
Conversation
Google
docstrings + use static typing in docsNumPy
docstrings + use static typing in docs
NumPy
docstrings + use static typing in docsNumPy
docstrings + use static typing in docs
Reminder I need to update #21 |
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.
Thanks, @paddyroddy! A quick glance -
So I have removed |
Returns | ||
------- | ||
cl : array_like | ||
The angular power spectrum for indices *i* and *j*. |
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 was already specified above
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.
Although I am not a huge fan of not having the "Returns" section in the docstring, it should be fine if the function docstrings and names are clear enough.
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.
Thanks for the amazing work on this, @paddyroddy! :)
Returns | ||
------- | ||
cl : array_like | ||
The angular power spectrum for indices *i* and *j*. |
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.
Although I am not a huge fan of not having the "Returns" section in the docstring, it should be fine if the function docstrings and names are clear enough.
Adding `mypy` to a pre-existing codebase is never easy. I initially attempted this in #308, but have since split this up into separate issues: - [x] #347 - [x] #356 - [ ] #358 In this PR, `mypy` is added but in order for CI to pass, the `# type: ignore[]` syntax is used throughout. I didn't want to tackle these here too (see #308) as it gets quite messy. One thing I have done (following #356) is change every empty `npt.NDArray` to `npt.NDArray[typing.Any]` (see #330), as this actually results in fewer errors than leaving them all blank. Ideally, we'd like to fill in as many of the `typing.Any` as possible - they're a bit useless by themselves. However, that is not the priority for now. Plus, I expect typing to change when #67 is tackled.
Closes #346. Working towards #188.
The main changes here have been:
mypy
#308)numpydoc
tosphinx.ext.napolean
due to Support type annotations (PEP 484) numpy/numpydoc#196Have had to change the references to
[1]
rather than[1]_
due to this bug, sphinx-doc/sphinx#9689. Hopefully this can be fixed in the future.Example:

glass.lensing.from_convergence
Raised #350, #351.