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

pyo3-build-config: Build "abi3" extensions without an interpreter #2293

Merged
merged 1 commit into from
Apr 14, 2022

Conversation

ravenexp
Copy link
Contributor

Ignore the build host Python interpreter configuration when
compiling portable "abi3" extension modules.
Such extensions should not depend on a concrete Python version
or build configuration by design.

Maturin already does this when building "abi3" extension wheels
by defining PYO3_NO_PYTHON=1 for Cargo when an abi3-py3*
feature is detected.

Closes #2292

@ravenexp ravenexp marked this pull request as draft April 11, 2022 12:08
@davidhewitt
Copy link
Member

The only concern is cases like cryptography, where I think they build using abi3-py36 yet also need to query the interpreter to get SSL information etc. - see pyca/cryptography#6695 (comment) and #2092

@ravenexp
Copy link
Contributor Author

The only concern is cases like cryptography, where I think they build using abi3-py36 yet also need to query the interpreter to get SSL information etc. - see pyca/cryptography#6695 (comment) and #2092

Oh, I can now see how this will break things like https://github.com/aganders3/hello-pyo3-build-config/blob/main/build.rs when an abi3-py3* feature is enabled.

I'll try a different approach then: making PyO3 not fail the build when the default Python interpreter is not found or too old or otherwise unusable, but the extension module can still be built without it. It will at least prevent unnecessary build failures like this: PyO3/maturin#875 (comment).

Support compiling portable "abi3" extension modules even when
the build host Python interpreter configuration is not available
or the discovered Python interpreter version is not supported.

Maturin already implements this by building "abi3" extension wheels
with `PYO3_NO_PYTHON` environment veriable set for cargo when
an `abi3-py3*` feature is detected.

Closes PyO3#2292
@ravenexp ravenexp marked this pull request as ready for review April 13, 2022 07:42
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 this new approach looks good to me, thanks!

@davidhewitt davidhewitt merged commit 8cd551f into PyO3:main Apr 14, 2022
@davidhewitt davidhewitt mentioned this pull request Apr 14, 2022
@ravenexp ravenexp deleted the abi3-no-python branch April 14, 2022 08:59
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

Successfully merging this pull request may close these issues.

Skip the build host Python interpreter detection when building portable "abi3" extensions
3 participants