8000 ENH: Support major version larger than 9 in `NumpyVersion` by kmaehashi · Pull Request #19214 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Support major version larger than 9 in NumpyVersion #19214

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

Merged
merged 2 commits into from
Jun 10, 2021

Conversation

kmaehashi
Copy link
Member

This PR fixes numpy.lib.NumpyVersion to be able to parse major versions larger than 9, as the docstring says:

numbers given are examples; they can be > 9 in principle

Currently minor and bugfix version supports > 9 but major is not.

Motivation: I'm maintaining CuPy, and we are expecting the next major release to be v10.x. I understand this enhancement is not necessary for NumPy for the foreseeable future, but it would be great if CuPy's version strings (which follows the NumPy's convention) can be parsed as well.

@kmaehashi kmaehashi changed the title Support major version larger than 9 in NumpyVersion ENH: Support major version larger than 9 in NumpyVersion Jun 10, 2021
@eric-wieser
Copy link
Member

Is there a reason cupy is using numpy.lib.NumpyVersion and not one of the distutils version helpers? It's probably good to fix this anyway, but I don't see numpy every hitting double-digit major versions!

@kmaehashi
Copy link
Member Author

We're often doing something like NumpyVersion(numpy.__version__) < '1.18.0' to support multiple NumPy versions in CuPy codebase, so it was just a familiar API for us 😄
Maybe we can use packaging.version.parse as an alternative.

@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Jun 10, 2021
@charris charris added this to the 1.21.0 release milestone Jun 10, 2021
@charris charris merged commit 7a18164 into numpy:main Jun 10, 2021
@charris
Copy link
Member
charris commented Jun 10, 2021

Thanks @kmaehashi .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0