maturin 1.8.2__tar.gz → 1.8.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of maturin might be problematic. Click here for more details.
- {maturin-1.8.2 → maturin-1.8.4}/.cirrus.yml +1 -1
- {maturin-1.8.2 → maturin-1.8.4}/.pre-commit-config.yaml +2 -2
- {maturin-1.8.2 → maturin-1.8.4}/Cargo.lock +22 -31
- {maturin-1.8.2 → maturin-1.8.4}/Cargo.toml +4 -4
- {maturin-1.8.2 → maturin-1.8.4}/Changelog.md +22 -1
- {maturin-1.8.2 → maturin-1.8.4}/PKG-INFO +16 -12
- {maturin-1.8.2 → maturin-1.8.4}/README.md +15 -11
- {maturin-1.8.2 → maturin-1.8.4}/maturin/__init__.py +28 -8
- maturin-1.8.4/maturin/bootstrap.py +31 -0
- {maturin-1.8.2 → maturin-1.8.4}/pyproject.toml +4 -3
- {maturin-1.8.2 → maturin-1.8.4}/setup.py +11 -1
- {maturin-1.8.2 → maturin-1.8.4}/src/auditwheel/manylinux-policy.json +102 -20
- maturin-1.8.4/src/bridge.rs +296 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/build_context.rs +63 -55
- {maturin-1.8.2 → maturin-1.8.4}/src/build_options.rs +461 -364
- {maturin-1.8.2 → maturin-1.8.4}/src/ci.rs +28 -29
- {maturin-1.8.2 → maturin-1.8.4}/src/compile.rs +23 -26
- {maturin-1.8.2 → maturin-1.8.4}/src/cross_compile.rs +1 -1
- {maturin-1.8.2 → maturin-1.8.4}/src/develop.rs +19 -4
- {maturin-1.8.2 → maturin-1.8.4}/src/lib.rs +2 -2
- {maturin-1.8.2 → maturin-1.8.4}/src/main.rs +14 -10
- {maturin-1.8.2 → maturin-1.8.4}/src/module_writer.rs +33 -11
- {maturin-1.8.2 → maturin-1.8.4}/src/new_project.rs +5 -3
- {maturin-1.8.2 → maturin-1.8.4}/src/project_layout.rs +55 -25
- {maturin-1.8.2 → maturin-1.8.4}/src/python_interpreter/config.rs +40 -40
- {maturin-1.8.2 → maturin-1.8.4}/src/python_interpreter/mod.rs +24 -19
- {maturin-1.8.2 → maturin-1.8.4}/src/source_distribution.rs +17 -5
- {maturin-1.8.2 → maturin-1.8.4}/src/target.rs +32 -19
- {maturin-1.8.2 → maturin-1.8.4}/src/templates/Cargo.toml.j2 +1 -1
- maturin-1.8.2/src/bridge.rs +0 -177
- {maturin-1.8.2 → maturin-1.8.4}/.codespellrc +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/.config/nextest.toml +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/.gitignore +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/MANIFEST.in +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/clippy.toml +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/license-apache +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/license-mit +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/maturin/__main__.py +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/maturin.schema.json +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/netlify.toml +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/auditwheel/audit.rs +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/auditwheel/mod.rs +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/auditwheel/musllinux-policy.json +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/auditwheel/musllinux.rs +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/auditwheel/patchelf.rs +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/auditwheel/platform_tag.rs +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/auditwheel/policy.rs +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/auditwheel/repair.rs +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/cargo_toml.rs +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/generate_json_schema.rs +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/metadata.rs +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/pyproject_toml.rs +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/python_interpreter/get_interpreter_metadata.py +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/templates/.gitignore.j2 +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/templates/__init__.py.j2 +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/templates/build.rs.j2 +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/templates/example.udl.j2 +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/templates/lib.rs.j2 +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/templates/main.rs.j2 +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/templates/pyproject.toml.j2 +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/templates/test_all.py.j2 +0 -0
- {maturin-1.8.2 → maturin-1.8.4}/src/upload.rs +0 -0
|
@@ -56,12 +56,12 @@ repos:
|
|
|
56
56
|
)
|
|
57
57
|
- id: mixed-line-ending
|
|
58
58
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
59
|
-
rev: v0.
|
|
59
|
+
rev: v0.11.8
|
|
60
60
|
hooks:
|
|
61
61
|
- id: ruff-format
|
|
62
62
|
- id: ruff
|
|
63
63
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
64
|
-
rev: v1.
|
|
64
|
+
rev: v1.15.0
|
|
65
65
|
hooks:
|
|
66
66
|
- id: mypy
|
|
67
67
|
entry: mypy maturin/
|
|
@@ -191,22 +191,20 @@ checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc"
|
|
|
191
191
|
|
|
192
192
|
[[package]]
|
|
193
193
|
name = "bzip2"
|
|
194
|
-
version = "0.
|
|
194
|
+
version = "0.5.2"
|
|
195
195
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
196
|
-
checksum = "
|
|
196
|
+
checksum = "49ecfb22d906f800d4fe833b6282cf4dc1c298f5057ca0b5445e5c209735ca47"
|
|
197
197
|
dependencies = [
|
|
198
198
|
"bzip2-sys",
|
|
199
|
-
"libc",
|
|
200
199
|
]
|
|
201
200
|
|
|
202
201
|
[[package]]
|
|
203
202
|
name = "bzip2-sys"
|
|
204
|
-
version = "0.1.
|
|
203
|
+
version = "0.1.13+1.0.8"
|
|
205
204
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
206
|
-
checksum = "
|
|
205
|
+
checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14"
|
|
207
206
|
dependencies = [
|
|
208
207
|
"cc",
|
|
209
|
-
"libc",
|
|
210
208
|
"pkg-config",
|
|
211
209
|
]
|
|
212
210
|
|
|
@@ -293,9 +291,9 @@ dependencies = [
|
|
|
293
291
|
|
|
294
292
|
[[package]]
|
|
295
293
|
name = "cargo-zigbuild"
|
|
296
|
-
version = "0.
|
|
294
|
+
version = "0.20.0"
|
|
297
295
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
298
|
-
checksum = "
|
|
296
|
+
checksum = "3f6e9e856390d5b0a859acaeda16528f8a61c964bdb894c3216c254908f1c2ea"
|
|
299
297
|
dependencies = [
|
|
300
298
|
"anyhow",
|
|
301
299
|
"cargo-config2",
|
|
@@ -332,9 +330,9 @@ dependencies = [
|
|
|
332
330
|
|
|
333
331
|
[[package]]
|
|
334
332
|
name = "cbindgen"
|
|
335
|
-
version = "0.
|
|
333
|
+
version = "0.28.0"
|
|
336
334
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
337
|
-
checksum = "
|
|
335
|
+
checksum = "eadd868a2ce9ca38de7eeafdcec9c7065ef89b42b32f0839278d55f35c54d1ff"
|
|
338
336
|
dependencies = [
|
|
339
337
|
"heck 0.4.1",
|
|
340
338
|
"indexmap",
|
|
@@ -350,9 +348,9 @@ dependencies = [
|
|
|
350
348
|
|
|
351
349
|
[[package]]
|
|
352
350
|
name = "cc"
|
|
353
|
-
version = "1.
|
|
351
|
+
version = "1.2.16"
|
|
354
352
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
355
|
-
checksum = "
|
|
353
|
+
checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c"
|
|
356
354
|
dependencies = [
|
|
357
355
|
"shlex",
|
|
358
356
|
]
|
|
@@ -560,9 +558,9 @@ dependencies = [
|
|
|
560
558
|
|
|
561
559
|
[[package]]
|
|
562
560
|
name = "crossbeam-channel"
|
|
563
|
-
version = "0.5.
|
|
561
|
+
version = "0.5.15"
|
|
564
562
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
565
|
-
checksum = "
|
|
563
|
+
checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"
|
|
566
564
|
dependencies = [
|
|
567
565
|
"crossbeam-utils",
|
|
568
566
|
]
|
|
@@ -1399,7 +1397,7 @@ dependencies = [
|
|
|
1399
1397
|
|
|
1400
1398
|
[[package]]
|
|
1401
1399
|
name = "maturin"
|
|
1402
|
-
version = "1.8.
|
|
1400
|
+
version = "1.8.4"
|
|
1403
1401
|
dependencies = [
|
|
1404
1402
|
"anyhow",
|
|
1405
1403
|
"base64 0.21.7",
|
|
@@ -1626,9 +1624,9 @@ checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
|
|
1626
1624
|
|
|
1627
1625
|
[[package]]
|
|
1628
1626
|
name = "openssl"
|
|
1629
|
-
version = "0.10.
|
|
1627
|
+
version = "0.10.72"
|
|
1630
1628
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1631
|
-
checksum = "
|
|
1629
|
+
checksum = "fedfea7d58a1f73118430a55da6a286e7b044961736ce96a16a17068ea25e5da"
|
|
1632
1630
|
dependencies = [
|
|
1633
1631
|
"bitflags 2.5.0",
|
|
1634
1632
|
"cfg-if",
|
|
@@ -1658,9 +1656,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
|
|
1658
1656
|
|
|
1659
1657
|
[[package]]
|
|
1660
1658
|
name = "openssl-sys"
|
|
1661
|
-
version = "0.9.
|
|
1659
|
+
version = "0.9.107"
|
|
1662
1660
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1663
|
-
checksum = "
|
|
1661
|
+
checksum = "8288979acd84749c744a9014b4382d42b8f7b2592847b5afb2ed29e5d16ede07"
|
|
1664
1662
|
dependencies = [
|
|
1665
1663
|
"cc",
|
|
1666
1664
|
"libc",
|
|
@@ -2046,15 +2044,14 @@ dependencies = [
|
|
|
2046
2044
|
|
|
2047
2045
|
[[package]]
|
|
2048
2046
|
name = "ring"
|
|
2049
|
-
version = "0.17.
|
|
2047
|
+
version = "0.17.13"
|
|
2050
2048
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2051
|
-
checksum = "
|
|
2049
|
+
checksum = "70ac5d832aa16abd7d1def883a8545280c20a60f523a370aa3a9617c2b8550ee"
|
|
2052
2050
|
dependencies = [
|
|
2053
2051
|
"cc",
|
|
2054
2052
|
"cfg-if",
|
|
2055
2053
|
"getrandom",
|
|
2056
2054
|
"libc",
|
|
2057
|
-
"spin",
|
|
2058
2055
|
"untrusted",
|
|
2059
2056
|
"windows-sys 0.52.0",
|
|
2060
2057
|
]
|
|
@@ -2436,12 +2433,6 @@ dependencies = [
|
|
|
2436
2433
|
"winapi",
|
|
2437
2434
|
]
|
|
2438
2435
|
|
|
2439
|
-
[[package]]
|
|
2440
|
-
name = "spin"
|
|
2441
|
-
version = "0.9.8"
|
|
2442
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2443
|
-
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
|
2444
|
-
|
|
2445
2436
|
[[package]]
|
|
2446
2437
|
name = "stable_deref_trait"
|
|
2447
2438
|
version = "1.2.0"
|
|
@@ -3438,9 +3429,9 @@ dependencies = [
|
|
|
3438
3429
|
|
|
3439
3430
|
[[package]]
|
|
3440
3431
|
name = "zip"
|
|
3441
|
-
version = "2.
|
|
3432
|
+
version = "2.3.0"
|
|
3442
3433
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3443
|
-
checksum = "
|
|
3434
|
+
checksum = "84e9a772a54b54236b9b744aaaf8d7be01b4d6e99725523cb82cb32d1c81b1d7"
|
|
3444
3435
|
dependencies = [
|
|
3445
3436
|
"arbitrary",
|
|
3446
3437
|
"bzip2",
|
|
@@ -3450,7 +3441,7 @@ dependencies = [
|
|
|
3450
3441
|
"flate2",
|
|
3451
3442
|
"indexmap",
|
|
3452
3443
|
"memchr",
|
|
3453
|
-
"thiserror
|
|
3444
|
+
"thiserror 2.0.3",
|
|
3454
3445
|
"time",
|
|
3455
3446
|
"zopfli",
|
|
3456
3447
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
authors = ["konstin <konstin@mailbox.org>", "messense <messense@icloud.com>"]
|
|
3
3
|
name = "maturin"
|
|
4
|
-
version = "1.8.
|
|
4
|
+
version = "1.8.4"
|
|
5
5
|
description = "Build and publish crates with pyo3, cffi and uniffi bindings as well as rust binaries as python packages"
|
|
6
6
|
exclude = [
|
|
7
7
|
"test-crates/**/*",
|
|
@@ -45,7 +45,7 @@ glob = "0.3.0"
|
|
|
45
45
|
cargo-config2 = "0.1.24"
|
|
46
46
|
cargo_metadata = "0.19.0"
|
|
47
47
|
cargo-options = "0.7.2"
|
|
48
|
-
cbindgen = { version = "0.
|
|
48
|
+
cbindgen = { version = "0.28.0", default-features = false }
|
|
49
49
|
flate2 = "1.0.18"
|
|
50
50
|
goblin = "0.9.0"
|
|
51
51
|
platform-info = "2.0.2"
|
|
@@ -57,7 +57,7 @@ tar = "0.4.38"
|
|
|
57
57
|
tempfile = "3.2.0"
|
|
58
58
|
toml = "0.8.10"
|
|
59
59
|
toml_edit = "0.22.6"
|
|
60
|
-
zip = { version = "2.
|
|
60
|
+
zip = { version = "2.3.0", default-features = false, features = [
|
|
61
61
|
"bzip2",
|
|
62
62
|
"deflate",
|
|
63
63
|
"time",
|
|
@@ -97,7 +97,7 @@ clap = { version = "4.0.0", features = [
|
|
|
97
97
|
clap_complete_command = { version = "0.6.1", optional = true }
|
|
98
98
|
|
|
99
99
|
# cross compile
|
|
100
|
-
cargo-zigbuild = { version = "0.
|
|
100
|
+
cargo-zigbuild = { version = "0.20.0", default-features = false, optional = true }
|
|
101
101
|
cargo-xwin = { version = "0.18.4", default-features = false, optional = true }
|
|
102
102
|
|
|
103
103
|
# log
|
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.8.4]
|
|
4
|
+
|
|
5
|
+
* Install a Rust toolchain into a temporary directory when building maturin itself or a package and a Rust toolchain is
|
|
6
|
+
missing. Set `MATURIN_NO_INSTALL_RUST` to disable this behavior. [#2421](https://github.com/PyO3/maturin/pull/2421)
|
|
7
|
+
* Fix broken `maturin develop` with latest uv in [#2584](https://github.com/PyO3/maturin/pull/2584)
|
|
8
|
+
* Add `PYO3_PYTHON` env var support in [#2534](https://github.com/PyO3/maturin/pull/2534)
|
|
9
|
+
* Sort RECORD file in wheel archives to make them deterministic in [#2550](https://github.com/PyO3/maturin/pull/2550)
|
|
10
|
+
* Publish wheel for loongarch64 in [#2548](https://github.com/PyO3/maturin/pull/2548)
|
|
11
|
+
* Add --compression-level option to build command in [#2572](https://github.com/PyO3/maturin/pull/2572)
|
|
12
|
+
|
|
13
|
+
## [1.8.3]
|
|
14
|
+
|
|
15
|
+
* Fix relocating shared library for namespace modules in [#2513](https://github.com/PyO3/maturin/pull/2513)
|
|
16
|
+
* Don't install dependencies when running `maturin develop --skip-install` in [#2504](https://github.com/PyO3/maturin/pull/2504)
|
|
17
|
+
* Use emcc.bat to query version on Windows in [#2478](https://github.com/PyO3/maturin/pull/2478)
|
|
18
|
+
* Bump the attest-build-provenance version in the generated ci file in [#2484](https://github.com/PyO3/maturin/pull/2478)
|
|
19
|
+
* Fix platform tag on Solaris/Illumos in [#2483](https://github.com/PyO3/maturin/pull/2483)
|
|
20
|
+
* Fix cargo run uniffi-bindgen when cross compiling in [#2476](https://github.com/PyO3/maturin/pull/2476)
|
|
21
|
+
|
|
3
22
|
## [1.8.2]
|
|
4
23
|
|
|
5
24
|
* Exclude packages not in the dependency tree when finding bindings in [#2426](https://github.com/PyO3/maturin/pull/2426)
|
|
@@ -1041,7 +1060,9 @@ points-0.1.0-py2.py3-none-manylinux1_x86_64.whl | 2,8M | 752K | 85K
|
|
|
1041
1060
|
|
|
1042
1061
|
* Initial Release
|
|
1043
1062
|
|
|
1044
|
-
[Unreleased]: https://github.com/pyo3/maturin/compare/v1.8.
|
|
1063
|
+
[Unreleased]: https://github.com/pyo3/maturin/compare/v1.8.4...HEAD
|
|
1064
|
+
[1.8.4]: https://github.com/pyo3/maturin/compare/v1.8.3...v1.8.4
|
|
1065
|
+
[1.8.3]: https://github.com/pyo3/maturin/compare/v1.8.2...v1.8.3
|
|
1045
1066
|
[1.8.2]: https://github.com/pyo3/maturin/compare/v1.8.1...v1.8.2
|
|
1046
1067
|
[1.8.1]: https://github.com/pyo3/maturin/compare/v1.8.0...v1.8.1
|
|
1047
1068
|
[1.8.0]: https://github.com/pyo3/maturin/compare/v1.7.8...v1.8.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: maturin
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.4
|
|
4
4
|
Classifier: Topic :: Software Development :: Build Tools
|
|
5
5
|
Classifier: Programming Language :: Rust
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
@@ -30,9 +30,7 @@ _formerly pyo3-pack_
|
|
|
30
30
|
[](https://maturin.rs)
|
|
31
31
|
[](https://crates.io/crates/maturin)
|
|
32
32
|
[](https://pypi.org/project/maturin)
|
|
33
|
-
[](https://cirrus-ci.com/github/PyO3/maturin)
|
|
35
|
-
[](https://discord.gg/33kcChzH7f)
|
|
33
|
+
[](https://discord.gg/33kcChzH7f)
|
|
36
34
|
|
|
37
35
|
Build and publish crates with [pyo3, cffi and uniffi bindings](https://maturin.rs/bindings) as well as rust binaries as python packages with minimal configuration.
|
|
38
36
|
It supports building wheels for python 3.8+ on Windows, Linux, macOS and FreeBSD, can upload them to [pypi](https://pypi.org/) and has basic PyPy and GraalPy support.
|
|
@@ -41,10 +39,13 @@ Check out the [User Guide](https://maturin.rs/)!
|
|
|
41
39
|
|
|
42
40
|
## Usage
|
|
43
41
|
|
|
44
|
-
You can either download binaries from the [latest release](https://github.com/PyO3/maturin/releases/latest) or install it with [pipx](https://pypa.github.io/pipx/):
|
|
42
|
+
You can either download binaries from the [latest release](https://github.com/PyO3/maturin/releases/latest) or install it with [pipx](https://pypa.github.io/pipx/) or [uv](https://github.com/astral-sh/uv):
|
|
45
43
|
|
|
46
44
|
```shell
|
|
45
|
+
# pipx
|
|
47
46
|
pipx install maturin
|
|
47
|
+
# uv
|
|
48
|
+
uv tool install maturin
|
|
48
49
|
```
|
|
49
50
|
|
|
50
51
|
> [!NOTE]
|
|
@@ -55,10 +56,10 @@ There are four main commands:
|
|
|
55
56
|
|
|
56
57
|
- `maturin new` creates a new cargo project with maturin configured.
|
|
57
58
|
- `maturin publish` builds the crate into python packages and publishes them to pypi.
|
|
58
|
-
- `maturin build` builds the wheels and stores them in a folder (`target/wheels` by default), but doesn't upload them. It's
|
|
59
|
+
- `maturin build` builds the wheels and stores them in a folder (`target/wheels` by default), but doesn't upload them. It's recommended to publish packages with [uv](https://github.com/astral-sh/uv) using `uv publish`.
|
|
59
60
|
- `maturin develop` builds the crate and installs it as a python module directly in the current virtualenv. Note that while `maturin develop` is faster, it doesn't support all the feature that running `pip install` after `maturin build` supports.
|
|
60
61
|
|
|
61
|
-
maturin doesn't need extra configuration files and doesn't clash with an existing setuptools-rust
|
|
62
|
+
maturin doesn't need extra configuration files and doesn't clash with an existing setuptools-rust configuration.
|
|
62
63
|
You can even integrate it with testing tools such as [tox](https://tox.readthedocs.io/en/latest/).
|
|
63
64
|
There are examples for the different bindings in the `test-crates` folder.
|
|
64
65
|
|
|
@@ -79,7 +80,7 @@ which requires the right compilers to be installed. Installing a wheel is much f
|
|
|
79
80
|
|
|
80
81
|
When you publish a package to be installable with `pip install`, you upload it to [pypi](https://pypi.org/), the official package repository.
|
|
81
82
|
For testing, you can use [test pypi](https://test.pypi.org/) instead, which you can use with `pip install --index-url https://test.pypi.org/simple/`.
|
|
82
|
-
Note that for publishing for linux,
|
|
83
|
+
Note that for [publishing for linux](#manylinux-and-auditwheel), you need to use the manylinux docker container or zig, while for publishing from your repository you can use the [PyO3/maturin-action](https://github.com/PyO3/maturin-action) github action.
|
|
83
84
|
|
|
84
85
|
## Mixed rust/python projects
|
|
85
86
|
|
|
@@ -149,7 +150,7 @@ When doing this also be sure to set the module name in your code to match the la
|
|
|
149
150
|
```rust
|
|
150
151
|
#[pymodule]
|
|
151
152
|
#[pyo3(name="_lib_name")]
|
|
152
|
-
fn my_lib_name(
|
|
153
|
+
fn my_lib_name(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
153
154
|
m.add_class::<MyPythonRustClass>()?;
|
|
154
155
|
Ok(())
|
|
155
156
|
}
|
|
@@ -165,10 +166,10 @@ To specify python dependencies, add a list `dependencies` in a `[project]` secti
|
|
|
165
166
|
```toml
|
|
166
167
|
[project]
|
|
167
168
|
name = "my-project"
|
|
168
|
-
dependencies = ["flask~=1.1.0", "toml
|
|
169
|
+
dependencies = ["flask~=1.1.0", "toml>=0.10.2,<0.11.0"]
|
|
169
170
|
```
|
|
170
171
|
|
|
171
|
-
|
|
172
|
+
You can add so called console scripts, which are shell commands that execute some function in your program in the `[project.scripts]` section.
|
|
172
173
|
The keys are the script names while the values are the path to the function in the format `some.module.path:class.function`, where the `class` part is optional. The function is called with no arguments. Example:
|
|
173
174
|
|
|
174
175
|
```toml
|
|
@@ -229,7 +230,7 @@ There's a `maturin sdist` command for only building a source distribution as wor
|
|
|
229
230
|
|
|
230
231
|
For portability reasons, native python modules on linux must only dynamically link a set of very few libraries which are installed basically everywhere, hence the name manylinux.
|
|
231
232
|
The pypa offers special docker images and a tool called [auditwheel](https://github.com/pypa/auditwheel/) to ensure compliance with the [manylinux rules](https://peps.python.org/pep-0599/#the-manylinux2014-policy).
|
|
232
|
-
If you want to publish widely usable wheels for linux pypi, **you need to use a manylinux docker image or
|
|
233
|
+
If you want to publish widely usable wheels for linux pypi, **you need to use a manylinux docker image or build with zig**.
|
|
233
234
|
|
|
234
235
|
The Rust compiler since version 1.64 [requires at least glibc 2.17](https://blog.rust-lang.org/2022/08/01/Increasing-glibc-kernel-requirements.html), so you need to use at least manylinux2014.
|
|
235
236
|
For publishing, we recommend enforcing the same manylinux version as the image with the manylinux flag, e.g. use `--manylinux 2014` if you are building in `quay.io/pypa/manylinux2014_x86_64`.
|
|
@@ -268,7 +269,10 @@ maturin itself is manylinux compliant when compiled for the musl target.
|
|
|
268
269
|
- [roapi](https://github.com/roapi/roapi) - ROAPI automatically spins up read-only APIs for static datasets without requiring you to write a single line of code
|
|
269
270
|
- [robyn](https://github.com/sansyrox/robyn) - A fast and extensible async python web server with a Rust runtime
|
|
270
271
|
- [ruff](https://github.com/charliermarsh/ruff) - An extremely fast Python linter, written in Rust
|
|
272
|
+
- [rnet](https://github.com/0x676e67/rnet) - Asynchronous Python HTTP Client with Black Magic
|
|
273
|
+
- [rustpy-xlsxwriter](https://github.com/rahmadafandi/rustpy-xlsxwriter): A high-performance Python library for generating Excel files, utilizing the [rust_xlsxwriter](https://github.com/jmcnamara/rust_xlsxwriter) crate for efficient data handling.
|
|
271
274
|
- [tantivy-py](https://github.com/quickwit-oss/tantivy-py) - Python bindings for Tantivy
|
|
275
|
+
- [tpchgen-cli](https://github.com/clflushopt/tpchgen-rs/tree/main/tpchgen-cli) - Python CLI binding for `tpchgen`, a blazing fast TPC-H benchmark data generator built in pure Rust with zero dependencies.
|
|
272
276
|
- [watchfiles](https://github.com/samuelcolvin/watchfiles) - Simple, modern and high performance file watching and code reload in python
|
|
273
277
|
- [wonnx](https://github.com/webonnx/wonnx/tree/master/wonnx-py) - Wonnx is a GPU-accelerated ONNX inference run-time written 100% in Rust
|
|
274
278
|
|
|
@@ -5,9 +5,7 @@ _formerly pyo3-pack_
|
|
|
5
5
|
[](https://maturin.rs)
|
|
6
6
|
[](https://crates.io/crates/maturin)
|
|
7
7
|
[](https://pypi.org/project/maturin)
|
|
8
|
-
[](https://cirrus-ci.com/github/PyO3/maturin)
|
|
10
|
-
[](https://discord.gg/33kcChzH7f)
|
|
8
|
+
[](https://discord.gg/33kcChzH7f)
|
|
11
9
|
|
|
12
10
|
Build and publish crates with [pyo3, cffi and uniffi bindings](https://maturin.rs/bindings) as well as rust binaries as python packages with minimal configuration.
|
|
13
11
|
It supports building wheels for python 3.8+ on Windows, Linux, macOS and FreeBSD, can upload them to [pypi](https://pypi.org/) and has basic PyPy and GraalPy support.
|
|
@@ -16,10 +14,13 @@ Check out the [User Guide](https://maturin.rs/)!
|
|
|
16
14
|
|
|
17
15
|
## Usage
|
|
18
16
|
|
|
19
|
-
You can either download binaries from the [latest release](https://github.com/PyO3/maturin/releases/latest) or install it with [pipx](https://pypa.github.io/pipx/):
|
|
17
|
+
You can either download binaries from the [latest release](https://github.com/PyO3/maturin/releases/latest) or install it with [pipx](https://pypa.github.io/pipx/) or [uv](https://github.com/astral-sh/uv):
|
|
20
18
|
|
|
21
19
|
```shell
|
|
20
|
+
# pipx
|
|
22
21
|
pipx install maturin
|
|
22
|
+
# uv
|
|
23
|
+
uv tool install maturin
|
|
23
24
|
```
|
|
24
25
|
|
|
25
26
|
> [!NOTE]
|
|
@@ -30,10 +31,10 @@ There are four main commands:
|
|
|
30
31
|
|
|
31
32
|
- `maturin new` creates a new cargo project with maturin configured.
|
|
32
33
|
- `maturin publish` builds the crate into python packages and publishes them to pypi.
|
|
33
|
-
- `maturin build` builds the wheels and stores them in a folder (`target/wheels` by default), but doesn't upload them. It's
|
|
34
|
+
- `maturin build` builds the wheels and stores them in a folder (`target/wheels` by default), but doesn't upload them. It's recommended to publish packages with [uv](https://github.com/astral-sh/uv) using `uv publish`.
|
|
34
35
|
- `maturin develop` builds the crate and installs it as a python module directly in the current virtualenv. Note that while `maturin develop` is faster, it doesn't support all the feature that running `pip install` after `maturin build` supports.
|
|
35
36
|
|
|
36
|
-
maturin doesn't need extra configuration files and doesn't clash with an existing setuptools-rust
|
|
37
|
+
maturin doesn't need extra configuration files and doesn't clash with an existing setuptools-rust configuration.
|
|
37
38
|
You can even integrate it with testing tools such as [tox](https://tox.readthedocs.io/en/latest/).
|
|
38
39
|
There are examples for the different bindings in the `test-crates` folder.
|
|
39
40
|
|
|
@@ -54,7 +55,7 @@ which requires the right compilers to be installed. Installing a wheel is much f
|
|
|
54
55
|
|
|
55
56
|
When you publish a package to be installable with `pip install`, you upload it to [pypi](https://pypi.org/), the official package repository.
|
|
56
57
|
For testing, you can use [test pypi](https://test.pypi.org/) instead, which you can use with `pip install --index-url https://test.pypi.org/simple/`.
|
|
57
|
-
Note that for publishing for linux,
|
|
58
|
+
Note that for [publishing for linux](#manylinux-and-auditwheel), you need to use the manylinux docker container or zig, while for publishing from your repository you can use the [PyO3/maturin-action](https://github.com/PyO3/maturin-action) github action.
|
|
58
59
|
|
|
59
60
|
## Mixed rust/python projects
|
|
60
61
|
|
|
@@ -124,7 +125,7 @@ When doing this also be sure to set the module name in your code to match the la
|
|
|
124
125
|
```rust
|
|
125
126
|
#[pymodule]
|
|
126
127
|
#[pyo3(name="_lib_name")]
|
|
127
|
-
fn my_lib_name(
|
|
128
|
+
fn my_lib_name(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
128
129
|
m.add_class::<MyPythonRustClass>()?;
|
|
129
130
|
Ok(())
|
|
130
131
|
}
|
|
@@ -140,10 +141,10 @@ To specify python dependencies, add a list `dependencies` in a `[project]` secti
|
|
|
140
141
|
```toml
|
|
141
142
|
[project]
|
|
142
143
|
name = "my-project"
|
|
143
|
-
dependencies = ["flask~=1.1.0", "toml
|
|
144
|
+
dependencies = ["flask~=1.1.0", "toml>=0.10.2,<0.11.0"]
|
|
144
145
|
```
|
|
145
146
|
|
|
146
|
-
|
|
147
|
+
You can add so called console scripts, which are shell commands that execute some function in your program in the `[project.scripts]` section.
|
|
147
148
|
The keys are the script names while the values are the path to the function in the format `some.module.path:class.function`, where the `class` part is optional. The function is called with no arguments. Example:
|
|
148
149
|
|
|
149
150
|
```toml
|
|
@@ -204,7 +205,7 @@ There's a `maturin sdist` command for only building a source distribution as wor
|
|
|
204
205
|
|
|
205
206
|
For portability reasons, native python modules on linux must only dynamically link a set of very few libraries which are installed basically everywhere, hence the name manylinux.
|
|
206
207
|
The pypa offers special docker images and a tool called [auditwheel](https://github.com/pypa/auditwheel/) to ensure compliance with the [manylinux rules](https://peps.python.org/pep-0599/#the-manylinux2014-policy).
|
|
207
|
-
If you want to publish widely usable wheels for linux pypi, **you need to use a manylinux docker image or
|
|
208
|
+
If you want to publish widely usable wheels for linux pypi, **you need to use a manylinux docker image or build with zig**.
|
|
208
209
|
|
|
209
210
|
The Rust compiler since version 1.64 [requires at least glibc 2.17](https://blog.rust-lang.org/2022/08/01/Increasing-glibc-kernel-requirements.html), so you need to use at least manylinux2014.
|
|
210
211
|
For publishing, we recommend enforcing the same manylinux version as the image with the manylinux flag, e.g. use `--manylinux 2014` if you are building in `quay.io/pypa/manylinux2014_x86_64`.
|
|
@@ -243,7 +244,10 @@ maturin itself is manylinux compliant when compiled for the musl target.
|
|
|
243
244
|
- [roapi](https://github.com/roapi/roapi) - ROAPI automatically spins up read-only APIs for static datasets without requiring you to write a single line of code
|
|
244
245
|
- [robyn](https://github.com/sansyrox/robyn) - A fast and extensible async python web server with a Rust runtime
|
|
245
246
|
- [ruff](https://github.com/charliermarsh/ruff) - An extremely fast Python linter, written in Rust
|
|
247
|
+
- [rnet](https://github.com/0x676e67/rnet) - Asynchronous Python HTTP Client with Black Magic
|
|
248
|
+
- [rustpy-xlsxwriter](https://github.com/rahmadafandi/rustpy-xlsxwriter): A high-performance Python library for generating Excel files, utilizing the [rust_xlsxwriter](https://github.com/jmcnamara/rust_xlsxwriter) crate for efficient data handling.
|
|
246
249
|
- [tantivy-py](https://github.com/quickwit-oss/tantivy-py) - Python bindings for Tantivy
|
|
250
|
+
- [tpchgen-cli](https://github.com/clflushopt/tpchgen-rs/tree/main/tpchgen-cli) - Python CLI binding for `tpchgen`, a blazing fast TPC-H benchmark data generator built in pure Rust with zero dependencies.
|
|
247
251
|
- [watchfiles](https://github.com/samuelcolvin/watchfiles) - Simple, modern and high performance file watching and code reload in python
|
|
248
252
|
- [wonnx](https://github.com/webonnx/wonnx/tree/master/wonnx-py) - Wonnx is a GPU-accelerated ONNX inference run-time written 100% in Rust
|
|
249
253
|
|
|
@@ -34,7 +34,10 @@ def get_config() -> Dict[str, str]:
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
def get_maturin_pep517_args(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
|
|
37
|
-
build_args =
|
|
37
|
+
build_args = None
|
|
38
|
+
if config_settings:
|
|
39
|
+
# TODO: Deprecate and remove build-args in favor of maturin.build-args in maturin 2.0
|
|
40
|
+
build_args = config_settings.get("maturin.build-args", config_settings.get("build-args"))
|
|
38
41
|
if build_args is None:
|
|
39
42
|
env_args = os.getenv("MATURIN_PEP517_ARGS", "")
|
|
40
43
|
args = shlex.split(env_args)
|
|
@@ -65,6 +68,17 @@ def _additional_pep517_args() -> List[str]:
|
|
|
65
68
|
return []
|
|
66
69
|
|
|
67
70
|
|
|
71
|
+
def _get_env() -> Optional[Dict[str, str]]:
|
|
72
|
+
if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
|
|
73
|
+
from puccinialin import setup_rust
|
|
74
|
+
|
|
75
|
+
print("Rust not found, installing into a temporary directory")
|
|
76
|
+
extra_env = setup_rust()
|
|
77
|
+
return {**os.environ, **extra_env}
|
|
78
|
+
else:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
|
|
68
82
|
# noinspection PyUnusedLocal
|
|
69
83
|
def _build_wheel(
|
|
70
84
|
wheel_directory: str,
|
|
@@ -97,7 +111,7 @@ def _build_wheel(
|
|
|
97
111
|
|
|
98
112
|
print("Running `{}`".format(" ".join(command)))
|
|
99
113
|
sys.stdout.flush()
|
|
100
|
-
result = subprocess.run(command, stdout=subprocess.PIPE)
|
|
114
|
+
result = subprocess.run(command, stdout=subprocess.PIPE, env=_get_env())
|
|
101
115
|
sys.stdout.buffer.write(result.stdout)
|
|
102
116
|
sys.stdout.flush()
|
|
103
117
|
if result.returncode != 0:
|
|
@@ -125,7 +139,7 @@ def build_sdist(sdist_directory: str, config_settings: Optional[Mapping[str, Any
|
|
|
125
139
|
|
|
126
140
|
print("Running `{}`".format(" ".join(command)))
|
|
127
141
|
sys.stdout.flush()
|
|
128
|
-
result = subprocess.run(command, stdout=subprocess.PIPE)
|
|
142
|
+
result = subprocess.run(command, stdout=subprocess.PIPE, env=_get_env())
|
|
129
143
|
sys.stdout.buffer.write(result.stdout)
|
|
130
144
|
sys.stdout.flush()
|
|
131
145
|
if result.returncode != 0:
|
|
@@ -138,9 +152,12 @@ def build_sdist(sdist_directory: str, config_settings: Optional[Mapping[str, Any
|
|
|
138
152
|
# noinspection PyUnusedLocal
|
|
139
153
|
def get_requires_for_build_wheel(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
|
|
140
154
|
if get_config().get("bindings") == "cffi":
|
|
141
|
-
|
|
155
|
+
requirements = ["cffi"]
|
|
142
156
|
else:
|
|
143
|
-
|
|
157
|
+
requirements = []
|
|
158
|
+
if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
|
|
159
|
+
requirements += ["puccinialin"]
|
|
160
|
+
return requirements
|
|
144
161
|
|
|
145
162
|
|
|
146
163
|
# noinspection PyUnusedLocal
|
|
@@ -158,7 +175,10 @@ get_requires_for_build_editable = get_requires_for_build_wheel
|
|
|
158
175
|
|
|
159
176
|
# noinspection PyUnusedLocal
|
|
160
177
|
def get_requires_for_build_sdist(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
|
|
161
|
-
|
|
178
|
+
requirements = []
|
|
179
|
+
if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
|
|
180
|
+
requirements += ["puccinialin"]
|
|
181
|
+
return requirements
|
|
162
182
|
|
|
163
183
|
|
|
164
184
|
# noinspection PyUnusedLocal
|
|
@@ -168,7 +188,7 @@ def prepare_metadata_for_build_wheel(
|
|
|
168
188
|
print("Checking for Rust toolchain....")
|
|
169
189
|
is_cargo_installed = False
|
|
170
190
|
try:
|
|
171
|
-
output = subprocess.check_output(["cargo", "--version"]).decode("utf-8", "ignore")
|
|
191
|
+
output = subprocess.check_output(["cargo", "--version"], env=_get_env()).decode("utf-8", "ignore")
|
|
172
192
|
if "cargo" in output:
|
|
173
193
|
is_cargo_installed = True
|
|
174
194
|
except (FileNotFoundError, SubprocessError):
|
|
@@ -200,7 +220,7 @@ def prepare_metadata_for_build_wheel(
|
|
|
200
220
|
|
|
201
221
|
print("Running `{}`".format(" ".join(command)))
|
|
202
222
|
try:
|
|
203
|
-
_output = subprocess.check_output(command)
|
|
223
|
+
_output = subprocess.check_output(command, env=_get_env())
|
|
204
224
|
except subprocess.CalledProcessError as e:
|
|
205
225
|
sys.stderr.write(f"Error running maturin: {e}\n")
|
|
206
226
|
sys.exit(1)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Support installing rust before compiling (bootstrapping) maturin.
|
|
2
|
+
|
|
3
|
+
Installing a package that uses maturin as build backend on a platform without maturin
|
|
4
|
+
binaries, we install rust in a cache directory if the user doesn't have a rust
|
|
5
|
+
installation already. Since this bootstrapping requires more dependencies but is only
|
|
6
|
+
required if rust is missing, we check if cargo is present before requesting those
|
|
7
|
+
dependencies.
|
|
8
|
+
|
|
9
|
+
https://setuptools.pypa.io/en/stable/build_meta.html#dynamic-build-dependencies-and-other-build-meta-tweaks
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
import shutil
|
|
16
|
+
from typing import Any
|
|
17
|
+
|
|
18
|
+
# noinspection PyUnresolvedReferences
|
|
19
|
+
from setuptools.build_meta import * # noqa:F403
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def get_requires_for_build_wheel(_config_settings: dict[str, Any] | None = None) -> list[str]:
|
|
23
|
+
if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
|
|
24
|
+
return ["puccinialin>=0.1,<0.2"]
|
|
25
|
+
return []
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def get_requires_for_build_sdist(_config_settings: dict[str, Any] | None = None) -> list[str]:
|
|
29
|
+
if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
|
|
30
|
+
return ["puccinialin>=0.1,<0.2"]
|
|
31
|
+
return []
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# Workaround to bootstrap maturin on non-manylinux platforms
|
|
2
2
|
[build-system]
|
|
3
|
-
requires = ["setuptools", "
|
|
4
|
-
|
|
3
|
+
requires = ["setuptools", "tomli>=1.1.0 ; python_version<'3.11'", "setuptools-rust"]
|
|
4
|
+
backend-path = ["maturin"]
|
|
5
|
+
build-backend = "bootstrap"
|
|
5
6
|
|
|
6
7
|
[project]
|
|
7
8
|
name = "maturin"
|
|
@@ -9,7 +10,7 @@ description = "Build and publish crates with pyo3, cffi and uniffi bindings as w
|
|
|
9
10
|
authors = [{ name = "konstin", email = "konstin@mailbox.org" }]
|
|
10
11
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
11
12
|
requires-python = ">=3.7"
|
|
12
|
-
license = {text = "MIT OR Apache-2.0"}
|
|
13
|
+
license = { text = "MIT OR Apache-2.0" }
|
|
13
14
|
classifiers = [
|
|
14
15
|
"Topic :: Software Development :: Build Tools",
|
|
15
16
|
"Programming Language :: Rust",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import os
|
|
13
13
|
import shlex
|
|
14
|
+
import shutil
|
|
14
15
|
|
|
15
16
|
try:
|
|
16
17
|
import tomllib
|
|
@@ -47,9 +48,18 @@ cargo_args = ["--no-default-features"]
|
|
|
47
48
|
if os.getenv("MATURIN_SETUP_ARGS"):
|
|
48
49
|
cargo_args = shlex.split(os.getenv("MATURIN_SETUP_ARGS", ""))
|
|
49
50
|
|
|
51
|
+
if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
|
|
52
|
+
from puccinialin import setup_rust
|
|
53
|
+
|
|
54
|
+
print("Rust not found, installing into a temporary directory")
|
|
55
|
+
extra_env = setup_rust()
|
|
56
|
+
env = {**os.environ, **extra_env}
|
|
57
|
+
else:
|
|
58
|
+
env = None
|
|
59
|
+
|
|
50
60
|
setup(
|
|
51
61
|
version=version,
|
|
52
62
|
cmdclass={"bdist_wheel": bdist_wheel},
|
|
53
|
-
rust_extensions=[RustBin("maturin", args=cargo_args, cargo_manifest_args=["--locked"])],
|
|
63
|
+
rust_extensions=[RustBin("maturin", args=cargo_args, cargo_manifest_args=["--locked"], env=env)],
|
|
54
64
|
zip_safe=False,
|
|
55
65
|
)
|