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

Replace nptyping with numpy.typing #154

Merged
merged 2 commits into from
Oct 11, 2024

Conversation

eleftherioszisis
Copy link
Contributor

@eleftherioszisis eleftherioszisis commented Oct 11, 2024

Fixes #152, #153

I replaced nptyping NDArray occurrences with numpy.typing ones.

I am not sure if it's possible to specify shape restrictions without forcing the package to require python>=3.9 so that type subscription is available and things like np.ndarray[Literal[1], np.dtype[Any]] can be declared.

Note that numpy.typing.NDArray is a type alias for np.ndarray[Any, np.dtype[+ScalarType]] where ScalarType contains the following types:

(int,
 float,
 complex,
 bool,
 bytes,
 str,
 memoryview,
 numpy.bool_,
 numpy.complex64,
 numpy.complex128,
 numpy.complex256,
 numpy.float16,
 numpy.float32,
 numpy.float64,
 numpy.float128,
 numpy.int8,
 numpy.int16,
 numpy.int32,
 numpy.int64,
 numpy.longlong,
 numpy.timedelta64,
 numpy.datetime64,
 numpy.object_,
 numpy.bytes_,
 numpy.str_,
 numpy.uint8,
 numpy.uint16,
 numpy.uint32,
 numpy.uint64,
 numpy.ulonglong,
 numpy.void)

Although it is simpler to use it as it is, please let me know if a more permissible NDArray[Any] is preferred.

@eleftherioszisis
Copy link
Contributor Author

@addisonElliott would it be possible to schedule a release at a convenient time? This would allow us to update our tools. Thank you very much in advance!

@addisonElliott
Copy link
Collaborator

Sorry, I've been meaning to find the time to do that. Hopefully this weekend or next week. I have another feature I want to merge in and do a minor release.

I was going to do a major release, but I think it's a minor enough change that a minor will suffice.

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

Successfully merging this pull request may close these issues.

nptyping's numpy<2 constraint breaks pynrrd when installed with numpy>2
2 participants