Cargo Features

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 whenever pyo3 is added without default-features = false somewhere in the dependency tree.

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


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 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


Automatically generates python3.dll import libraries for Windows targets.

Enables generate-import-lib of pyo3-ffi


Changes Python::with_gil to automatically initialize the Python interpreter if needed.


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.

pyo3-macros macros
indoc macros
unindent macros
inventory multiple-pymethods?

anyhow full?

With default (std)

chrono full?
eyre full?

With default features

hashbrown full?

With default features

indexmap full?

With default (std)

num-bigint full?

With default (std)

num-complex full?

With default (std)

rust_decimal full?
serde full?

With default (std)