NumPy NDArray typing conflict with numpydoc for `np.integer`.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- numpy, python
- Domain
- documentation, tooling
Research direction
Start in numpydoc/validate.py around the PR06 handling at line 744, then review the linked issue 341 and pull request 347 for the existing curly-bracket exception. Confirm how np.integer appears in the annotation example and define completion as valid NumPy typing using integer no longer triggering PR06.
Written by the indexing model from the issue text.
Description
Why:
Numpydoc ought to support annotations matching the typing functionality of numpy.typing and the built-in scalar types.
What:
I am using NumPy 2.3.0, and numpydoc 1.8.0.
I was writing some typed code using the NDArray dtype specifications, and found numpydoc would raise PR06 for the 'integer' keyword found in the scalar in-built numpy dtype integer.
import numpy as np, numpy.typing as npt
a : npt.NDArray[np.floating | np.integer]
When writing docstrings for such typing, numpydoc throws a PR06 error, due to the inclusion of the integer string.
Parameter "a" type should use "int" instead of "integer"
What I expected:
In the context of using numpy.typing and np.integer, I didn't expect to see numpydoc raise an error for a valid numpy in-build scalar datatype.
How we might solve this:
Either numpy / numpy.typing ought to be using the same rules (i.e. int instead of integer, float instead of floating etc) to represent the in-built dtypes, or (more likely) numpydoc should accommodate this labeling?
I also noticed we added an exclusion case for PR06 via skipping over the "{" character, for option sets defined by braces/curly-brackets in this issue / PR.
- Dominant language
- Python
- Stars
- 354
- Forks
- 185
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from numpy/numpydoc
-
Don't require ``RT01`` for propertiesMay be free again @Nani-2007-code claimed this 30 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 57/100
-
DOC: Version link overflowing on navbarMay be free again @swoyer2 claimed this 52 days ago, and no pull request is open. Open
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
needs-decision
Difficulty 5/5 Over a week Newbie friendliness 35/100
Similar issues
-
00 - Bug component: numpy.linalg
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
521xueweihan/HelloGitHub#4543 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
emeryberger/CSrankings#15700 ·
Maintainers usually reply within 2 days
-
Bug | 工作不正常 Triage | 待检查
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
OneDragon-Anything/ZenlessZoneZero-OneDragon#3084 ·
Maintainers usually reply within 1 day
-
Task select patterns with uppercase letters never matchPossibly taken @manobhisriram claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day