Build option to dynamically set abi3 version
Currently the way to set abi3 version is via applying a versioned-feature in Cargo.toml (e.g., abi3-py312).
I'm requesting a way set that at the CLI. The reason for this is to be able to build wheels targeting multiple abi3 versions from the same source.
We're currently able to do this with setuptools-rust with the following command:
if [ -n "${{ matrix.PYTHON.ABI_VERSION }}" ]; then
PY_LIMITED_API="--config-settings=--build-option=--py-limited-api=${{ matrix.PYTHON.ABI_VERSION }} --no-build-isolation"
fi
OPENSSL_DIR="/opt/pyca/cryptography/openssl" \
OPENSSL_STATIC=1 \
.venv/bin/python -m pip wheel -v $PY_LIMITED_API cryptograph*.tar.gz -w dist/ && mv dist/cryptography*.whl tmpwheelhouse
What's the motivation for targeting multiple abi3 versions instead of the lowest supported?
To be able to take advantage of improvements (e.g. performance) on newer versions, while maintaining compatibility.
The specific improvement that motivated us to do this was https://github.com/PyO3/pyo3/blob/main/src/impl_/pymodule.rs#L83-L119
I think it's already possible by using MATURIN_PEP517_ARGS env var or --config-settings, for example
pip wheel --config-settings=build-args='--features abi3-py312'
Ah, that will be respected? Let me test it. Thanks!
Hmm, it fails when building an sdist with:
Caused by: You have selected the
abi3feature but not a minimum version (e.g. theabi3-py36feature). maturin needs a minimum version feature to build abi3 wheels.
I guess it fails everywhere except the places I passed that argument.
To follow up on this, it's missing a key element that setuptools-rust "auto" provides: using abi3 with the current python if nothing is explicitly provided.
Do you think support for something like "auto" abi3, where it used the current Python's version is possible?
Do you think support for something like "auto" abi3, where it used the current Python's version is possible?
I think we can support this, we can change maturin to use the current Python's version when abi3 feature is enabled without an explicit abi3-pyXY feature, and print a message about this behavior of course.