1[package]
2name = "pyo3"
3version = "0.24.2"
4description = "Bindings to Python interpreter"
5authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
6readme = "README.md"
7keywords = ["pyo3", "python", "cpython", "ffi"]
8homepage = "https://github.com/pyo3/pyo3"
9repository = "https://github.com/pyo3/pyo3"
10documentation = "https://docs.rs/crate/pyo3/"
11categories = ["api-bindings", "development-tools::ffi"]
12license = "MIT OR Apache-2.0"
13exclude = ["/.gitignore", ".cargo/config", "/codecov.yml", "/Makefile", "/pyproject.toml", "/noxfile.py", "/.github", "/tests/test_compile_error.rs", "/tests/ui"]
14edition = "2021"
15rust-version = "1.63"
16
17[dependencies]
18cfg-if = "1.0"
19libc = "0.2.62"
20memoffset = "0.9"
21once_cell = "1.13"
22
23# ffi bindings to the python interpreter, split into a separate crate so they can be used independently
24pyo3-ffi = { path = "pyo3-ffi", version = "=0.24.2" }
25
26# support crates for macros feature
27pyo3-macros = { path = "pyo3-macros", version = "=0.24.2", optional = true }
28indoc = { version = "2.0.1", optional = true }
29unindent = { version = "0.2.1", optional = true }
30
31# support crate for multiple-pymethods feature
32inventory = { version = "0.3.5", optional = true }
33
34# crate integrations that can be added using the eponymous features
35anyhow = { version = "1.0.1", optional = true }
36chrono = { version = "0.4.25", default-features = false, optional = true }
37chrono-tz = { version = ">= 0.10, < 0.11", default-features = false, optional = true }
38either = { version = "1.9", optional = true }
39eyre = { version = ">= 0.6.8, < 0.7", optional = true }
40hashbrown = { version = ">= 0.14.5, < 0.16", optional = true }
41indexmap = { version = ">= 2.5.0, < 3", optional = true }
42jiff-02 = { package = "jiff", version = "0.2", optional = true }
43num-bigint = { version = "0.4.2", optional = true }
44num-complex = { version = ">= 0.4.6, < 0.5", optional = true }
45num-rational = { version = "0.4.1", optional = true }
46rust_decimal = { version = "1.15", default-features = false, optional = true }
47serde = { version = "1.0", optional = true }
48smallvec = { version = "1.0", optional = true }
49uuid = { version = "1.11.0", optional = true }
50
51[target.'cfg(not(target_has_atomic = "64"))'.dependencies]
52portable-atomic = "1.0"
53
54[dev-dependencies]
55assert_approx_eq = "1.1.0"
56chrono = "0.4.25"
57chrono-tz = ">= 0.10, < 0.11"
58# Required for "and $N others" normalization
59trybuild = ">=1.0.70"
60proptest = { version = "1.0", default-features = false, features = ["std"] }
61send_wrapper = "0.6"
62serde = { version = "1.0", features = ["derive"] }
63serde_json = "1.0.61"
64rayon = "1.6.1"
65futures = "0.3.28"
66tempfile = "3.12.0"
67static_assertions = "1.1.0"
68uuid = { version = "1.10.0", features = ["v4"] }
69
70[build-dependencies]
71pyo3-build-config = { path = "pyo3-build-config", version = "=0.24.2", features = ["resolve-config"] }
72
73[features]
74default = ["macros"]
75
76# Enables support for `async fn` for `#[pyfunction]` and `#[pymethods]`.
77experimental-async = ["macros", "pyo3-macros/experimental-async"]
78
79# Enables pyo3::inspect module and additional type information on FromPyObject
80# and IntoPy traits
81experimental-inspect = []
82
83# Enables macros: #[pyclass], #[pymodule], #[pyfunction] etc.
84macros = ["pyo3-macros", "indoc", "unindent"]
85
86# Enables multiple #[pymethods] per #[pyclass]
87multiple-pymethods = ["inventory", "pyo3-macros/multiple-pymethods"]
88
89# Use this feature when building an extension module.
90# It tells the linker to keep the python symbols unresolved,
91# so that the module can also be used with statically linked python interpreters.
92extension-module = ["pyo3-ffi/extension-module"]
93
94# Use the Python limited API. See https://www.python.org/dev/peps/pep-0384/ for more.
95abi3 = ["pyo3-build-config/abi3", "pyo3-ffi/abi3"]
96
97# With abi3, we can manually set the minimum Python version.
98abi3-py37 = ["abi3-py38", "pyo3-build-config/abi3-py37", "pyo3-ffi/abi3-py37"]
99abi3-py38 = ["abi3-py39", "pyo3-build-config/abi3-py38", "pyo3-ffi/abi3-py38"]
100abi3-py39 = ["abi3-py310", "pyo3-build-config/abi3-py39", "pyo3-ffi/abi3-py39"]
101abi3-py310 = ["abi3-py311", "pyo3-build-config/abi3-py310", "pyo3-ffi/abi3-py310"]
102abi3-py311 = ["abi3-py312", "pyo3-build-config/abi3-py311", "pyo3-ffi/abi3-py311"]
103abi3-py312 = ["abi3-py313", "pyo3-build-config/abi3-py312", "pyo3-ffi/abi3-py312"]
104abi3-py313 = ["abi3", "pyo3-build-config/abi3-py313", "pyo3-ffi/abi3-py313"]
105
106# Automatically generates `python3.dll` import libraries for Windows targets.
107generate-import-lib = ["pyo3-ffi/generate-import-lib"]
108
109# Changes `Python::with_gil` to automatically initialize the Python interpreter if needed.
110auto-initialize = []
111
112# Enables `Clone`ing references to Python objects `Py<T>` which panics if the GIL is not held.
113py-clone = []
114
115# Optimizes PyObject to Vec conversion and so on.
116nightly = []
117
118# Activates all additional features
119# This is mostly intended for testing purposes - activating *all* of these isn't particularly useful.
120full = [
121 "macros",
122 # "multiple-pymethods", # Not supported by wasm
123 "anyhow",
124 "chrono",
125 "chrono-tz",
126 "either",
127 "experimental-async",
128 "experimental-inspect",
129 "eyre",
130 "hashbrown",
131 "indexmap",
132 "num-bigint",
133 "num-complex",
134 "num-rational",
135 "py-clone",
136 "rust_decimal",
137 "serde",
138 "smallvec",
139 "uuid",
140]
141
142[workspace]
143members = [
144 "pyo3-ffi",
145 "pyo3-build-config",
146 "pyo3-macros",
147 "pyo3-macros-backend",
148 "pytests",
149 "examples",
150]
151
152[package.metadata.docs.rs]
153no-default-features = true
154features = ["full"]
155rustdoc-args = ["--cfg", "docsrs"]
156
157[workspace.lints.clippy]
158checked_conversions = "warn"
159dbg_macro = "warn"
160explicit_into_iter_loop = "warn"
161explicit_iter_loop = "warn"
162filter_map_next = "warn"
163flat_map_option = "warn"
164let_unit_value = "warn"
165manual_assert = "warn"
166manual_ok_or = "warn"
167todo = "warn"
168unnecessary_wraps = "warn"
169useless_transmute = "warn"
170used_underscore_binding = "warn"
171
172[workspace.lints.rust]
173elided_lifetimes_in_paths = "warn"
174invalid_doc_attributes = "warn"
175rust_2018_idioms = { level = "warn", priority = -1 }
176rust_2021_prelude_collisions = "warn"
177unused_lifetimes = "warn"
178unsafe_op_in_unsafe_fn = "warn"
179
180[workspace.lints.rustdoc]
181broken_intra_doc_links = "warn"
182bare_urls = "warn"
183
184[lints]
185workspace = true
186