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

gh-346: enforce NumPy docstrings + use static typing in docs #347

Merged
merged 16 commits into from
Oct 14, 2024

Conversation

paddyroddy
Copy link
Member

@paddyroddy paddyroddy commented Oct 9, 2024

Closes #346. Working towards #188.

The main changes here have been:

Have 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
image

Raised #350, #351.

@paddyroddy paddyroddy added enhancement New feature or request dependencies Pull requests that update a dependency file labels Oct 9, 2024
@paddyroddy paddyroddy self-assigned this Oct 9, 2024
@paddyroddy paddyroddy changed the title gh-346: switch to Google docstrings + use static typing in docs gh-346: enforceNumPy docstrings + use static typing in docs Oct 10, 2024
@paddyroddy paddyroddy changed the title gh-346: enforceNumPy docstrings + use static typing in docs gh-346: enforce NumPy docstrings + use static typing in docs Oct 10, 2024
@paddyroddy paddyroddy marked this pull request as ready for review October 10, 2024 15:50
@paddyroddy
Copy link
Member Author

Reminder I need to update #21

Copy link
Member

@Saransh-cpp Saransh-cpp left a 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 -

@paddyroddy
Copy link
Member Author

paddyroddy commented Oct 11, 2024

So I have removed Returns and put those in the main summary. Here are screenshots from the 3 bits of documentation referred to above. This is not meant to be the final version of the docs (#188), it's a work in progress. This should make #308 easier. @ntessore @Saransh-cpp can you have another look? 🙏

image
image
image

Comment on lines -339 to -342
Returns
-------
cl : array_like
The angular power spectrum for indices *i* and *j*.
Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member

@Saransh-cpp Saransh-cpp left a 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! :)

Comment on lines -339 to -342
Returns
-------
cl : array_like
The angular power spectrum for indices *i* and *j*.
Copy link
Member

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.

@paddyroddy paddyroddy merged commit 41c4266 into main Oct 14, 2024
16 checks passed
@paddyroddy paddyroddy deleted the paddy/issue-346 branch October 14, 2024 12:37
@paddyroddy paddyroddy mentioned this pull request Oct 14, 2024
3 tasks
paddyroddy added a commit that referenced this pull request Oct 15, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deduplicate type information in docstrings
3 participants