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 np.float with np.float64 to fix numpy 1.20 deprecation #250

Merged
merged 6 commits into from
Jun 9, 2021

Conversation

lgarrison
Copy link
Collaborator

np.float is an alias to Python's builtin float and is deprecated in Numpy 1.20. It looks like we've been using np.float when we want 64-bit behavior (and np.float32 when we want 32 bits), so I think for us the correct change is to replace np.float with np.float64, even though they may be semantically different in rare cases. Let's make sure the tests pass, for starters.

@manodeep Any reservations on this change?

More on the deprecation:

/mnt/home/lgarrison/corrfunc/Corrfunc/io.py:244: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    def read_catalog(filebase=None, return_dtype=np.float):

@lgarrison lgarrison requested a review from manodeep June 2, 2021 18:14
@pep8speaks
Copy link

pep8speaks commented Jun 2, 2021

Hello @lgarrison! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-06-08 16:03:34 UTC

@lgarrison lgarrison added this to the v2.4.0 milestone Jun 2, 2021
@manodeep
Copy link
Owner

manodeep commented Jun 3, 2021

Yes - definitely needs to happen. I will take a look tomorrow

@manodeep
Copy link
Owner

manodeep commented Jun 7, 2021

@lgarrison Thanks! I found one instance of np.float under the docs. All the other instances are under the paper directory - what do you reckon?

And will you please add an entry to the changelog?

@manodeep
Copy link
Owner

manodeep commented Jun 7, 2021

Holy crap - we still haven't release 2.4.0? Okay - that's on my task list to do this week then

@lgarrison
Copy link
Collaborator Author

Done! And yeah, let's release 2.4.0! Lots of good quality-of-life changes there. I'll try to merge #199 before we release; I think we still want that change.

@lgarrison lgarrison merged commit 443a085 into master Jun 9, 2021
@manodeep
Copy link
Owner

manodeep commented Jun 9, 2021

@lgarrison Should we add a GH-actions checking with numpy 1.20?

@lgarrison
Copy link
Collaborator Author

Probably, yeah. Actually, I would advocate for just testing two versions of Numpy: the latest, and the earliest we want to support (so 1.14?). A smaller test matrix reduces the time for all the tests to launch and run, and more importantly, reduces the chances of one of the dozens of tests hanging, requiring manual intervention.

Does that sound okay to you? If this needs more discussion, we can defer that to later and I'll just add 1.20 to the matrix for now.

@manodeep
Copy link
Owner

manodeep commented Jun 9, 2021

My approach has been to the "oldest", "mid-tier", and "latest" versions of numpy. So in this case, we can retire 1.16 and add 1.20 - I.e., test on numpy versions [1.14, 1.18, 1.20]

@manodeep
Copy link
Owner

manodeep commented Jul 9, 2021

@lgarrison And presumably this branch is safe to delete as well

@lgarrison lgarrison deleted the fix-np.float-deprecation branch July 9, 2021 12:35
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.

3 participants