diff --git a/guide/src/distribution.md b/guide/src/distribution.md index 64a358c9d..66e533594 100644 --- a/guide/src/distribution.md +++ b/guide/src/distribution.md @@ -230,7 +230,7 @@ or providing any Windows Python library files. ```toml [dependencies] -pyo3 = { version = "0.27.0", features = ["extension-module", "generate-import-lib"] } +pyo3 = { version = "0.27.0", features = ["generate-import-lib"] } ``` It uses an external [`python3-dll-a`](https://docs.rs/python3-dll-a/latest/python3_dll_a/) crate to diff --git a/guide/src/tutorial.md b/guide/src/tutorial.md index c46c4f72a..290b594ae 100644 --- a/guide/src/tutorial.md +++ b/guide/src/tutorial.md @@ -41,16 +41,18 @@ version = "0.27.0" features = ["abi3-py38"] ``` -Add a `pyproject.toml` to configure [PEP 518](https://peps.python.org/pep-0518/) build system requirements -and enable the `extension-module` feature of pyo3. +Add a `pyproject.toml` to configure [PEP 518](https://peps.python.org/pep-0518/) build system requirements. ```toml [build-system] requires = ["maturin>=1.0,<2.0"] build-backend = "maturin" +``` + +If you are using pyo3 0.26 or earlier you need to enable the `extension-module` feature of pyo3 to skip linking against libpython.so (this is automatically done in pyo3 0.27): +```toml [tool.maturin] -# "extension-module" tells pyo3 we want to build an extension module (skips linking against libpython.so) features = ["pyo3/extension-module"] ``` diff --git a/src/templates/pyproject.toml.j2 b/src/templates/pyproject.toml.j2 index c5f578f00..231a8d744 100644 --- a/src/templates/pyproject.toml.j2 +++ b/src/templates/pyproject.toml.j2 @@ -21,7 +21,7 @@ tests = [ ] {% endif -%} -{% if bindings in ["bin", "cffi", "pyo3"] or mixed_non_src -%} +{% if bindings in ["bin", "cffi"] or mixed_non_src -%} [tool.maturin] {% if bindings == "cffi" or bindings == "bin" -%} bindings = "{{ bindings }}" @@ -29,7 +29,4 @@ bindings = "{{ bindings }}" {% if mixed_non_src -%} python-source = "python" {% endif -%} -{% if bindings == "pyo3" -%} -features = ["pyo3/extension-module"] -{% endif -%} {% endif -%} diff --git a/test-crates/lib_with_disallowed_lib/Cargo.toml b/test-crates/lib_with_disallowed_lib/Cargo.toml index ec6cbd296..93244a31d 100644 --- a/test-crates/lib_with_disallowed_lib/Cargo.toml +++ b/test-crates/lib_with_disallowed_lib/Cargo.toml @@ -9,4 +9,4 @@ crate-type = ["cdylib"] [dependencies] libz-sys = { version = "1.1.2", default-features = false } -pyo3 = { version = "0.27.0", features = ["extension-module"] } +pyo3 = "0.27.0" diff --git a/test-crates/lib_with_path_dep/Cargo.toml b/test-crates/lib_with_path_dep/Cargo.toml index 938251330..793c32bb3 100644 --- a/test-crates/lib_with_path_dep/Cargo.toml +++ b/test-crates/lib_with_path_dep/Cargo.toml @@ -8,5 +8,5 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.27.0", features = ["extension-module"] } +pyo3 = "0.27.0" some_path_dep = { path = "../some_path_dep" } diff --git a/test-crates/pyo3-abi3-without-version/Cargo.toml b/test-crates/pyo3-abi3-without-version/Cargo.toml index 6c9ad4115..50e50efff 100644 --- a/test-crates/pyo3-abi3-without-version/Cargo.toml +++ b/test-crates/pyo3-abi3-without-version/Cargo.toml @@ -5,7 +5,7 @@ authors = ["konstin "] edition = "2021" [dependencies] -pyo3 = { version = "0.27.0", features = ["abi3", "extension-module"] } +pyo3 = { version = "0.27.0", features = ["abi3"] } [lib] name = "pyo3_abi3_without_version" diff --git a/test-crates/pyo3-ffi-pure/Cargo.toml b/test-crates/pyo3-ffi-pure/Cargo.toml index cc35d7eda..e84079dd6 100644 --- a/test-crates/pyo3-ffi-pure/Cargo.toml +++ b/test-crates/pyo3-ffi-pure/Cargo.toml @@ -4,7 +4,7 @@ version = "1.0.0" edition = "2021" [dependencies] -pyo3-ffi = { version = "0.18.1", features = ["abi3-py37", "extension-module"] } +pyo3-ffi = { version = "0.18.1", features = ["abi3-py37"] } [lib] name = "pyo3_ffi_pure" diff --git a/test-crates/pyo3-mixed-implicit/Cargo.toml b/test-crates/pyo3-mixed-implicit/Cargo.toml index 31c78d6ae..1aa50b6f1 100644 --- a/test-crates/pyo3-mixed-implicit/Cargo.toml +++ b/test-crates/pyo3-mixed-implicit/Cargo.toml @@ -7,7 +7,7 @@ readme = "README.md" edition = "2021" [dependencies] -pyo3 = { version = "0.27.0", features = ["extension-module"] } +pyo3 = "0.27.0" [lib] name = "pyo3_mixed_implicit" diff --git a/test-crates/pyo3-mixed-implicit/pyproject.toml b/test-crates/pyo3-mixed-implicit/pyproject.toml index 19a8d5774..0312046eb 100644 --- a/test-crates/pyo3-mixed-implicit/pyproject.toml +++ b/test-crates/pyo3-mixed-implicit/pyproject.toml @@ -11,6 +11,5 @@ classifiers = [ dynamic = ["version"] [tool.maturin] -features = ["pyo3/extension-module"] module-name = "pyo3_mixed_implicit.some_rust.rust" python-source = "python" diff --git a/test-crates/pyo3-mixed-include-exclude/Cargo.toml b/test-crates/pyo3-mixed-include-exclude/Cargo.toml index ff1019398..b898a19ab 100644 --- a/test-crates/pyo3-mixed-include-exclude/Cargo.toml +++ b/test-crates/pyo3-mixed-include-exclude/Cargo.toml @@ -6,10 +6,7 @@ description = "Implements a dummy function combining rust and python" edition = "2021" [dependencies] -pyo3 = { version = "0.27.0", features = [ - "extension-module", - "generate-import-lib", -] } +pyo3 = { version = "0.27.0", features = ["generate-import-lib"] } [lib] name = "pyo3_mixed_include_exclude" diff --git a/test-crates/pyo3-mixed-py-subdir/Cargo.toml b/test-crates/pyo3-mixed-py-subdir/Cargo.toml index 1b669dc42..43ce6b243 100644 --- a/test-crates/pyo3-mixed-py-subdir/Cargo.toml +++ b/test-crates/pyo3-mixed-py-subdir/Cargo.toml @@ -7,7 +7,7 @@ readme = "README.md" edition = "2021" [dependencies] -pyo3 = { version = "0.27.0", features = ["extension-module"] } +pyo3 = "0.27.0" [lib] name = "pyo3_mixed_py_subdir" diff --git a/test-crates/pyo3-mixed-src/rust/Cargo.toml b/test-crates/pyo3-mixed-src/rust/Cargo.toml index a3a97f905..a9fd0de09 100644 --- a/test-crates/pyo3-mixed-src/rust/Cargo.toml +++ b/test-crates/pyo3-mixed-src/rust/Cargo.toml @@ -6,10 +6,7 @@ description = "Implements a dummy function combining rust and python" edition = "2021" [dependencies] -pyo3 = { version = "0.27.0", features = [ - "extension-module", - "generate-import-lib", -] } +pyo3 = { version = "0.27.0", features = ["generate-import-lib"] } [lib] name = "pyo3_mixed_src" diff --git a/test-crates/pyo3-mixed-submodule/Cargo.toml b/test-crates/pyo3-mixed-submodule/Cargo.toml index 3d458053f..0e45c74d0 100644 --- a/test-crates/pyo3-mixed-submodule/Cargo.toml +++ b/test-crates/pyo3-mixed-submodule/Cargo.toml @@ -7,7 +7,7 @@ readme = "README.md" edition = "2021" [dependencies] -pyo3 = { version = "0.27.0", features = ["extension-module"] } +pyo3 = "0.27.0" [lib] name = "pyo3_mixed_submodule" diff --git a/test-crates/pyo3-mixed-with-path-dep/Cargo.toml b/test-crates/pyo3-mixed-with-path-dep/Cargo.toml index 781b1c11c..950e2ade2 100644 --- a/test-crates/pyo3-mixed-with-path-dep/Cargo.toml +++ b/test-crates/pyo3-mixed-with-path-dep/Cargo.toml @@ -5,10 +5,7 @@ version = "2.1.3" edition = "2021" [dependencies] -pyo3 = { version = "0.27.0", features = [ - "extension-module", - "generate-import-lib", -] } +pyo3 = { version = "0.27.0", features = ["generate-import-lib", ] } some_path_dep = { path = "../some_path_dep" } [lib] diff --git a/test-crates/pyo3-mixed-workspace/rust/python/pyo3-mixed-workspace-py/Cargo.toml b/test-crates/pyo3-mixed-workspace/rust/python/pyo3-mixed-workspace-py/Cargo.toml index 8e6303ea6..d5d0a6836 100644 --- a/test-crates/pyo3-mixed-workspace/rust/python/pyo3-mixed-workspace-py/Cargo.toml +++ b/test-crates/pyo3-mixed-workspace/rust/python/pyo3-mixed-workspace-py/Cargo.toml @@ -7,10 +7,7 @@ edition = "2021" [dependencies] pyo3-mixed-workspace = { path = "../../pyo3-mixed-workspace" } -pyo3 = { version = "0.27.0", features = [ - "extension-module", - "generate-import-lib", -] } +pyo3 = { version = "0.27.0", features = ["generate-import-lib", ] } [lib] name = "pyo3_mixed_workspace_py" diff --git a/test-crates/pyo3-mixed/Cargo.toml b/test-crates/pyo3-mixed/Cargo.toml index acf11f60d..4b91c6b91 100644 --- a/test-crates/pyo3-mixed/Cargo.toml +++ b/test-crates/pyo3-mixed/Cargo.toml @@ -6,10 +6,7 @@ description = "Implements a dummy function combining rust and python" edition = "2021" [dependencies] -pyo3 = { version = "0.27.0", features = [ - "extension-module", - "generate-import-lib", -] } +pyo3 = { version = "0.27.0", features = ["generate-import-lib"] } [lib] name = "pyo3_mixed" diff --git a/test-crates/pyo3-pure/Cargo.toml b/test-crates/pyo3-pure/Cargo.toml index 2d36b8e59..a065f4b11 100644 --- a/test-crates/pyo3-pure/Cargo.toml +++ b/test-crates/pyo3-pure/Cargo.toml @@ -9,7 +9,6 @@ license = "MIT" [dependencies] pyo3 = { version = "0.27.0", features = [ "abi3-py37", - "extension-module", "generate-import-lib", ] } diff --git a/test-crates/readme-duplication/readme-py/pyproject.toml b/test-crates/readme-duplication/readme-py/pyproject.toml index 9021407a1..fa4a5c693 100644 --- a/test-crates/readme-duplication/readme-py/pyproject.toml +++ b/test-crates/readme-duplication/readme-py/pyproject.toml @@ -5,6 +5,3 @@ build-backend = "maturin" [project] name = "readme-py" version = "0.2.0" - -[tool.maturin] -features = ["pyo3/extension-module"] diff --git a/test-crates/sdist_with_path_dep/Cargo.toml b/test-crates/sdist_with_path_dep/Cargo.toml index f04064330..c1ab847da 100644 --- a/test-crates/sdist_with_path_dep/Cargo.toml +++ b/test-crates/sdist_with_path_dep/Cargo.toml @@ -8,5 +8,5 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.27.0", features = ["extension-module"] } +pyo3 = "0.27.0" some_path_dep = { path = "../some_path_dep" } diff --git a/test-crates/sdist_with_target_path_dep/Cargo.toml b/test-crates/sdist_with_target_path_dep/Cargo.toml index eb7dede82..54787fdba 100644 --- a/test-crates/sdist_with_target_path_dep/Cargo.toml +++ b/test-crates/sdist_with_target_path_dep/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.27.0", features = ["extension-module"] } +pyo3 = "0.27.0" [target.'cfg(not(target_endian = "all-over-the-place"))'.dependencies] some_path_dep = { path = "../some_path_dep" } diff --git a/test-crates/workspace-inheritance/python/Cargo.toml b/test-crates/workspace-inheritance/python/Cargo.toml index 9795f16e4..94cbcb33f 100644 --- a/test-crates/workspace-inheritance/python/Cargo.toml +++ b/test-crates/workspace-inheritance/python/Cargo.toml @@ -9,7 +9,7 @@ name = "workspace_inheritance" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.27.0", features = ["extension-module"] } +pyo3 = "0.27.0" generic_lib.workspace = true [dependencies.libc] diff --git a/test-crates/workspace-inverted-order/path-dep-with-root/Cargo.toml b/test-crates/workspace-inverted-order/path-dep-with-root/Cargo.toml index 557e1ff43..2d942b3b6 100644 --- a/test-crates/workspace-inverted-order/path-dep-with-root/Cargo.toml +++ b/test-crates/workspace-inverted-order/path-dep-with-root/Cargo.toml @@ -13,5 +13,4 @@ top_level = { path = "../" } pyo3 = { version = "0.27.0", features = [ "abi3", "abi3-py38", - "extension-module", ] } diff --git a/test-crates/workspace_with_path_dep/python/Cargo.toml b/test-crates/workspace_with_path_dep/python/Cargo.toml index b91659de3..4d0f193f5 100644 --- a/test-crates/workspace_with_path_dep/python/Cargo.toml +++ b/test-crates/workspace_with_path_dep/python/Cargo.toml @@ -8,5 +8,5 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.27.0", features = ["extension-module"] } +pyo3 = "0.27.0" generic_lib = { path = "../generic_lib" } diff --git a/tests/run.rs b/tests/run.rs index 01f9419dc..d846fe478 100644 --- a/tests/run.rs +++ b/tests/run.rs @@ -653,7 +653,6 @@ fn workspace_members_non_local_dep_sdist() { [dependencies] pyo3 = { version = "0.27.0", features = [ "abi3-py37", - "extension-module", "generate-import-lib", ] } @@ -720,7 +719,7 @@ fn lib_with_target_path_dep_sdist() { crate-type = ["cdylib"] [dependencies] - pyo3 = { version = "0.27.0", features = ["extension-module"] } + pyo3 = "0.27.0" [target.'cfg(not(target_endian = "all-over-the-place"))'.dependencies] some_path_dep = { path = "../some_path_dep" }