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

Support for numpy 2.0 #1026

Merged
merged 15 commits into from May 1, 2024
Merged

Conversation

CasperSchippers
Copy link
Collaborator

Numpy 2.0 will soon (few months) be released with some (minor) breaking changes.

This PR fixes the things that break between numpy 1.x and 2.x (while keeping it compatible with both, assuming this is possible).

Also, I've tried standardizing the numpy imports a bit, such that all numpy imports in the repo read import numpy as np.

@CasperSchippers CasperSchippers linked an issue Jan 13, 2024 that may be closed by this pull request
@CasperSchippers CasperSchippers marked this pull request as draft January 13, 2024 17:37
@CasperSchippers CasperSchippers added the dependency Issue in an external dependency label Jan 13, 2024
Copy link
Member

@BenediktBurger BenediktBurger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work. I like it to have a consistend import structure of numpy.

One small rework, while you are at it.

pymeasure/instruments/fwbell/fwbell5080.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

Attention: Patch coverage is 30.76923% with 18 lines in your changes are missing coverage. Please review.

Project coverage is 58.14%. Comparing base (c6f1529) to head (9750b6d).

Files Patch % Lines
pymeasure/instruments/oxfordinstruments/itc503.py 7.14% 13 Missing ⚠️
pymeasure/display/widgets/table_widget.py 25.00% 3 Missing ⚠️
pymeasure/instruments/deltaelektronika/sm7045d.py 50.00% 1 Missing ⚠️
pymeasure/instruments/fwbell/fwbell5080.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1026   +/-   ##
=======================================
  Coverage   58.14%   58.14%           
=======================================
  Files         258      258           
  Lines       17872    17872           
=======================================
  Hits        10392    10392           
  Misses       7480     7480           
Flag Coverage Δ
unittests 58.14% <30.76%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BenediktBurger
Copy link
Member

Regarding the code coverage check failing, don't worry, as that is a known bug in #1090

@CasperSchippers CasperSchippers marked this pull request as ready for review April 22, 2024 20:31
@CasperSchippers
Copy link
Collaborator Author

CasperSchippers commented Apr 22, 2024

I think we are fully compatible with numpy 2.0.
There are just a few notes:

  • pint is only compatible with numpy 2.0 after the upcomming release; that does mean that, while we do not have any issues in our codebase, users can practically not use it due to pint at this moment. Do we need to do anything with this, or just leave it up to the user?
  • Do we want to run CI tests agains numpy 2.0? Would maybe be a good idea, but increases the amount of CI.
  • I've put a limit on both numpy and pandas to keep version <3. When support for python 3.8 is removed, we can also increase the minimum pandas version (as pandas 1.0.0 is the first version to support python 3.8).

@BenediktBurger
Copy link
Member

  • When support for python 3.8 is removed, we can also increase the minimum pandas version (as pandas 1.0.0 is the first version to support python 3.8)

As that is a nice version number, we can make pandas 1.0.0 the minimum requirement (contrary what I wrote in the issue).

@CasperSchippers
Copy link
Collaborator Author

I think that when this is aproved and merged we should consider not waiting too long with a new release.

Copy link
Member

@BenediktBurger BenediktBurger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments.

Thanks for tackling this issue!

docs/quick_start.rst Outdated Show resolved Hide resolved
.github/pymeasure_np2.yml Outdated Show resolved Hide resolved
.github/pymeasure_np2.yml Outdated Show resolved Hide resolved
CHANGES.rst Outdated Show resolved Hide resolved
@BenediktBurger
Copy link
Member

@CasperSchippers , would you mind merging in master in order to check, whether the codecov will work? Thanks!

@CasperSchippers
Copy link
Collaborator Author

@CasperSchippers , would you mind merging in master in order to check, whether the codecov will work? Thanks!

Good job, it seems to be working now!

My test doesn't anymore though 😞

@BenediktBurger
Copy link
Member

It looks good to me. Thanks for your work!

@CasperSchippers CasperSchippers merged commit 29fbdc7 into pymeasure:master May 1, 2024
15 checks passed
@CasperSchippers CasperSchippers deleted the fix/numpy2 branch May 16, 2024 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency Issue in an external dependency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Numpy 2.0
3 participants