Cargo Features
[dependencies]
pyo3 = { version = "0.20.0", default-features = false, features = ["experimental-inspect", "macros", "multiple-pymethods", "extension-module", "abi3", "abi3-py37", "abi3-py38", "abi3-py39", "abi3-py310", "abi3-py311", "generate-import-lib", "auto-initialize", "nightly", "full"] }
- default = macros
-
The
macros
feature is set by default wheneverpyo3
is added without
somewhere in the dependency tree.default-features = false - experimental-inspect full?
-
Enables pyo3::inspect module and additional type information on FromPyObject and IntoPy traits
Affects
conversion::IntoPy.type_output
,conversion::FromPyObject.type_input
… - macros default full? = indoc, pyo3-macros, unindent
-
Enables macros: #[pyclass], #[pymodule], #[pyfunction] etc.
- multiple-pymethods = inventory
-
Enables multiple #[pymethods] per #[pyclass]
Enables multiple-pymethods of pyo3-macros
support crates for macros feature
Affects
pyclass::PyClassInventory
… - extension-module
-
Use this feature when building an extension module.
It tells the linker to keep the python symbols unresolved,
so that the module can also be used with statically linked python interpreters.Enables extension-module of pyo3-ffi
ffi bindings to the python interpreter, split into a separate crate so they can be used independently
- abi3 abi3-py311?
-
Use the Python limited API. See https://www.python.org/dev/peps/pep-0384/ for more.
Enables abi3 of pyo3-build-config, pyo3-ffi, and pyo3-macros
- abi3-py37 = abi3-py38
-
With abi3, we can manually set the minimum Python version.
Enables abi3-py37 of pyo3-build-config and pyo3-ffi
- abi3-py38 abi3-py37? = abi3-py39
-
Enables abi3-py38 of pyo3-build-config and pyo3-ffi
- abi3-py39 abi3-py38? = abi3-py310
-
Enables abi3-py39 of pyo3-build-config and pyo3-ffi
- abi3-py310 abi3-py39? = abi3-py311
-
Enables abi3-py310 of pyo3-build-config and pyo3-ffi
- abi3-py311 abi3-py310? = abi3
-
Enables abi3-py311 of pyo3-build-config and pyo3-ffi
- generate-import-lib
-
Automatically generates
python3.dll
import libraries for Windows targets.Enables generate-import-lib of pyo3-ffi
- auto-initialize
-
Changes
Python::with_gil
to automatically initialize the Python interpreter if needed. - nightly
-
Optimizes PyObject to Vec conversion and so on.
- full = anyhow, chrono, experimental-inspect, eyre, hashbrown, indexmap, macros, num-bigint, num-complex, rust_decimal, serde
-
Activates all additional features
This is mostly intended for testing purposes - activating *all* of these isn't particularly useful.
Features from optional dependencies
In crates that don't use the dep:
syntax, optional dependencies automatically become Cargo features.