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

Build option to dynamically set abi3 version #1894

Open
alex opened this issue Dec 24, 2023 · 9 comments
Open

Build option to dynamically set abi3 version #1894

alex opened this issue Dec 24, 2023 · 9 comments
Labels
enhancement New feature or request

Comments

@alex
Copy link

alex commented Dec 24, 2023

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
@alex alex added the enhancement New feature or request label Dec 24, 2023
@konstin
Copy link
Member

konstin commented Dec 26, 2023

What's the motivation for targeting multiple abi3 versions instead of the lowest supported?

@alex
Copy link
Author

alex commented Dec 26, 2023

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

@messense
Copy link
Member

messense commented Dec 28, 2023

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'

@alex
Copy link
Author

alex commented Dec 28, 2023

Ah, that will be respected? Let me test it. Thanks!

@alex
Copy link
Author

alex commented Dec 28, 2023

Hmm, it fails when building an sdist with:

Caused by: You have selected the abi3 feature but not a minimum version (e.g. the abi3-py36 feature). maturin needs a minimum version feature to build abi3 wheels.

@alex
Copy link
Author

alex commented Dec 28, 2023

I guess it fails everywhere except the places I passed that argument.

@alex
Copy link
Author

alex commented Jan 15, 2024

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.

@alex
Copy link
Author

alex commented Feb 19, 2024

Do you think support for something like "auto" abi3, where it used the current Python's version is possible?

@messense
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants