-
Notifications
You must be signed in to change notification settings - Fork 673
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
Use of NumPy 1.21 style npt.NDArray
typing hints
#3748
Comments
NDArray
typing hintsNDArray
typing hints
NDArray
typing hintsnpt.NDArray
typing hints
For one data point, I grepped around the SciPy codebase a bit and found that we indeed don't use I guess it depends what mentors think, but maybe we could adopt a similar compromise for the next 6 months or so. |
I think it is common to use the stub files for things like type hinting Cython modules. That said, I believe it is also possible to use the static stub files alongside regular Python modules, though I've personally almost never seen the latter. A big exception is the Python standard library I believe--it is entirely typed by a separate stubbing project if I'm reading correctly. I suppose if we really want we could do that for regular Python modules as well, though that seems debatably quite complex vs. using inline typing for conventional Python modules. So if it were a vote I'd probably favor using the slightly older syntax inline for now rather than producing a bunch of stub files for plain Python modules, but perhaps good to be clear that both may be options IIUC. |
Ok, I stand corrected-- It cites this part of PEP561: https://peps.python.org/pep-0561/#stub-only-packages In short:
Anyway, lots of interesting options/flexibility there. |
As long as I did consider stub files but I am concerned new contributors will not realise they're there and older ones will occasionally forget about them. Already the documentation is not always up to date. |
So my 2 cent here is that we'll be dropping 1.20 for 1.21 in exactly 6 months. As much as I want to do 3 monthly releases, we could wait the 6 month cycle. Otherwise sticking to It's a bit cumbersome but maybe something like |
Hi I am a beginner in open source can I contribute in this project. I got the skills of python, data science, machine learning. |
@Shankhadeep2000 welcome to MDAnalysis. This particular issue is effectively part of an ongoing Outreachy project so I don’t think we’re looking for any additional help with type hinting. But there’s are many other issues that need help, as you can see when looking through the issue tracker. I suggest you join the developer list and our discord (see https://www.mdanalysis.org/#participating ) and start a discussion there. Please also see the contributor guide https://userguide.mdanalysis.org/stable/contributing.html |
Problem
With the merge of #3737 NumPy 1.20 is now our minimum supported NumPy version as per NEP29.
However some open PRs (eg @hmacdope #3730 and @umak1106 #3746) are using the NumPy 1.21 style typing:
This is not going to play nice with our CI or advertised supported versions so we will have to decide how to proceed.
See the release notes for NumPy 1.21 to see what
npt.NDArray
actually is, but long and the short of it is that it is an alias forfrom looking at the NEP29 table the important dates are:
Some possible ideas to consider:
arr: np.ndarray
Tagging @MDAnalysis/coredevs for input? This is probably also relevant to all GSOC and Outreachy people @MDAnalysis/gsoc-mentors (particularly for @umak1106's project).
The text was updated successfully, but these errors were encountered: