1[package]
2name = "pyo3"
3version = "0.20.3"
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.56"
16
17[dependencies]
18cfg-if = "1.0"
19libc = "0.2.62"
20parking_lot = ">= 0.11, < 0.13"
21memoffset = "0.9"
22portable-atomic = "1.0"
23
24# ffi bindings to the python interpreter, split into a separate crate so they can be used independently
25pyo3-ffi = { path = "pyo3-ffi", version = "=0.20.3" }
26
27# support crates for macros feature
28pyo3-macros = { path = "pyo3-macros", version = "=0.20.3", optional = true }
29indoc = { version = "2.0.1", optional = true }
30unindent = { version = "0.2.1", optional = true }
31
32# support crate for multiple-pymethods feature
33inventory = { version = "0.3.0", optional = true }
34
35# crate integrations that can be added using the eponymous features
36anyhow = { version = "1.0", optional = true }
37chrono = { version = "0.4.25", default-features = false, optional = true }
38either = { version = "1.9", optional = true }
39eyre = { version = ">= 0.4, < 0.7", optional = true }
40hashbrown = { version = ">= 0.9, < 0.15", optional = true }
41indexmap = { version = ">= 1.6, < 3", optional = true }
42num-bigint = { version = "0.4", optional = true }
43num-complex = { version = ">= 0.2, < 0.5", optional = true }
44rust_decimal = { version = "1.0.0", default-features = false, optional = true }
45serde = { version = "1.0", optional = true }
46smallvec = { version = "1.0", optional = true }
47
48[dev-dependencies]
49assert_approx_eq = "1.1.0"
50chrono = { version = "0.4.25" }
51# Required for "and $N others" normalization
52trybuild = ">=1.0.70"
53proptest = { version = "1.0", default-features = false, features = ["std"] }
54send_wrapper = "0.6"
55serde = { version = "1.0", features = ["derive"] }
56serde_json = "1.0.61"
57rayon = "1.6.1"
58widestring = "0.5.1"
59
60[build-dependencies]
61pyo3-build-config = { path = "pyo3-build-config", version = "=0.20.3", features = ["resolve-config"] }
62
63[features]
64default = ["macros"]
65
66# Enables pyo3::inspect module and additional type information on FromPyObject
67# and IntoPy traits
68experimental-inspect = []
69
70# Enables macros: #[pyclass], #[pymodule], #[pyfunction] etc.
71macros = ["pyo3-macros", "indoc", "unindent"]
72
73# Enables multiple #[pymethods] per #[pyclass]
74multiple-pymethods = ["inventory", "pyo3-macros/multiple-pymethods"]
75
76# Use this feature when building an extension module.
77# It tells the linker to keep the python symbols unresolved,
78# so that the module can also be used with statically linked python interpreters.
79extension-module = ["pyo3-ffi/extension-module"]
80
81# Use the Python limited API. See https://www.python.org/dev/peps/pep-0384/ for more.
82abi3 = ["pyo3-build-config/abi3", "pyo3-ffi/abi3"]
83
84# With abi3, we can manually set the minimum Python version.
85abi3-py37 = ["abi3-py38", "pyo3-build-config/abi3-py37", "pyo3-ffi/abi3-py37"]
86abi3-py38 = ["abi3-py39", "pyo3-build-config/abi3-py38", "pyo3-ffi/abi3-py38"]
87abi3-py39 = ["abi3-py310", "pyo3-build-config/abi3-py39", "pyo3-ffi/abi3-py39"]
88abi3-py310 = ["abi3-py311", "pyo3-build-config/abi3-py310", "pyo3-ffi/abi3-py310"]
89abi3-py311 = ["abi3-py312", "pyo3-build-config/abi3-py311", "pyo3-ffi/abi3-py311"]
90abi3-py312 = ["abi3", "pyo3-build-config/abi3-py312", "pyo3-ffi/abi3-py312"]
91
92# Automatically generates `python3.dll` import libraries for Windows targets.
93generate-import-lib = ["pyo3-ffi/generate-import-lib"]
94
95# Changes `Python::with_gil` to automatically initialize the Python interpreter if needed.
96auto-initialize = []
97
98# Optimizes PyObject to Vec conversion and so on.
99nightly = []
100
101# Activates all additional features
102# This is mostly intended for testing purposes - activating *all* of these isn't particularly useful.
103full = [
104 "macros",
105 # "multiple-pymethods", # TODO re-add this when MSRV is greater than 1.62
106 "anyhow",
107 "chrono",
108 "either",
109 "experimental-inspect",
110 "eyre",
111 "hashbrown",
112 "indexmap",
113 "num-bigint",
114 "num-complex",
115 "rust_decimal",
116 "serde",
117 "smallvec",
118]
119
120[workspace]
121members = [
122 "pyo3-ffi",
123 "pyo3-build-config",
124 "pyo3-macros",
125 "pyo3-macros-backend",
126 "pytests",
127 "examples",
128]
129
130[package.metadata.docs.rs]
131no-default-features = true
132features = ["full"]
133rustdoc-args = ["--cfg", "docsrs"]
134
135[workspace.lints.clippy]
136checked_conversions = "warn"
137dbg_macro = "warn"
138explicit_into_iter_loop = "warn"
139explicit_iter_loop = "warn"
140filter_map_next = "warn"
141flat_map_option = "warn"
142let_unit_value = "warn"
143manual_assert = "warn"
144manual_ok_or = "warn"
145todo = "warn"
146unnecessary_wraps = "warn"
147useless_transmute = "warn"
148used_underscore_binding = "warn"
149
150[workspace.lints.rust]
151elided_lifetimes_in_paths = "warn"
152invalid_doc_attributes = "warn"
153rust_2018_idioms = "warn"
154rust_2021_prelude_collisions = "warn"
155unused_lifetimes = "warn"
156# rust nightly got stricter about these since PyO3 0.20 was released
157dead_code = "allow"
158unused_imports = "allow"
159
160[workspace.lints.rustdoc]
161broken_intra_doc_links = "warn"
162bare_urls = "warn"
163
164[lints]
165workspace = true
166