Skip to content

Doc statement about minimum abi3 version is wrong #4966

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

Open
bschoenmaeckers opened this issue Mar 10, 2025 · 0 comments
Open

Doc statement about minimum abi3 version is wrong #4966

bschoenmaeckers opened this issue Mar 10, 2025 · 0 comments

Comments

@bschoenmaeckers
Copy link
Member

https://pyo3.rs/v0.14.5/building_and_distribution#minimum-python-version-for-abi3

Note: If you set more that one of these api version feature flags the highest version always wins. For example, with both abi3-py36 and abi3-py38 set, PyO3 would build a wheel which supports Python 3.8 and up.

The docs state that the highest abi3 version will win. But pyo3-build-config selects the lowest one.

pub fn get_abi3_version() -> Option<PythonVersion> {
let minor_version = (MINIMUM_SUPPORTED_VERSION.minor..=ABI3_MAX_MINOR)
.find(|i| cargo_env_var(&format!("CARGO_FEATURE_ABI3_PY3{}", i)).is_some());
minor_version.map(|minor| PythonVersion { major: 3, minor })
}

Secondly the lower abi3 feature flags enable the higher ones as well so setting a higher flag will be essentially a no-op if their is a lower one present.

pyo3/Cargo.toml

Lines 97 to 103 in 059e249

# With abi3, we can manually set the minimum Python version.
abi3-py37 = ["abi3-py38", "pyo3-build-config/abi3-py37", "pyo3-ffi/abi3-py37"]
abi3-py38 = ["abi3-py39", "pyo3-build-config/abi3-py38", "pyo3-ffi/abi3-py38"]
abi3-py39 = ["abi3-py310", "pyo3-build-config/abi3-py39", "pyo3-ffi/abi3-py39"]
abi3-py310 = ["abi3-py311", "pyo3-build-config/abi3-py310", "pyo3-ffi/abi3-py310"]
abi3-py311 = ["abi3-py312", "pyo3-build-config/abi3-py311", "pyo3-ffi/abi3-py311"]
abi3-py312 = ["abi3", "pyo3-build-config/abi3-py312", "pyo3-ffi/abi3-py312"]

I would like to use the (wrongly stated) feature to dynamically build higher abi3 wheels with maturin build --features pyo3/abi3_py312 but leave the default feature set compatible with abi3_py39. Is it possible to make this work or should we update the docs that this is not possible?

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

No branches or pull requests

1 participant