Repository navigation
add support for abi3t - #556
Conversation
|
Ping @kumaraditya303 - we were just talking about this today. |
|
I confirmed that this resolved the runtime error I reported in #555 |
|
I think we should also add a check that when abi3t is used, the minimum numpy version should be 2.5. |
cfef0a3 to
23f2955
Compare
|
Looks like 32bit windows still has some issues... not sure why though |
|
My guess is that'd be because there are no wheels for |
|
To me it looks like there are cp315-win32 wheels here and they installed fine. The version specific run had no issues as well. It's just the abi3t run that failed, so I think this is a genuine failure, but I'm not sure which fault it could be: ours, pyo3, numpy or python |
|
I think it could alignment issue on 32 bit MSVC, I am not very familiar with rust but it seems flags is defined as |
|
@Icxolu Can you try forcing a 4 byte alignment layout using |
|
If you all don't sort this out in the meantime I'll try to look on Monday. While win32 isn't so important per se, I do find it useful to detect and sort out CPU architecture-sensitive issues. It's possible this issue is in any one of CPython, NumPy, or rust-numpy. Glad to see everything mostly works otherwise! |
|
I did a bit of digging with compiler explorer: https://godbolt.org/z/qYe3Ghz7a |
|
I think I know what the issue is.
It's explicitly I think the fix needs to live in NumPy's headers. There probably needs to be a mirrored change here to ensure correct alignment for the |
|
I opened numpy/numpy#31759 |
|
It turns out my first attempt at a fix had a flaw and I think the only real fix requires NumPy to add new a C API function to fix this issue: numpy/numpy#31762 |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
Thank you both for continuing to look into this, much appreciated ❤️. That patch seems to make it run indeed. What I don't really understand is, why this should work. If I got it correctly, then from numpy's definition there are padding bytes inserted to align the flags field on 32bit. If we now tell Rust to use a packed layout, wouldn't we read the padding bytes instead of the field? I'd also assume that this than effects all 32bit platforms, not just windows and not just x86, we just don't have any CI configured for other cases. |
|
I think we need a similar fix on the NumPy side too. This does affect all 32 bit platforms, I think. |
|
If I may ask, what's the expected timeline for this to land into a release ? |
|
Whenever the next pyo3 (0.30) releases, I'll prepare a new release which includes this. |
I'm in the monthly PyO3 community call with David and Lucas Colley and the topic of shipping 0.30 came up. He's fine with it but is curious why you can't do a rust-numpy 0.29.1 release. |
|
The restructuring of the public |
|
In which case let's move forward with PyO3 0.30 👍 |
rust-numpy 0.29.0 reads dtype fields through struct layouts that assume a visible PyObject header. The abi3t build makes PyObject opaque, so datetime64 arrays crash with a null reference on 3.15. rust-numpy main fixes this (PyO3/rust-numpy#556) but the fix is not released yet. Until it is, build a cp315t wheel; 3.15 GIL builds use the cp312-abi3 wheel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… 3.15 (#209) * Build abi3/abi3t wheels and add free-threaded and Python 3.15 support Bump pyo3 to 0.29 and rust-numpy to 0.29 for Python 3.15 support, and enable the abi3-py312 and abi3t-py315 features. Each platform now ships one cp312-abi3 wheel for GIL builds 3.12+, one cp314t wheel, one cp315-abi3t wheel for 3.15+ GIL and free-threaded builds, and PyPy. The test job runs on 3.12 through 3.15t and checks the GIL stays off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Build a version-specific cp315t wheel instead of abi3t rust-numpy 0.29.0 reads dtype fields through struct layouts that assume a visible PyObject header. The abi3t build makes PyObject opaque, so datetime64 arrays crash with a null reference on 3.15. rust-numpy main fixes this (PyO3/rust-numpy#556) but the fix is not released yet. Until it is, build a cp315t wheel; 3.15 GIL builds use the cp312-abi3 wheel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The free-threaded CI checks, pixi envs and Nix shells now use 3.15t. The release workflow builds a 3.15t wheel and keeps the 3.14t wheel. The 3.15t wheel is abi3t (PEP 803). rust-numpy 0.29.0 reads array fields at fixed offsets, and these offsets are wrong under abi3t. The numpy crate is pinned to the git commit that has PyO3/rust-numpy#556 until a crates.io release has it. pyo3 gives simple enums a default `__repr__`. A custom `__repr__` adds a second Py_tp_repr slot, and 3.15 rejects the type (PyO3/pyo3#6494). This change removes the custom `__repr__` from SpecVersion and ConflictType. netcdf4 has no 3.15 build, so it moves to a feature that only the default env uses.
Add `-i 3.15t` to the version-specific wheel builds on every native platform, so we publish `cp315-cp315t` wheels alongside the existing `cp314-cp314t` ones. Bump the native jobs' uv pin to 0.13.x so that `uv python install 3.15t` resolves the final 3.15 release. We are not building `abi3t` wheels yet: rust-numpy 0.29 has the wrong struct layout under abi3t and segfaults in numpy interop (PyO3/rust-numpy#555). The fix (PyO3/rust-numpy#556) will only ship alongside PyO3 0.30. Co-authored-by: Shaan Majid <70789625+shaanmajid@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
) * build(mise): bump uv to 0.13.1 for CPython 3.15.0 uv 0.12.23 knows CPython 3.15 only up to 3.15.0rc3; 0.13.0 adds 3.15.0 final (and makes it the default stable version). * feat(python)!: abi3t wheels for CPython 3.15, require CPython 3.12 Three wheels per platform, each built with its family's oldest CPython: cp312-abi3 (GIL-enabled 3.12 to 3.14), cp315-abi3.abi3t (PEP 803: both builds of 3.15 and newer, which uv and pip prefer there), and cp314-cp314t (free-threaded 3.14 has no stable ABI). PyO3's abi3-py312 and abi3t-py315 features let the build interpreter pick the extension. - rust-numpy comes from a pinned git revision: its abi3t support (PyO3/rust-numpy#556) is not in a release yet. The abi3t extension reads arrays through NumPy 2.5's C API, so CPython 3.15 and newer require numpy>=2.5. - requires-python >=3.12: numpy 2.5 and SciPy 1.18 already dropped 3.11, and 3.12 is the most-used CPython. ruff and ty target 3.12, and the type aliases become PEP 695 `type` statements. - CI builds the abi3 and abi3t wheels on every platform (cp314t on x86_64 Linux) and tests them on 3.12 and 3.14, 3.15 and 3.15t (3.14t); publish.yml builds and tests all three, and the CUDA runtime's, on every platform. The tests name each version, since uv's "3" also matches an installed free-threaded interpreter. BREAKING CHANGE: CPython 3.11 is no longer supported; installers there keep resolving hessboost 0.3.1. * ci: test the GIL-enabled CPython an unsuffixed version names For CPython 3.14 and newer uv takes an installed free-threaded interpreter for a plain version request, and keeps a free-threaded project environment for one. publish.yml therefore tested the abi3 wheels against 3.14t, which refuses them. ci.yml tested its "3.15" runs on the 3.15t build interpreter. test-wheel.sh now installs the requested version (uv downloads the GIL-enabled build for a plain version) and asks for it as "+gil".
numpy 0.30 ships the abi3t fix from PyO3/rust-numpy#556, which we need before we can publish abi3t wheels (#532). pyo3-arrow builds against both without source changes. arro3 itself can't move to pyo3 0.30 yet, because arro3-io needs pyo3 0.30 releases of pyo3-async-runtimes, pyo3-bytes, pyo3-object_store, and pyo3-file. As described in DEVELOP.md, pin the arro3 crates to pyo3-arrow at the current main commit until then. The root Cargo.lock also picks up thiserror 2 for pyo3-arrow, which #539 changed without updating that lockfile. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
numpy 0.30.0 has the abi3t support from PyO3/rust-numpy#556, so the git pin is replaced with the crates.io release. numpy 0.30 needs pyo3 0.30, so pyo3, pyo3-async-runtimes and pyo3-bytes move to their 0.30 releases. pyo3 0.30 makes `skip_from_py_object` the default and deprecates the option, so this change removes it from all `#[pyclass]` attributes.
The free-threaded CI checks, pixi envs and Nix shells now use 3.15t. The release workflow builds a 3.15t wheel and keeps the 3.14t wheel. The 3.15t wheel is abi3t (PEP 803). rust-numpy 0.29.0 reads array fields at fixed offsets, and these offsets are wrong under abi3t. The numpy crate is pinned to the git commit that has PyO3/rust-numpy#556 until a crates.io release has it. pyo3 gives simple enums a default `__repr__`. A custom `__repr__` adds a second Py_tp_repr slot, and 3.15 rejects the type (PyO3/pyo3#6494). This change removes the custom `__repr__` from SpecVersion and ConflictType. netcdf4 has no 3.15 build, so it moves to a feature that only the default env uses.
numpy 0.30.0 has the abi3t support from PyO3/rust-numpy#556, so the git pin is replaced with the crates.io release. numpy 0.30 needs pyo3 0.30, so pyo3, pyo3-async-runtimes and pyo3-bytes move to their 0.30 releases. pyo3 0.30 makes `skip_from_py_object` the default and deprecates the option, so this change removes it from all `#[pyclass]` attributes.
The free-threaded CI checks, pixi envs and Nix shells now use 3.15t. The release workflow builds a 3.15t wheel and keeps the 3.14t wheel. The 3.15t wheel is abi3t (PEP 803). rust-numpy 0.29.0 reads array fields at fixed offsets, and these offsets are wrong under abi3t. The numpy crate is pinned to the git commit that has PyO3/rust-numpy#556 until a crates.io release has it. pyo3 gives simple enums a default `__repr__`. A custom `__repr__` adds a second Py_tp_repr slot, and 3.15 rejects the type (PyO3/pyo3#6494). This change removes the custom `__repr__` from SpecVersion and ConflictType. netcdf4 has no 3.15 build, so it moves to a feature that only the default env uses.
numpy 0.30.0 has the abi3t support from PyO3/rust-numpy#556, so the git pin is replaced with the crates.io release. numpy 0.30 needs pyo3 0.30, so pyo3, pyo3-async-runtimes and pyo3-bytes move to their 0.30 releases. pyo3 0.30 makes `skip_from_py_object` the default and deprecates the option, so this change removes it from all `#[pyclass]` attributes.
…ls (earth-mover#2472) The free-threaded CI checks, pixi envs and Nix shells now use 3.15t. The release workflow builds a 3.15t wheel and keeps the 3.14t wheel. The 3.15t wheel is abi3t (PEP 803). rust-numpy 0.30.0 includes PyO3/rust-numpy#556 fixing behavior for 3.15t, but brings a PyO3 bump to 0.30.1 too. pyo3 gives simple enums a default `__repr__`. A custom `__repr__` adds a second Py_tp_repr slot, and 3.15 rejects the type (PyO3/pyo3#6494). This change removes the custom `__repr__` from SpecVersion and ConflictType. netcdf4 has no 3.15 build, so it moves to a feature that only the default env uses.
This adds abi3t support by
Todo:
See numpy/numpy#31091
Closes #555