-
Notifications
You must be signed in to change notification settings - Fork 74
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
add numpy 2 support #340
add numpy 2 support #340
Conversation
A lot of the tests fail because of emcee and this issue: dfm/emcee#509 Other errors have a problem with these lines in cdef long[:, :] counts = np.zeros((d_max, len(bin_edges)-1), dtype=long)
cdef long[:] counts = np.zeros(len(bin_edges)-1, dtype=long)
cdef long[:] counts = np.zeros(k_max, dtype=long)
cdef long[:] counts = np.zeros(k_max, dtype=long) and raise
This only occurs on windows and is related to this: https://numpy.org/devdocs/numpy_2_0_migration_guide.html#windows-default-integer One other category of errors is:
In order to mimic the pos = np.atleast_2d(np.asarray(pos, dtype=np.double)) |
All issues fixed. Only remaining issues should be solved upstream in emcee with: dfm/emcee#510 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for this! I guess the most annoying work was the CI stuff?
I have just added a few questions / comments to the code.
name: sdist on ${{ matrix.os }} with py ${{ matrix.python-version }} | ||
name: sdist on ${{ matrix.os }} with py ${{ matrix.ver.py }} numpy${{ matrix.ver.np }} scipy${{ matrix.ver.sp }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | ||
|
||
# https://github.com/scipy/oldest-supported-numpy/blob/main/setup.cfg | ||
ver: | ||
- {py: '3.8', np: '==1.20.0', sp: '==1.5.4'} | ||
- {py: '3.9', np: '==1.20.0', sp: '==1.5.4'} | ||
- {py: '3.10', np: '==1.21.6', sp: '==1.7.2'} | ||
- {py: '3.11', np: '==1.23.2', sp: '==1.9.2'} | ||
- {py: '3.12', np: '==1.26.2', sp: '==1.11.2'} | ||
- {py: '3.12', np: '>=2.0.0rc1', sp: '>=1.13.0'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awful! But I guess there is no other way until py 3.11 is deprecated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly is awful? I think it is pretty neat to test multiple numpy/scipy versions to fix stuff like #246 faster in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a lot of manual (and typo prone?) work. Just imagine we have to add another few packages to that version matrix.
And it also makes it more work to locally reproduce specific setups of users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a new Python version is release we have to add it by hand either way. And then I would just add the first version of numpy and scipy that support that new python version. That is how I selected the numpy and scipy versions for the python version together with a bleeding edge job for the latest versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to keep it like this for now. If we encounter version incompatibilities in the future, we can rethink this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be funny to see the number of changed files across open source Python projects after changes in the black formats :-)
LGTM!
Closes: #337 #345
Numpy 2.0.0rc1 was released: https://pypi.org/project/numpy/2.0.0c1 and is officially usable to build extensions.
np.asarray
everywhere withnp.atleast_(n)d
Additional doc fixes
32bit builds were removed with this PR. I think we can happily drop that.