-
Notifications
You must be signed in to change notification settings - Fork 960
Expand file tree
/
Copy pathCargo.toml
More file actions
408 lines (333 loc) · 10.3 KB
/
Cargo.toml
File metadata and controls
408 lines (333 loc) · 10.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
[package]
name = "pyo3"
version = "0.28.3"
description = "Bindings to Python interpreter"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
readme = "README.md"
keywords = ["pyo3", "python", "cpython", "ffi"]
homepage = "https://github.com/pyo3/pyo3"
repository = "https://github.com/pyo3/pyo3"
documentation = "https://docs.rs/crate/pyo3/"
categories = ["api-bindings", "development-tools::ffi"]
license = "MIT OR Apache-2.0"
exclude = [
"/.gitignore",
".cargo/config",
"/codecov.yml",
"/Makefile",
"/pyproject.toml",
"/noxfile.py",
"/.github",
"/tests/test_compile_error.rs",
"/tests/ui",
]
edition = "2021"
# This allows PyO3 to forward build-config from `pyo3-ffi` to avoid downstream crates
# needing to depend on `pyo3-ffi` directly to use `pyo3-build-config` functionality.
#
# See also https://github.com/rust-lang/cargo/issues/3544 and
# https://github.com/rust-lang/cargo/pull/16436 which may allow this to be
# reverted in the future.
links = "pyo3-python"
rust-version.workspace = true
[dependencies]
libc = "0.2.62"
once_cell = "1.21"
# ffi bindings to the python interpreter, split into a separate crate so they can be used independently
pyo3-ffi = { path = "pyo3-ffi", version = "=0.28.3" }
# support crate for macros feature
pyo3-macros = { path = "pyo3-macros", version = "=0.28.3", optional = true }
# support crate for multiple-pymethods feature
inventory = { version = "0.3.5", optional = true }
# crate integrations that can be added using the eponymous features
anyhow = { version = "1.0.1", optional = true }
bigdecimal = { version = "0.4.7", optional = true }
bytes = { version = "1.10", optional = true }
chrono = { version = "0.4.25", default-features = false, optional = true }
chrono-tz = { version = ">= 0.10, < 0.11", default-features = false, optional = true }
either = { version = "1.9", optional = true }
eyre = { version = ">= 0.6.8, < 0.7", optional = true }
hashbrown = { version = ">= 0.15.0, < 0.18", optional = true, default-features = false }
indexmap = { version = ">= 2.5.0, < 3", optional = true }
jiff-02 = { package = "jiff", version = "0.2", optional = true }
num-bigint = { version = "0.4.4", optional = true }
num-complex = { version = ">= 0.4.6, < 0.5", optional = true }
num-rational = { version = "0.4.1", optional = true }
num-traits = { version = "0.2.16", optional = true }
ordered-float = { version = "5.0.0", default-features = false, optional = true }
rust_decimal = { version = "1.15", default-features = false, optional = true }
time = { version = "0.3.38", default-features = false, optional = true }
serde = { version = "1.0", optional = true }
smallvec = { version = "1.0", optional = true }
uuid = { version = "1.12.0", optional = true }
lock_api = { version = "0.4", optional = true }
parking_lot = { version = "0.12", optional = true }
iana-time-zone = { version = "0.1", optional = true, features = ["fallback"]}
[target.'cfg(not(target_has_atomic = "64"))'.dependencies]
portable-atomic = "1.0"
[dev-dependencies]
assert_approx_eq = "1.1.0"
chrono = "0.4.25"
chrono-tz = ">= 0.10, < 0.11"
trybuild = ">=1.0.115"
proptest = { version = "1.0", default-features = false, features = ["std"] }
send_wrapper = "0.6"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.61"
rayon = "1.6.1"
futures = "0.3.28"
tempfile = "3.12.0"
static_assertions = "1.1.0"
uuid = { version = "1.10.0", features = ["v4"] }
parking_lot = { version = "0.12.3", features = ["arc_lock"] }
[build-dependencies]
pyo3-build-config = { path = "pyo3-build-config", version = "=0.28.3" }
[features]
default = ["macros"]
# Enables support for `async fn` for `#[pyfunction]` and `#[pymethods]`.
experimental-async = ["macros", "pyo3-macros/experimental-async"]
# Enables pyo3::inspect module and additional type information on FromPyObject
# and IntoPy traits
experimental-inspect = ["pyo3-macros/experimental-inspect"]
# Enables macros: #[pyclass], #[pymodule], #[pyfunction] etc.
macros = ["pyo3-macros"]
# Enables multiple #[pymethods] per #[pyclass]
multiple-pymethods = ["inventory", "pyo3-macros/multiple-pymethods"]
# Deprecated: use the `PYO3_BUILD_EXTENSION_MODULE` environment variable when
# building a Python extension module (set automatically by `setuptools-rust` and
# `maturin`).
extension-module = ["pyo3-ffi/extension-module"]
# Use the Python limited API. See https://www.python.org/dev/peps/pep-0384/ for more.
abi3 = ["pyo3-ffi/abi3"]
# With abi3, we can manually set the minimum Python version.
abi3-py38 = ["abi3-py39", "pyo3-ffi/abi3-py38"]
abi3-py39 = ["abi3-py310", "pyo3-ffi/abi3-py39"]
abi3-py310 = ["abi3-py311", "pyo3-ffi/abi3-py310"]
abi3-py311 = ["abi3-py312", "pyo3-ffi/abi3-py311"]
abi3-py312 = ["abi3-py313", "pyo3-ffi/abi3-py312"]
abi3-py313 = ["abi3-py314", "pyo3-ffi/abi3-py313"]
abi3-py314 = ["abi3-py315", "pyo3-ffi/abi3-py314"]
abi3-py315 = ["abi3", "pyo3-ffi/abi3-py315"]
# deprecated: no longer needed, raw-dylib is used instead
generate-import-lib = ["pyo3-ffi/generate-import-lib"]
# Changes `Python::attach` to automatically initialize the Python interpreter if needed.
auto-initialize = []
# Enables `Clone`ing references to Python objects `Py<T>` which panics if the
# thread is not attached to the Python interpreter.
py-clone = []
# Adds `OnceExt` and `MutexExt` implementations to the `parking_lot` types
parking_lot = ["dep:parking_lot", "lock_api"]
arc_lock = ["lock_api", "lock_api/arc_lock", "parking_lot?/arc_lock"]
num-bigint = ["dep:num-bigint", "dep:num-traits"]
bigdecimal = ["dep:bigdecimal", "num-bigint"]
chrono-local = ["chrono/clock", "dep:iana-time-zone"]
# Optimizes PyObject to Vec conversion and so on.
nightly = []
# Activates all additional features
# This is mostly intended for testing purposes - activating *all* of these isn't particularly useful.
full = [
"macros",
# "multiple-pymethods", # Not supported by wasm
"anyhow",
"arc_lock",
"bigdecimal",
"bytes",
"chrono",
"chrono-local",
"chrono-tz",
"either",
"experimental-async",
"experimental-inspect",
"eyre",
"hashbrown",
"indexmap",
"jiff-02",
"lock_api",
"num-bigint",
"num-complex",
"num-rational",
"ordered-float",
"parking_lot",
"py-clone",
"rust_decimal",
"serde",
"smallvec",
"time",
"uuid",
]
[workspace]
members = [
"pyo3-ffi",
"pyo3-build-config",
"pyo3-macros",
"pyo3-macros-backend",
"pyo3-introspection",
"pytests",
"examples",
]
package.rust-version = "1.83"
[package.metadata.docs.rs]
no-default-features = true
features = ["full"]
rustdoc-args = ["--cfg", "docsrs"]
[workspace.lints.clippy]
checked_conversions = "warn"
dbg_macro = "warn"
explicit_into_iter_loop = "warn"
explicit_iter_loop = "warn"
filter_map_next = "warn"
flat_map_option = "warn"
let_unit_value = "warn"
manual_assert = "warn"
manual_ok_or = "warn"
todo = "warn"
# TODO: make this "warn"
# https://github.com/PyO3/pyo3/issues/5487
undocumented_unsafe_blocks = "allow"
unnecessary_wraps = "warn"
useless_transmute = "warn"
used_underscore_binding = "warn"
[workspace.lints.rust]
elided_lifetimes_in_paths = "warn"
invalid_doc_attributes = "warn"
rust_2018_idioms = { level = "warn", priority = -1 }
rust_2021_prelude_collisions = "warn"
unused_lifetimes = "warn"
unsafe_op_in_unsafe_fn = "warn"
[workspace.lints.rustdoc]
broken_intra_doc_links = "warn"
bare_urls = "warn"
[lints]
workspace = true
# Many tests are only relevant on certain feature combinations;
# CI is marginally more efficient if `required-feature` is specified to avoid
# building and launching empty test suites.
[[test]]
name = "test_anyhow"
required-features = ["anyhow"]
[[test]]
name = "test_append_to_inittab"
required-features = ["macros"]
[[test]]
name = "test_arithmetics"
required-features = ["macros"]
[[test]]
name = "test_buffer"
required-features = ["macros"]
[[test]]
name = "test_buffer_protocol"
required-features = ["macros"]
[[test]]
name = "test_bytes"
required-features = ["macros"]
[[test]]
name = "test_class_attributes"
required-features = ["macros"]
[[test]]
name = "test_class_basics"
required-features = ["macros"]
[[test]]
name = "test_class_comparisons"
required-features = ["macros"]
[[test]]
name = "test_class_conversion"
required-features = ["macros"]
[[test]]
name = "test_class_formatting"
required-features = ["macros"]
[[test]]
name = "test_class_init"
required-features = ["macros"]
[[test]]
name = "test_class_new"
required-features = ["macros"]
[[test]]
name = "test_compile_error"
required-features = ["macros"]
[[test]]
name = "test_coroutine"
required-features = ["experimental-async"]
[[test]]
name = "test_declarative_module"
required-features = ["macros"]
[[test]]
name = "test_default_impls"
required-features = ["macros"]
[[test]]
name = "test_enum"
required-features = ["macros"]
[[test]]
name = "test_exceptions"
required-features = ["macros"]
[[test]]
name = "test_field_cfg"
required-features = ["macros"]
[[test]]
name = "test_frompy_intopy_roundtrip"
required-features = ["macros"]
[[test]]
name = "test_frompyobject"
required-features = ["macros"]
[[test]]
name = "test_gc"
required-features = ["macros"]
[[test]]
name = "test_getter_setter"
required-features = ["macros"]
[[test]]
name = "test_inheritance"
required-features = ["macros"]
[[test]]
name = "test_intopyobject"
required-features = ["macros"]
[[test]]
name = "test_macro_docs"
required-features = ["macros"]
[[test]]
name = "test_macros"
required-features = ["macros"]
[[test]]
name = "test_mapping"
required-features = ["macros"]
[[test]]
name = "test_methods"
required-features = ["macros"]
[[test]]
name = "test_module"
required-features = ["macros"]
[[test]]
name = "test_multiple_pymethods"
required-features = ["multiple-pymethods"]
[[test]]
name = "test_proto_methods"
required-features = ["macros"]
[[test]]
name = "test_pyfunction"
required-features = ["macros"]
[[test]]
name = "test_pyself"
required-features = ["macros"]
[[test]]
name = "test_sequence"
required-features = ["macros"]
[[test]]
name = "test_serde"
required-features = ["serde"]
[[test]]
name = "test_static_slots"
required-features = ["macros"]
[[test]]
name = "test_string"
required-features = ["macros"]
[[test]]
name = "test_super"
required-features = ["macros"]
[[test]]
name = "test_text_signature"
required-features = ["macros"]
[[test]]
name = "test_variable_arguments"
required-features = ["macros"]
[[test]]
name = "test_various"
required-features = ["macros"]