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

numpydoc adoption tick list #4721

Closed
91 tasks done
tkknight opened this issue Apr 28, 2022 · 7 comments
Closed
91 tasks done

numpydoc adoption tick list #4721

tkknight opened this issue Apr 28, 2022 · 7 comments
Assignees
Labels
Good First Issue A good issue to take on if you're just getting started with Iris development Type: Documentation

Comments

@tkknight
Copy link
Contributor

tkknight commented Apr 28, 2022

📚 Documentation

GOAL: Improve the docstring content and ensure numpydocs formatting.

Related to #5637.

Below is a list of all the python files in iris/lib. In order to make ground ensuring our code based support numpdoc fully the below checklist can be used to track our progress.

Recommend we slowly work thru this list using multiple pull requests, all may contribute!

For each file we should:

How to Test usinf ruff (preferred)

Install ruff into your iris-dev conda environment via:

  • pip install ruff

Temporarily enable the ruff checker by commenting out this line: https://github.com/SciTools/iris/blob/main/.ruff.toml#L30 Once all the repo the source is compliant this ignore rule can be removed.

You can then run the checker via (running against time.py in this example):

  • ruff time.py

How to Test (not preferred)

Unless we find something better we can use pydocstyle. Install into your iris-dev conda environment via:

  • pip install pydocstyle

You can then run the docstring checker via (running against time.py in this example):

  • pydocstyle --convention=numpy --add-ignore=D105 time.py

We can use the numpy convention otherwise there maybe conflicts in the errors codes (fix one and and the other triggers and vice versa).

Proposed additional error codes to ignore:

  • D105 - Missing docstring in magic method

Hit List

Commands used to create the list: cd lib/iris; find . -name "*.py" -print | grep -v "^./tests". Feel free to remove entries is they are not relevant.

@rcomer
Copy link
Member

rcomer commented Apr 28, 2022

Consider improving the docstring content, not just the formatting.

An opportunity to also tick off #3292?

@trexfeathers trexfeathers added Good First Issue A good issue to take on if you're just getting started with Iris development and removed New: Documentation labels Apr 29, 2022
@trexfeathers
Copy link
Contributor

Ticking off one or more boxes would be a good activity for someone new to making Iris contributions.

Here's how you can test your changes: Contributing to the Documentation

@tkknight tkknight changed the title numpdoc adoption tick list numpydoc adoption tick list Feb 13, 2023
@pp-mo
Copy link
Member

pp-mo commented May 4, 2023

Can we adopt pydocstyle for conformance, at least once we have completed the transition ?
Going back to original #3840, and used to check all docstrings was also mentioned in #4689.

I think we can use this both as a pre-commit hook for developers -- which we can implement at once.
We can then adopt full CI checking, once we have everything conforming ?

@bjlittle
Copy link
Member

bjlittle commented May 4, 2023

@pp-mo For me, the answer to your question is "yes" and "no". See here.

Personally, I think we should adopt ruff and configure numpy docstring compliance through its pydocstyle support. BTW ruff also has a pre-commit hook, so there are no blockers to our normal dev workflow.

I've already talked to @tkknight about this offline, and he's keen to leverage on-going compliance with pydocstyle checking.

@pp-mo
Copy link
Member

pp-mo commented May 4, 2023

Personally, I think we should adopt ruff and configure numpy docstring compliance through its pydocstyle support.

Well I think that's effectively the same tech under the hood, so how we do it is another discussion, specifically #5254

The main problem as I see it is the effort to get everything "passing" in the first place. I'm just wondering if it's better to do that as a specific project rather than waiting for it to happen piecemeal.
I'd suggest that we should get everything passing with "pydocstyle --convention=numpy". I'm not truly sure how comprehensive the checking is, but I've trialled that over in 'ncdata' and at least it doesn't seem horribly onerous to get a sourcefile to pass the check.

@bjlittle
Copy link
Member

bjlittle commented May 4, 2023

Personally, I prefer piecemeal. It's more palatable IMHO.

Anyways, that's how I'm proceeding with this.

And yes, the goal is for pydocstyle --convention=numpy to pass, however we run it.

@tkknight
Copy link
Contributor Author

tkknight commented Feb 6, 2024

All files have now been reviewed and updated to ensure they are valid numpydocs.

All future PRs should take the opportunity to improve the docstrings (adding/improving the Parameters section, etc). This is part of the PR checklist (step 6).

#5625 continues the journey for full adoption of ruff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue A good issue to take on if you're just getting started with Iris development Type: Documentation
Projects
None yet
Development

No branches or pull requests

5 participants