Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/5343.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
When building pyo3, setting the `PYO3_BUILD_EXTENSION_MODULE` causes the same effect as the `extension-module` feature. Eventually we expect maturin and setuptools-rust to set this environment variable automatically. Users with their own build systems will need to do the same.
5 changes: 5 additions & 0 deletions pyo3-build-config/src/impl_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,9 +862,14 @@ pub fn get_abi3_version() -> Option<PythonVersion> {

/// Checks if the `extension-module` feature is enabled for the PyO3 crate.
///
/// This can be triggered either by:
/// - The `extension-module` Cargo feature
/// - Setting the `PYO3_BUILD_EXTENSION_MODULE` environment variable
///
/// Must be called from a PyO3 crate build script.
pub fn is_extension_module() -> bool {
cargo_env_var("CARGO_FEATURE_EXTENSION_MODULE").is_some()
|| env_var("PYO3_BUILD_EXTENSION_MODULE").is_some()
}

/// Checks if we need to link to `libpython` for the current build target.
Expand Down
2 changes: 1 addition & 1 deletion pytests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
rust-version = "1.74"

[dependencies]
pyo3 = { path = "../", features = ["extension-module", "experimental-inspect"] }
pyo3 = { path = "../", features = ["experimental-inspect"] }

[build-dependencies]
pyo3-build-config = { path = "../pyo3-build-config" }
Expand Down
2 changes: 1 addition & 1 deletion pytests/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=1,<2"]
requires = ["maturin>=1.9.4,<2"]
build-backend = "maturin"

[tool.pytest.ini_options]
Expand Down
Loading