Cargo Features

[dependencies]
pyo3 = { version = "0.21.2", default-features = false, features = ["experimental-async", "experimental-inspect", "experimental-declarative-modules", "macros", "multiple-pymethods", "extension-module", "abi3", "abi3-py37", "abi3-py38", "abi3-py39", "abi3-py310", "abi3-py311", "abi3-py312", "generate-import-lib", "auto-initialize", "gil-refs", "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-async full? = macros

Enables support for async fn for #[pyfunction] and #[pymethods].

Enables experimental-async of pyo3-macros

support crates for macros feature

Affects impl_::coroutine, pyo3::coroutine

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, conversion::FromPyObjectBound.type_input

experimental-declarative-modules full? = macros

Enables annotating Rust inline modules with #[pymodule] to build Python modules declaratively

Enables experimental-declarative-modules of pyo3-macros

macros default experimental-async? experimental-declarative-modules? 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

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

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

Enables abi3 of pyo3-build-config and pyo3-ffi

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

Enables abi3-py311 of pyo3-build-config and pyo3-ffi

abi3-py312 abi3-py311? = abi3

Enables abi3-py312 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.

gil-refs

Allows use of the deprecated "GIL Refs" APIs.

nightly

Optimizes PyObject to Vec conversion and so on.

full = anyhow, chrono, chrono-tz, either, experimental-async, experimental-declarative-modules, experimental-inspect, eyre, hashbrown, indexmap, macros, num-bigint, num-complex, rust_decimal, serde, smallvec

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. These features may have been created by mistake, and this functionality may be removed in the future.

pyo3-macros experimental-async? experimental-declarative-modules? macros multiple-pymethods?
indoc macros
unindent macros
inventory multiple-pymethods?

Enables inventory

support crate for multiple-pymethods feature

anyhow full?

Enables anyhow

crate integrations that can be added using the eponymous features

chrono full?
chrono-tz full?

Enables chrono-tz >=0.6, <0.9

either full?
eyre full?
hashbrown full?
indexmap full?
num-bigint full?
num-complex full?
rust_decimal full?
serde full?
smallvec full?