Skip to content

Commit 58ba6dc

Browse files
davidhewittIcxoluMatthijsKok
authored
docs: replace extension-module feature in docs (#5588)
* replace `extension-module` feature in docs * fix guide fmt * fix copy in bullets * make toml syntax for referring to pyo3 more consistent * note packaging tools set env var automatically * fix invalid toml * Update pyo3-ffi/README.md Co-authored-by: Icxolu <[email protected]> * Update guide/src/building-and-distribution.md Co-authored-by: Matthijs Kok <[email protected]> * fixup plugin example README --------- Co-authored-by: Icxolu <[email protected]> Co-authored-by: Matthijs Kok <[email protected]>
1 parent 9ff6389 commit 58ba6dc

File tree

32 files changed

+63
-114
lines changed

32 files changed

+63
-114
lines changed

Architecture.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,8 @@ Some of the functionality of `pyo3-build-config`:
151151
entirely and only abi3 extensions can be built.
152152
- Check if we are building a Python extension.
153153
- If we are building an extension (e.g., Python library installable by `pip`),
154-
we don't link `libpython`.
155-
Currently we use the `extension-module` feature for this purpose. This may change in the future.
156-
See [#1123](https://github.com/PyO3/pyo3/pull/1123).
154+
we don't link `libpython` on most platforms (to allow for statically-linked Python interpreters).
155+
The `PYO3_BUILD_EXTENSION_MODULE` environment variable suppresses linking.
157156
- Cross-compiling configuration
158157
- If `TARGET` architecture and `HOST` architecture differ, we can find cross compile information
159158
from environment variables (`PYO3_CROSS_LIB_DIR`, `PYO3_CROSS_PYTHON_VERSION` and

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ macros = ["pyo3-macros"]
101101
# Enables multiple #[pymethods] per #[pyclass]
102102
multiple-pymethods = ["inventory", "pyo3-macros/multiple-pymethods"]
103103

104-
# Use this feature when building an extension module.
105-
# It tells the linker to keep the python symbols unresolved,
106-
# so that the module can also be used with statically linked python interpreters.
104+
# Deprecated: use the `PYO3_BUILD_EXTENSION_MODULE` environment variable when
105+
# building a Python extension module (set automatically by `setuptools-rust` and
106+
# `maturin`).
107107
extension-module = ["pyo3-ffi/extension-module"]
108108

109109
# Use the Python limited API. See https://www.python.org/dev/peps/pep-0384/ for more.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ name = "string_sum"
7171
crate-type = ["cdylib"]
7272

7373
[dependencies]
74-
pyo3 = { version = "0.27.1", features = ["extension-module"] }
74+
pyo3 = "0.27.1"
7575
```
7676

7777
**`src/lib.rs`**
@@ -138,6 +138,7 @@ Start a new project with `cargo new` and add `pyo3` to the `Cargo.toml` like th
138138
```toml
139139
[dependencies.pyo3]
140140
version = "0.27.1"
141+
# Enabling this cargo feature will cause PyO3 to start a Python interpreter on first call to `Python::attach`
141142
features = ["auto-initialize"]
142143
```
143144

examples/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66
rust-version = "1.83"
77

88
[dev-dependencies]
9-
pyo3 = { path = "..", features = ["auto-initialize", "extension-module"] }
9+
pyo3 = { path = "..", features = ["auto-initialize"] }
1010

1111
[[example]]
1212
name = "decorator"

examples/decorator/.template/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ name = "decorator"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = { version = "{{PYO3_VERSION}}", features = ["extension-module"] }
12+
pyo3 = "{{PYO3_VERSION}}"

examples/decorator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ name = "decorator"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = { path = "../../", features = ["extension-module"] }
12+
pyo3 = { path = "../../" }
1313

1414
[workspace]

examples/getitem/.template/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ name = "getitem"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = { version = "{{PYO3_VERSION}}", features = ["extension-module"] }
12+
pyo3 = "{{PYO3_VERSION}}"

examples/getitem/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ name = "getitem"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = { path = "../../", features = ["extension-module"] }
12+
pyo3 = { path = "../../" }
1313

1414
[workspace]

examples/maturin-starter/.template/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ name = "maturin_starter"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = { version = "{{PYO3_VERSION}}", features = ["extension-module"] }
12+
pyo3 = "{{PYO3_VERSION}}"

examples/maturin-starter/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "maturin_starter"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = { path = "../../", features = ["extension-module"] }
12+
pyo3 = { path = "../../" }
1313

1414
[features]
1515
abi3 = ["pyo3/abi3-py37", "generate-import-lib"]

0 commit comments

Comments
 (0)