maturin 1.3.0__tar.gz → 1.3.2__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.

Files changed (58) hide show
  1. {maturin-1.3.0 → maturin-1.3.2}/.cirrus.yml +2 -2
  2. {maturin-1.3.0 → maturin-1.3.2}/.pre-commit-config.yaml +5 -8
  3. {maturin-1.3.0 → maturin-1.3.2}/Cargo.lock +37 -118
  4. {maturin-1.3.0 → maturin-1.3.2}/Cargo.toml +8 -7
  5. {maturin-1.3.0 → maturin-1.3.2}/Changelog.md +21 -1
  6. {maturin-1.3.0 → maturin-1.3.2}/PKG-INFO +1 -1
  7. {maturin-1.3.0 → maturin-1.3.2}/maturin/__init__.py +8 -28
  8. {maturin-1.3.0 → maturin-1.3.2}/maturin/import_hook.py +5 -16
  9. {maturin-1.3.0 → maturin-1.3.2}/setup.py +1 -3
  10. {maturin-1.3.0 → maturin-1.3.2}/src/auditwheel/audit.rs +1 -1
  11. {maturin-1.3.0 → maturin-1.3.2}/src/compile.rs +2 -2
  12. {maturin-1.3.0 → maturin-1.3.2}/src/metadata.rs +58 -2
  13. {maturin-1.3.0 → maturin-1.3.2}/src/module_writer.rs +7 -11
  14. {maturin-1.3.0 → maturin-1.3.2}/src/new_project.rs +6 -0
  15. {maturin-1.3.0 → maturin-1.3.2}/src/python_interpreter/mod.rs +6 -6
  16. {maturin-1.3.0 → maturin-1.3.2}/src/source_distribution.rs +46 -24
  17. {maturin-1.3.0 → maturin-1.3.2}/src/templates/Cargo.toml.j2 +2 -2
  18. {maturin-1.3.0 → maturin-1.3.2}/src/templates/pyproject.toml.j2 +7 -1
  19. maturin-1.3.2/src/templates/test_all.py.j2 +6 -0
  20. {maturin-1.3.0 → maturin-1.3.2}/.codespellrc +0 -0
  21. {maturin-1.3.0 → maturin-1.3.2}/.config/nextest.toml +0 -0
  22. {maturin-1.3.0 → maturin-1.3.2}/.gitignore +0 -0
  23. {maturin-1.3.0 → maturin-1.3.2}/MANIFEST.in +0 -0
  24. {maturin-1.3.0 → maturin-1.3.2}/README.md +0 -0
  25. {maturin-1.3.0 → maturin-1.3.2}/clippy.toml +0 -0
  26. {maturin-1.3.0 → maturin-1.3.2}/license-apache +0 -0
  27. {maturin-1.3.0 → maturin-1.3.2}/license-mit +0 -0
  28. {maturin-1.3.0 → maturin-1.3.2}/maturin/__main__.py +0 -0
  29. {maturin-1.3.0 → maturin-1.3.2}/netlify.toml +0 -0
  30. {maturin-1.3.0 → maturin-1.3.2}/pyproject.toml +0 -0
  31. {maturin-1.3.0 → maturin-1.3.2}/src/auditwheel/manylinux-policy.json +0 -0
  32. {maturin-1.3.0 → maturin-1.3.2}/src/auditwheel/mod.rs +0 -0
  33. {maturin-1.3.0 → maturin-1.3.2}/src/auditwheel/musllinux-policy.json +0 -0
  34. {maturin-1.3.0 → maturin-1.3.2}/src/auditwheel/musllinux.rs +0 -0
  35. {maturin-1.3.0 → maturin-1.3.2}/src/auditwheel/patchelf.rs +0 -0
  36. {maturin-1.3.0 → maturin-1.3.2}/src/auditwheel/platform_tag.rs +0 -0
  37. {maturin-1.3.0 → maturin-1.3.2}/src/auditwheel/policy.rs +0 -0
  38. {maturin-1.3.0 → maturin-1.3.2}/src/auditwheel/repair.rs +0 -0
  39. {maturin-1.3.0 → maturin-1.3.2}/src/build_context.rs +0 -0
  40. {maturin-1.3.0 → maturin-1.3.2}/src/build_options.rs +0 -0
  41. {maturin-1.3.0 → maturin-1.3.2}/src/cargo_toml.rs +0 -0
  42. {maturin-1.3.0 → maturin-1.3.2}/src/ci.rs +0 -0
  43. {maturin-1.3.0 → maturin-1.3.2}/src/cross_compile.rs +0 -0
  44. {maturin-1.3.0 → maturin-1.3.2}/src/develop.rs +0 -0
  45. {maturin-1.3.0 → maturin-1.3.2}/src/lib.rs +0 -0
  46. {maturin-1.3.0 → maturin-1.3.2}/src/main.rs +0 -0
  47. {maturin-1.3.0 → maturin-1.3.2}/src/project_layout.rs +0 -0
  48. {maturin-1.3.0 → maturin-1.3.2}/src/pyproject_toml.rs +0 -0
  49. {maturin-1.3.0 → maturin-1.3.2}/src/python_interpreter/config.rs +0 -0
  50. {maturin-1.3.0 → maturin-1.3.2}/src/python_interpreter/get_interpreter_metadata.py +0 -0
  51. {maturin-1.3.0 → maturin-1.3.2}/src/target.rs +0 -0
  52. {maturin-1.3.0 → maturin-1.3.2}/src/templates/.gitignore.j2 +0 -0
  53. {maturin-1.3.0 → maturin-1.3.2}/src/templates/__init__.py.j2 +0 -0
  54. {maturin-1.3.0 → maturin-1.3.2}/src/templates/build.rs.j2 +0 -0
  55. {maturin-1.3.0 → maturin-1.3.2}/src/templates/example.udl.j2 +0 -0
  56. {maturin-1.3.0 → maturin-1.3.2}/src/templates/lib.rs.j2 +0 -0
  57. {maturin-1.3.0 → maturin-1.3.2}/src/templates/main.rs.j2 +0 -0
  58. {maturin-1.3.0 → maturin-1.3.2}/src/upload.rs +0 -0
@@ -45,7 +45,7 @@ macos_arm64_task:
45
45
  - cat Cargo.lock
46
46
  install_script:
47
47
  - brew install python3
48
- - python3 -m pip install uniffi-bindgen==0.24.1
48
+ - python3 -m pip install uniffi-bindgen==0.25.0
49
49
  <<: *BUILD_AND_TEST
50
50
 
51
51
  linux_aarch64_task:
@@ -62,5 +62,5 @@ linux_aarch64_task:
62
62
  - echo $CIRRUS_OS
63
63
  - cat Cargo.lock
64
64
  install_script:
65
- - python3 -m pip install uniffi-bindgen==0.24.1
65
+ - python3 -m pip install uniffi-bindgen==0.25.0
66
66
  <<: *BUILD_AND_TEST
@@ -38,7 +38,7 @@ repos:
38
38
  types: [rust]
39
39
  stages: [manual] # because it's slow
40
40
  - repo: https://github.com/pre-commit/pre-commit-hooks
41
- rev: v4.4.0
41
+ rev: v4.5.0
42
42
  hooks:
43
43
  - id: check-yaml
44
44
  - id: check-toml
@@ -55,21 +55,18 @@ repos:
55
55
  (.*\.stdout)
56
56
  )
57
57
  - id: mixed-line-ending
58
- - repo: https://github.com/psf/black
59
- rev: 23.9.1
60
- hooks:
61
- - id: black
62
58
  - repo: https://github.com/astral-sh/ruff-pre-commit
63
- rev: v0.0.291
59
+ rev: v0.1.5
64
60
  hooks:
61
+ - id: ruff-format
65
62
  - id: ruff
66
63
  - repo: https://github.com/pre-commit/mirrors-mypy
67
- rev: v1.5.1
64
+ rev: v1.7.0
68
65
  hooks:
69
66
  - id: mypy
70
67
  entry: mypy maturin/
71
68
  pass_filenames: false
72
69
  - repo: https://github.com/codespell-project/codespell
73
- rev: v2.2.5
70
+ rev: v2.2.6
74
71
  hooks:
75
72
  - id: codespell
@@ -10,9 +10,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
10
10
 
11
11
  [[package]]
12
12
  name = "ahash"
13
- version = "0.7.6"
13
+ version = "0.7.7"
14
14
  source = "registry+https://github.com/rust-lang/crates.io-index"
15
- checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
15
+ checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd"
16
16
  dependencies = [
17
17
  "getrandom",
18
18
  "once_cell",
@@ -126,12 +126,6 @@ dependencies = [
126
126
  "serde",
127
127
  ]
128
128
 
129
- [[package]]
130
- name = "bumpalo"
131
- version = "3.13.0"
132
- source = "registry+https://github.com/rust-lang/crates.io-index"
133
- checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
134
-
135
129
  [[package]]
136
130
  name = "byteorder"
137
131
  version = "1.4.3"
@@ -226,9 +220,9 @@ dependencies = [
226
220
 
227
221
  [[package]]
228
222
  name = "cargo-xwin"
229
- version = "0.14.7"
223
+ version = "0.14.8"
230
224
  source = "registry+https://github.com/rust-lang/crates.io-index"
231
- checksum = "9a93406d2e8be2104cbcd9b9099ad11cf399c65102ecb0285d026a57aa1896bd"
225
+ checksum = "11c08ee57b16103990269874220c0e8a4613b8096a314ce2f29ad1b54d4b6d02"
232
226
  dependencies = [
233
227
  "anyhow",
234
228
  "cargo-config2",
@@ -246,9 +240,9 @@ dependencies = [
246
240
 
247
241
  [[package]]
248
242
  name = "cargo-zigbuild"
249
- version = "0.17.3"
243
+ version = "0.17.5"
250
244
  source = "registry+https://github.com/rust-lang/crates.io-index"
251
- checksum = "2307bb523befb01f7e8cf299c2219439339316964c3a4e95e29bd1c7831fae89"
245
+ checksum = "d5166694ea85c72f887293af72a665d7ac5a537649e607773bf834cb6303b1da"
252
246
  dependencies = [
253
247
  "anyhow",
254
248
  "cargo-options",
@@ -282,9 +276,9 @@ dependencies = [
282
276
 
283
277
  [[package]]
284
278
  name = "cbindgen"
285
- version = "0.25.0"
279
+ version = "0.26.0"
286
280
  source = "registry+https://github.com/rust-lang/crates.io-index"
287
- checksum = "faeaa693e5a727975a79211b8f35c0cb09b031fdb6eaa4a788bc6713d01488ca"
281
+ checksum = "da6bc11b07529f16944307272d5bd9b22530bc7d05751717c9d416586cedab49"
288
282
  dependencies = [
289
283
  "heck",
290
284
  "indexmap",
@@ -576,12 +570,13 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
576
570
 
577
571
  [[package]]
578
572
  name = "dialoguer"
579
- version = "0.10.4"
573
+ version = "0.11.0"
580
574
  source = "registry+https://github.com/rust-lang/crates.io-index"
581
- checksum = "59c6f2989294b9a498d3ad5491a79c6deb604617378e1cdc4bfc1c1361fe2f87"
575
+ checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de"
582
576
  dependencies = [
583
577
  "console",
584
578
  "shell-words",
579
+ "thiserror",
585
580
  "zeroize",
586
581
  ]
587
582
 
@@ -963,15 +958,6 @@ version = "1.0.9"
963
958
  source = "registry+https://github.com/rust-lang/crates.io-index"
964
959
  checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
965
960
 
966
- [[package]]
967
- name = "js-sys"
968
- version = "0.3.64"
969
- source = "registry+https://github.com/rust-lang/crates.io-index"
970
- checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
971
- dependencies = [
972
- "wasm-bindgen",
973
- ]
974
-
975
961
  [[package]]
976
962
  name = "keyring"
977
963
  version = "2.0.5"
@@ -1068,7 +1054,7 @@ dependencies = [
1068
1054
 
1069
1055
  [[package]]
1070
1056
  name = "maturin"
1071
- version = "1.3.0"
1057
+ version = "1.3.2"
1072
1058
  dependencies = [
1073
1059
  "anyhow",
1074
1060
  "base64 0.21.2",
@@ -1104,6 +1090,7 @@ dependencies = [
1104
1090
  "native-tls",
1105
1091
  "normpath",
1106
1092
  "once_cell",
1093
+ "path-slash",
1107
1094
  "pep440_rs",
1108
1095
  "pep508_rs",
1109
1096
  "platform-info",
@@ -1170,9 +1157,9 @@ dependencies = [
1170
1157
 
1171
1158
  [[package]]
1172
1159
  name = "minijinja"
1173
- version = "1.0.6"
1160
+ version = "1.0.8"
1174
1161
  source = "registry+https://github.com/rust-lang/crates.io-index"
1175
- checksum = "e436cdb19900a08197c6b874280d24f9289d127275eadc23623276e0f5ec97e9"
1162
+ checksum = "80084fa3099f58b7afab51e5f92e24c2c2c68dcad26e96ad104bd6011570461d"
1176
1163
  dependencies = [
1177
1164
  "serde",
1178
1165
  ]
@@ -1672,17 +1659,16 @@ dependencies = [
1672
1659
 
1673
1660
  [[package]]
1674
1661
  name = "ring"
1675
- version = "0.16.20"
1662
+ version = "0.17.3"
1676
1663
  source = "registry+https://github.com/rust-lang/crates.io-index"
1677
- checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
1664
+ checksum = "9babe80d5c16becf6594aa32ad2be8fe08498e7ae60b77de8df700e67f191d7e"
1678
1665
  dependencies = [
1679
1666
  "cc",
1667
+ "getrandom",
1680
1668
  "libc",
1681
- "once_cell",
1682
1669
  "spin",
1683
1670
  "untrusted",
1684
- "web-sys",
1685
- "winapi",
1671
+ "windows-sys 0.48.0",
1686
1672
  ]
1687
1673
 
1688
1674
  [[package]]
@@ -1696,9 +1682,9 @@ dependencies = [
1696
1682
 
1697
1683
  [[package]]
1698
1684
  name = "rustix"
1699
- version = "0.37.23"
1685
+ version = "0.37.25"
1700
1686
  source = "registry+https://github.com/rust-lang/crates.io-index"
1701
- checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06"
1687
+ checksum = "d4eb579851244c2c03e7c24f501c3432bed80b8f720af1d6e5b0e0f01555a035"
1702
1688
  dependencies = [
1703
1689
  "bitflags",
1704
1690
  "errno",
@@ -1710,9 +1696,9 @@ dependencies = [
1710
1696
 
1711
1697
  [[package]]
1712
1698
  name = "rustls"
1713
- version = "0.21.2"
1699
+ version = "0.21.8"
1714
1700
  source = "registry+https://github.com/rust-lang/crates.io-index"
1715
- checksum = "e32ca28af694bc1bbf399c33a516dbdf1c90090b8ab23c2bc24f834aa2247f5f"
1701
+ checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c"
1716
1702
  dependencies = [
1717
1703
  "log",
1718
1704
  "ring",
@@ -1731,9 +1717,9 @@ dependencies = [
1731
1717
 
1732
1718
  [[package]]
1733
1719
  name = "rustls-webpki"
1734
- version = "0.100.2"
1720
+ version = "0.101.7"
1735
1721
  source = "registry+https://github.com/rust-lang/crates.io-index"
1736
- checksum = "e98ff011474fa39949b7e5c0428f9b4937eda7da7848bbb947786b7be0b27dab"
1722
+ checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
1737
1723
  dependencies = [
1738
1724
  "ring",
1739
1725
  "untrusted",
@@ -1797,9 +1783,9 @@ dependencies = [
1797
1783
 
1798
1784
  [[package]]
1799
1785
  name = "sct"
1800
- version = "0.7.0"
1786
+ version = "0.7.1"
1801
1787
  source = "registry+https://github.com/rust-lang/crates.io-index"
1802
- checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4"
1788
+ checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
1803
1789
  dependencies = [
1804
1790
  "ring",
1805
1791
  "untrusted",
@@ -1977,9 +1963,9 @@ dependencies = [
1977
1963
 
1978
1964
  [[package]]
1979
1965
  name = "spin"
1980
- version = "0.5.2"
1966
+ version = "0.9.8"
1981
1967
  source = "registry+https://github.com/rust-lang/crates.io-index"
1982
- checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
1968
+ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
1983
1969
 
1984
1970
  [[package]]
1985
1971
  name = "stacker"
@@ -2356,15 +2342,15 @@ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
2356
2342
 
2357
2343
  [[package]]
2358
2344
  name = "untrusted"
2359
- version = "0.7.1"
2345
+ version = "0.9.0"
2360
2346
  source = "registry+https://github.com/rust-lang/crates.io-index"
2361
- checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
2347
+ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
2362
2348
 
2363
2349
  [[package]]
2364
2350
  name = "ureq"
2365
- version = "2.7.1"
2351
+ version = "2.8.0"
2366
2352
  source = "registry+https://github.com/rust-lang/crates.io-index"
2367
- checksum = "0b11c96ac7ee530603dcdf68ed1557050f374ce55a5a07193ebf8cbc9f8927e9"
2353
+ checksum = "f5ccd538d4a604753ebc2f17cd9946e89b77bf87f6a8e2309667c6f2e87855e3"
2368
2354
  dependencies = [
2369
2355
  "base64 0.21.2",
2370
2356
  "flate2",
@@ -2382,9 +2368,9 @@ dependencies = [
2382
2368
 
2383
2369
  [[package]]
2384
2370
  name = "url"
2385
- version = "2.4.0"
2371
+ version = "2.4.1"
2386
2372
  source = "registry+https://github.com/rust-lang/crates.io-index"
2387
- checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb"
2373
+ checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
2388
2374
  dependencies = [
2389
2375
  "form_urlencoded",
2390
2376
  "idna",
@@ -2457,78 +2443,11 @@ version = "0.11.0+wasi-snapshot-preview1"
2457
2443
  source = "registry+https://github.com/rust-lang/crates.io-index"
2458
2444
  checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
2459
2445
 
2460
- [[package]]
2461
- name = "wasm-bindgen"
2462
- version = "0.2.87"
2463
- source = "registry+https://github.com/rust-lang/crates.io-index"
2464
- checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
2465
- dependencies = [
2466
- "cfg-if",
2467
- "wasm-bindgen-macro",
2468
- ]
2469
-
2470
- [[package]]
2471
- name = "wasm-bindgen-backend"
2472
- version = "0.2.87"
2473
- source = "registry+https://github.com/rust-lang/crates.io-index"
2474
- checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
2475
- dependencies = [
2476
- "bumpalo",
2477
- "log",
2478
- "once_cell",
2479
- "proc-macro2",
2480
- "quote",
2481
- "syn 2.0.29",
2482
- "wasm-bindgen-shared",
2483
- ]
2484
-
2485
- [[package]]
2486
- name = "wasm-bindgen-macro"
2487
- version = "0.2.87"
2488
- source = "registry+https://github.com/rust-lang/crates.io-index"
2489
- checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
2490
- dependencies = [
2491
- "quote",
2492
- "wasm-bindgen-macro-support",
2493
- ]
2494
-
2495
- [[package]]
2496
- name = "wasm-bindgen-macro-support"
2497
- version = "0.2.87"
2498
- source = "registry+https://github.com/rust-lang/crates.io-index"
2499
- checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
2500
- dependencies = [
2501
- "proc-macro2",
2502
- "quote",
2503
- "syn 2.0.29",
2504
- "wasm-bindgen-backend",
2505
- "wasm-bindgen-shared",
2506
- ]
2507
-
2508
- [[package]]
2509
- name = "wasm-bindgen-shared"
2510
- version = "0.2.87"
2511
- source = "registry+https://github.com/rust-lang/crates.io-index"
2512
- checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
2513
-
2514
- [[package]]
2515
- name = "web-sys"
2516
- version = "0.3.64"
2517
- source = "registry+https://github.com/rust-lang/crates.io-index"
2518
- checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
2519
- dependencies = [
2520
- "js-sys",
2521
- "wasm-bindgen",
2522
- ]
2523
-
2524
2446
  [[package]]
2525
2447
  name = "webpki-roots"
2526
- version = "0.23.1"
2448
+ version = "0.25.2"
2527
2449
  source = "registry+https://github.com/rust-lang/crates.io-index"
2528
- checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338"
2529
- dependencies = [
2530
- "rustls-webpki",
2531
- ]
2450
+ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc"
2532
2451
 
2533
2452
  [[package]]
2534
2453
  name = "which"
@@ -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.3.0"
4
+ version = "1.3.2"
5
5
  description = "Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages"
6
6
  exclude = [
7
7
  "test-crates/**/*",
@@ -41,7 +41,7 @@ glob = "0.3.0"
41
41
  cargo-config2 = "0.1.9"
42
42
  cargo_metadata = "0.18.0"
43
43
  cargo-options = "0.6.0"
44
- cbindgen = { version = "0.25.0", default-features = false }
44
+ cbindgen = { version = "0.26.0", default-features = false }
45
45
  flate2 = "1.0.18"
46
46
  goblin = "0.7.1"
47
47
  platform-info = "2.0.2"
@@ -71,6 +71,7 @@ lddtree = "0.3.3"
71
71
  cc = "1.0.72"
72
72
  dunce = "1.0.2"
73
73
  normpath = "1.0.0"
74
+ path-slash = "0.2.1"
74
75
  pep440_rs = { version = "0.3.6", features = ["serde"] }
75
76
  pep508_rs = { version = "0.2.1", features = ["serde"] }
76
77
  time = "0.3.17"
@@ -80,7 +81,7 @@ clap = { version = "4.0.0", features = ["derive", "env", "wrap_help"] }
80
81
  clap_complete_command = { version = "0.5.1", optional = true }
81
82
 
82
83
  # cross compile
83
- cargo-zigbuild = { version = "0.17.3", default-features = false, optional = true }
84
+ cargo-zigbuild = { version = "0.17.5", default-features = false, optional = true }
84
85
  cargo-xwin = { version = "0.14.7", default-features = false, optional = true }
85
86
 
86
87
  # log
@@ -88,9 +89,9 @@ tracing = "0.1.36"
88
89
  tracing-subscriber = { version = "0.3.15", features = ["env-filter"], optional = true }
89
90
 
90
91
  # project scaffolding, maturin new/init/generate-ci
91
- dialoguer = { version = "0.10.2", default-features = false, optional = true }
92
+ dialoguer = { version = "0.11.0", default-features = false, optional = true }
92
93
  console = { version = "0.15.4", optional = true }
93
- minijinja = { version = "1.0.0", optional = true }
94
+ minijinja = { version = "1.0.7", optional = true }
94
95
 
95
96
  # upload
96
97
  bytesize = { version = "1.0.1", optional = true }
@@ -99,11 +100,11 @@ dirs = { version = "5.0.0", optional = true }
99
100
  multipart = { version = "0.18.0", features = ["client"], default-features = false, optional = true }
100
101
  ureq = { version = "2.7.0", features = ["gzip", "json", "socks-proxy"], default-features = false, optional = true }
101
102
  native-tls = { version = "0.2.8", optional = true }
102
- rustls = { version = "0.21.2", optional = true }
103
+ rustls = { version = "0.21.8", optional = true }
103
104
  rustls-pemfile = { version = "1.0.1", optional = true }
104
105
  keyring = { version = "2.0.0", default-features = false, features = ["linux-no-secret-service"], optional = true }
105
106
  wild = { version = "2.1.0", optional = true }
106
- url = { version = "2.3.1", optional = true }
107
+ url = { version = "2.4.1", optional = true }
107
108
 
108
109
  [dev-dependencies]
109
110
  expect-test = "1.4.1"
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.3.2] - 2023-11-14
11
+
12
+ * Add support for uniffi library mode in [#1729](https://github.com/PyO3/maturin/pull/1729)
13
+ * Un-deprecate `MATURIN_PEP517_ARGS` env var in [#1820](https://github.com/PyO3/maturin/pull/1820)
14
+ * Fix missing member in Cargo.toml for sdist of nested workspace layout in [#1828](https://github.com/PyO3/maturin/pull/1828)
15
+ * Escape display name in email addresses of wheel metadata in [#1832](https://github.com/PyO3/maturin/pull/1832)
16
+ * Fix rewriting workspace Cargo.toml in sdist in [#1841](https://github.com/PyO3/maturin/pull/1841)
17
+ * Fix glob workspace members matching in sdist in [#1846](https://github.com/PyO3/maturin/pull/1846)
18
+
19
+ ## [1.3.1] - 2023-10-24
20
+
21
+ * Use external `uniffi-bindgen` if no root package is configured in [#1797](https://github.com/PyO3/maturin/pull/1797)
22
+ * Fix wheel filename for GraalPy in [#1802](https://github.com/PyO3/maturin/pull/1802)
23
+ * Add unittest skeleton to mixed Python/Rust projects in [#1807](https://github.com/PyO3/maturin/pull/1807)
24
+ * Preserve trailing whitespace in new project files in [#1808](https://github.com/PyO3/maturin/pull/1808)
25
+ * Fix missing `workspace.members` in sdist in [#1811](https://github.com/PyO3/maturin/pull/1811)
26
+ * Don't set `MACOSX_DEPLOYMENT_TARGET` for editable builds by default in [#1815](https://github.com/PyO3/maturin/pull/1815)
27
+
10
28
  ## [1.3.0] - 2023-10-02
11
29
 
12
30
  * Refactor Cargo sdist generator to avoid rewriting local dependencies in [#1741](https://github.com/PyO3/maturin/pull/1741)
@@ -918,7 +936,9 @@ points-0.1.0-py2.py3-none-manylinux1_x86_64.whl | 2,8M | 752K | 85K
918
936
 
919
937
  * Initial Release
920
938
 
921
- [Unreleased]: https://github.com/pyo3/maturin/compare/v1.3.0...HEAD
939
+ [Unreleased]: https://github.com/pyo3/maturin/compare/v1.3.2...HEAD
940
+ [1.3.2]: https://github.com/pyo3/maturin/compare/v1.3.1...v1.3.2
941
+ [1.3.1]: https://github.com/pyo3/maturin/compare/v1.3.0...v1.3.1
922
942
  [1.3.0]: https://github.com/pyo3/maturin/compare/v1.2.3...v1.3.0
923
943
  [1.2.3]: https://github.com/pyo3/maturin/compare/v1.2.2...v1.2.3
924
944
  [1.2.2]: https://github.com/pyo3/maturin/compare/v1.2.1...v1.2.2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maturin
3
- Version: 1.3.0
3
+ Version: 1.3.2
4
4
  Classifier: Topic :: Software Development :: Build Tools
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Programming Language :: Python :: Implementation :: CPython
@@ -32,16 +32,10 @@ def get_config() -> Dict[str, str]:
32
32
  return pyproject_toml.get("tool", {}).get("maturin", {})
33
33
 
34
34
 
35
- def get_maturin_pep517_args(
36
- config_settings: Optional[Mapping[str, Any]] = None
37
- ) -> List[str]:
35
+ def get_maturin_pep517_args(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
38
36
  build_args = config_settings.get("build-args") if config_settings else None
39
37
  if build_args is None:
40
38
  env_args = os.getenv("MATURIN_PEP517_ARGS", "")
41
- if env_args:
42
- print(
43
- f"'MATURIN_PEP517_ARGS' is deprecated, use `--config-settings build-args='{env_args}'` instead."
44
- )
45
39
  args = shlex.split(env_args)
46
40
  elif isinstance(build_args, str):
47
41
  args = shlex.split(build_args)
@@ -91,9 +85,7 @@ def _build_wheel(
91
85
  sys.stdout.buffer.write(result.stdout)
92
86
  sys.stdout.flush()
93
87
  if result.returncode != 0:
94
- sys.stderr.write(
95
- f"Error: command {command} returned non-zero exit status {result.returncode}\n"
96
- )
88
+ sys.stderr.write(f"Error: command {command} returned non-zero exit status {result.returncode}\n")
97
89
  sys.exit(1)
98
90
  output = result.stdout.decode(errors="replace")
99
91
  wheel_path = output.strip().splitlines()[-1]
@@ -112,9 +104,7 @@ def build_wheel(
112
104
 
113
105
 
114
106
  # noinspection PyUnusedLocal
115
- def build_sdist(
116
- sdist_directory: str, config_settings: Optional[Mapping[str, Any]] = None
117
- ) -> str:
107
+ def build_sdist(sdist_directory: str, config_settings: Optional[Mapping[str, Any]] = None) -> str:
118
108
  command = ["maturin", "pep517", "write-sdist", "--sdist-directory", sdist_directory]
119
109
 
120
110
  print("Running `{}`".format(" ".join(command)))
@@ -123,18 +113,14 @@ def build_sdist(
123
113
  sys.stdout.buffer.write(result.stdout)
124
114
  sys.stdout.flush()
125
115
  if result.returncode != 0:
126
- sys.stderr.write(
127
- f"Error: command {command} returned non-zero exit status {result.returncode}\n"
128
- )
116
+ sys.stderr.write(f"Error: command {command} returned non-zero exit status {result.returncode}\n")
129
117
  sys.exit(1)
130
118
  output = result.stdout.decode(errors="replace")
131
119
  return output.strip().splitlines()[-1]
132
120
 
133
121
 
134
122
  # noinspection PyUnusedLocal
135
- def get_requires_for_build_wheel(
136
- config_settings: Optional[Mapping[str, Any]] = None
137
- ) -> List[str]:
123
+ def get_requires_for_build_wheel(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
138
124
  if get_config().get("bindings") == "cffi":
139
125
  return ["cffi"]
140
126
  else:
@@ -147,9 +133,7 @@ def build_editable(
147
133
  config_settings: Optional[Mapping[str, Any]] = None,
148
134
  metadata_directory: Optional[str] = None,
149
135
  ) -> str:
150
- return _build_wheel(
151
- wheel_directory, config_settings, metadata_directory, editable=True
152
- )
136
+ return _build_wheel(wheel_directory, config_settings, metadata_directory, editable=True)
153
137
 
154
138
 
155
139
  # Requirements to build an editable are the same as for a wheel
@@ -157,9 +141,7 @@ get_requires_for_build_editable = get_requires_for_build_wheel
157
141
 
158
142
 
159
143
  # noinspection PyUnusedLocal
160
- def get_requires_for_build_sdist(
161
- config_settings: Optional[Mapping[str, Any]] = None
162
- ) -> List[str]:
144
+ def get_requires_for_build_sdist(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
163
145
  return []
164
146
 
165
147
 
@@ -170,9 +152,7 @@ def prepare_metadata_for_build_wheel(
170
152
  print("Checking for Rust toolchain....")
171
153
  is_cargo_installed = False
172
154
  try:
173
- output = subprocess.check_output(["cargo", "--version"]).decode(
174
- "utf-8", "ignore"
175
- )
155
+ output = subprocess.check_output(["cargo", "--version"]).decode("utf-8", "ignore")
176
156
  if "cargo" in output:
177
157
  is_cargo_installed = True
178
158
  except (FileNotFoundError, SubprocessError):
@@ -71,9 +71,7 @@ class Importer(abc.MetaPathFinder):
71
71
 
72
72
  return None
73
73
 
74
- def _build_and_load(
75
- self, fullname: str, cargo_toml: pathlib.Path
76
- ) -> ModuleSpec | None:
74
+ def _build_and_load(self, fullname: str, cargo_toml: pathlib.Path) -> ModuleSpec | None:
77
75
  build_module(cargo_toml, bindings=self.bindings)
78
76
  loader = Loader(fullname)
79
77
  return importlib.util.spec_from_loader(fullname, loader)
@@ -98,10 +96,7 @@ def _is_cargo_project(cargo_toml: pathlib.Path, module_name: str) -> bool:
98
96
  with open(cargo_toml, "rb") as f:
99
97
  cargo = tomllib.load(f)
100
98
  package_name = cargo.get("package", {}).get("name")
101
- if (
102
- package_name == module_name
103
- or package_name.replace("-", "_") == module_name
104
- ):
99
+ if package_name == module_name or package_name.replace("-", "_") == module_name:
105
100
  return True
106
101
  return False
107
102
 
@@ -115,9 +110,7 @@ def generate_project(rust_file: pathlib.Path, bindings: str = "pyo3") -> pathlib
115
110
  command: list[str] = ["maturin", "new", "-b", bindings, str(project_dir)]
116
111
  result = subprocess.run(command, stdout=subprocess.PIPE)
117
112
  if result.returncode != 0:
118
- sys.stderr.write(
119
- f"Error: command {command} returned non-zero exit status {result.returncode}\n"
120
- )
113
+ sys.stderr.write(f"Error: command {command} returned non-zero exit status {result.returncode}\n")
121
114
  raise ImportError("Failed to generate cargo project")
122
115
 
123
116
  with open(rust_file) as f:
@@ -128,9 +121,7 @@ def generate_project(rust_file: pathlib.Path, bindings: str = "pyo3") -> pathlib
128
121
  return project_dir
129
122
 
130
123
 
131
- def build_module(
132
- manifest_path: pathlib.Path, bindings: str | None = None, release: bool = False
133
- ) -> None:
124
+ def build_module(manifest_path: pathlib.Path, bindings: str | None = None, release: bool = False) -> None:
134
125
  command = ["maturin", "develop", "-m", str(manifest_path)]
135
126
  if bindings:
136
127
  command.append("-b")
@@ -141,9 +132,7 @@ def build_module(
141
132
  sys.stdout.buffer.write(result.stdout)
142
133
  sys.stdout.flush()
143
134
  if result.returncode != 0:
144
- sys.stderr.write(
145
- f"Error: command {command} returned non-zero exit status {result.returncode}\n"
146
- )
135
+ sys.stderr.write(f"Error: command {command} returned non-zero exit status {result.returncode}\n")
147
136
  raise ImportError("Failed to build module with maturin")
148
137
 
149
138
 
@@ -64,9 +64,7 @@ setup(
64
64
  python_requires=">=3.7",
65
65
  cmdclass={"bdist_wheel": bdist_wheel},
66
66
  packages=["maturin"],
67
- rust_extensions=[
68
- RustBin("maturin", args=cargo_args, cargo_manifest_args=["--locked"])
69
- ],
67
+ rust_extensions=[RustBin("maturin", args=cargo_args, cargo_manifest_args=["--locked"])],
70
68
  classifiers=[
71
69
  "Topic :: Software Development :: Build Tools",
72
70
  "Programming Language :: Rust",
@@ -50,7 +50,7 @@ pub enum AuditWheelError {
50
50
  /// libraries with blacked-list symbols.
51
51
  #[error("Your library is not {0} compliant because it depends on black-listed symbols: {1:?}")]
52
52
  BlackListedSymbolsError(Policy, Vec<String>),
53
- /// The elf file isn't manylinux/musllinux compaible. Contains unsupported architecture
53
+ /// The elf file isn't manylinux/musllinux compatible. Contains unsupported architecture
54
54
  #[error("Your library is not {0} compliant because it has unsupported architecture: {1}")]
55
55
  UnsupportedArchitecture(Policy, String),
56
56
  /// This platform tag isn't defined by auditwheel yet
@@ -419,8 +419,8 @@ fn compile_target(
419
419
  build_command.env("PYO3_CROSS_LIB_DIR", lib_dir);
420
420
  }
421
421
 
422
- // Set default macOS deployment target version
423
- if target.is_macos() && env::var_os("MACOSX_DEPLOYMENT_TARGET").is_none() {
422
+ // Set default macOS deployment target version for non-editable builds
423
+ if !context.editable && target.is_macos() && env::var_os("MACOSX_DEPLOYMENT_TARGET").is_none() {
424
424
  use crate::build_context::rustc_macosx_target_version;
425
425
 
426
426
  let target_config = context
@@ -226,7 +226,7 @@ impl Metadata21 {
226
226
  for author in authors {
227
227
  match (&author.name, &author.email) {
228
228
  (Some(name), Some(email)) => {
229
- emails.push(format!("{name} <{email}>"));
229
+ emails.push(escape_email_with_display_name(name, email));
230
230
  }
231
231
  (Some(name), None) => {
232
232
  names.push(name.as_str());
@@ -251,7 +251,7 @@ impl Metadata21 {
251
251
  for maintainer in maintainers {
252
252
  match (&maintainer.name, &maintainer.email) {
253
253
  (Some(name), Some(email)) => {
254
- emails.push(format!("{name} <{email}>"));
254
+ emails.push(escape_email_with_display_name(name, email));
255
255
  }
256
256
  (Some(name), None) => {
257
257
  names.push(name.as_str());
@@ -555,6 +555,23 @@ impl Metadata21 {
555
555
  }
556
556
  }
557
557
 
558
+ /// Escape email addresses with display name if necessary
559
+ /// according to RFC 822 Section 3.3. "specials".
560
+ fn escape_email_with_display_name(display_name: &str, email: &str) -> String {
561
+ if display_name.chars().any(|c| {
562
+ matches!(
563
+ c,
564
+ '(' | ')' | '<' | '>' | '@' | ',' | ';' | ':' | '\\' | '"' | '.' | '[' | ']'
565
+ )
566
+ }) {
567
+ return format!(
568
+ "\"{}\" <{email}>",
569
+ display_name.replace('\\', "\\\\").replace('\"', "\\\"")
570
+ );
571
+ }
572
+ format!("{display_name} <{email}>")
573
+ }
574
+
558
575
  /// Fold long header field according to RFC 5322 section 2.2.3
559
576
  /// https://datatracker.ietf.org/doc/html/rfc5322#section-2.2.3
560
577
  fn fold_header(text: &str) -> String {
@@ -811,4 +828,43 @@ mod test {
811
828
  assert_eq!(metadata.license_files[2], manifest_dir.join("NOTICE.md"));
812
829
  assert_eq!(metadata.license_files[3], manifest_dir.join("AUTHORS.txt"));
813
830
  }
831
+
832
+ #[test]
833
+ fn test_escape_email_with_display_name_without_special_characters() {
834
+ let display_name = "Foo Bar !#$%&'*+-/=?^_`{|}~ 123";
835
+ let email = "foobar-123@example.com";
836
+ let result = escape_email_with_display_name(display_name, email);
837
+ assert_eq!(
838
+ result,
839
+ "Foo Bar !#$%&'*+-/=?^_`{|}~ 123 <foobar-123@example.com>"
840
+ );
841
+ }
842
+
843
+ #[test]
844
+ fn test_escape_email_with_display_name_with_special_characters() {
845
+ let tests = [
846
+ ("Foo ( Bar", "\"Foo ( Bar\""),
847
+ ("Foo ) Bar", "\"Foo ) Bar\""),
848
+ ("Foo < Bar", "\"Foo < Bar\""),
849
+ ("Foo > Bar", "\"Foo > Bar\""),
850
+ ("Foo @ Bar", "\"Foo @ Bar\""),
851
+ ("Foo , Bar", "\"Foo , Bar\""),
852
+ ("Foo ; Bar", "\"Foo ; Bar\""),
853
+ ("Foo : Bar", "\"Foo : Bar\""),
854
+ ("Foo \\ Bar", "\"Foo \\\\ Bar\""),
855
+ ("Foo \" Bar", "\"Foo \\\" Bar\""),
856
+ ("Foo . Bar", "\"Foo . Bar\""),
857
+ ("Foo [ Bar", "\"Foo [ Bar\""),
858
+ ("Foo ] Bar", "\"Foo ] Bar\""),
859
+ ("Foo ) Bar", "\"Foo ) Bar\""),
860
+ ("Foo ) Bar", "\"Foo ) Bar\""),
861
+ ("Foo, Bar", "\"Foo, Bar\""),
862
+ ];
863
+ for (display_name, expected_name) in tests {
864
+ let email = "foobar-123@example.com";
865
+ let result = escape_email_with_display_name(display_name, email);
866
+ let expected = format!("{expected_name} <{email}>");
867
+ assert_eq!(result, expected);
868
+ }
869
+ }
814
870
  }
@@ -872,11 +872,14 @@ fn uniffi_bindgen_command(crate_dir: &Path) -> Result<Command> {
872
872
  .no_deps()
873
873
  .verbose(true)
874
874
  .exec()?;
875
- let root_pkg = cargo_metadata.root_package().unwrap();
875
+ let root_pkg = cargo_metadata.root_package();
876
876
  let has_uniffi_bindgen_target = root_pkg
877
- .targets
878
- .iter()
879
- .any(|target| target.name == "uniffi-bindgen" && target.is_bin());
877
+ .map(|pkg| {
878
+ pkg.targets
879
+ .iter()
880
+ .any(|target| target.name == "uniffi-bindgen" && target.is_bin())
881
+ })
882
+ .unwrap_or(false);
880
883
  let command = if has_uniffi_bindgen_target {
881
884
  let mut command = Command::new("cargo");
882
885
  command.args(["run", "--bin", "uniffi-bindgen", "--manifest-path"]);
@@ -918,13 +921,6 @@ fn generate_uniffi_bindings(
918
921
  false
919
922
  };
920
923
 
921
- // Disallow library mode without UDL files for now
922
- // Should be removed in https://github.com/PyO3/maturin/pull/1729
923
- // once uniffi release a new version
924
- if is_library {
925
- bail!("No UDL files found in {}", crate_dir.join("src").display());
926
- }
927
-
928
924
  let mut cmd = uniffi_bindgen_command(crate_dir)?;
929
925
  cmd.current_dir(crate_dir);
930
926
  cmd.args([
@@ -33,6 +33,7 @@ impl<'a> ProjectGenerator<'a> {
33
33
  ) -> Result<Self> {
34
34
  let crate_name = project_name.replace('-', "_");
35
35
  let mut env = Environment::new();
36
+ env.set_keep_trailing_newline(true);
36
37
  env.add_template(".gitignore", include_str!("templates/.gitignore.j2"))?;
37
38
  env.add_template("Cargo.toml", include_str!("templates/Cargo.toml.j2"))?;
38
39
  env.add_template(
@@ -43,6 +44,7 @@ impl<'a> ProjectGenerator<'a> {
43
44
  env.add_template("main.rs", include_str!("templates/main.rs.j2"))?;
44
45
  env.add_template("build.rs", include_str!("templates/build.rs.j2"))?;
45
46
  env.add_template("__init__.py", include_str!("templates/__init__.py.j2"))?;
47
+ env.add_template("test_all.py", include_str!("templates/test_all.py.j2"))?;
46
48
  env.add_template("example.udl", include_str!("templates/example.udl.j2"))?;
47
49
 
48
50
  let bridge_model = match bindings.as_str() {
@@ -86,6 +88,10 @@ impl<'a> ProjectGenerator<'a> {
86
88
  fs::create_dir_all(&python_project)?;
87
89
  self.write_project_file(&python_project, "__init__.py")?;
88
90
 
91
+ let test_dir = python_dir.join("tests");
92
+ fs::create_dir_all(&test_dir)?;
93
+ self.write_project_file(&test_dir, "test_all.py")?;
94
+
89
95
  if src {
90
96
  project_path.join("rust")
91
97
  } else {
@@ -21,7 +21,7 @@ mod config;
21
21
  const GET_INTERPRETER_METADATA: &str = include_str!("get_interpreter_metadata.py");
22
22
  pub const MINIMUM_PYTHON_MINOR: usize = 7;
23
23
  /// Be liberal here to include preview versions
24
- pub const MAXIMUM_PYTHON_MINOR: usize = 12;
24
+ pub const MAXIMUM_PYTHON_MINOR: usize = 13;
25
25
  pub const MAXIMUM_PYPY_MINOR: usize = 10;
26
26
 
27
27
  /// Identifies conditions where we do not want to build wheels
@@ -526,9 +526,9 @@ impl PythonInterpreter {
526
526
  }
527
527
  InterpreterKind::GraalPy => {
528
528
  // GraalPy like PyPy uses its version as part of the ABI
529
- // graalpy 3.10 23.1 => numpy-1.23.5-graalpy310-graalpy231_310_native_manylinux2014_x86_64.whl
529
+ // graalpy 3.10 23.1 => numpy-1.23.5-graalpy310-graalpy231_310_native-manylinux2014_x86_64.whl
530
530
  format!(
531
- "graalpy{major}{minor}-{abi_tag}_{platform}",
531
+ "graalpy{major}{minor}-{abi_tag}-{platform}",
532
532
  major = self.major,
533
533
  minor = self.minor,
534
534
  abi_tag = calculate_abi_tag(&self.ext_suffix)
@@ -989,19 +989,19 @@ mod tests {
989
989
  let target =
990
990
  Target::from_target_triple(Some("x86_64-unknown-linux-gnu".to_string())).unwrap();
991
991
  let pythons = PythonInterpreter::find_by_target(&target, None);
992
- assert_eq!(pythons.len(), 10);
992
+ assert_eq!(pythons.len(), 11);
993
993
 
994
994
  let pythons = PythonInterpreter::find_by_target(
995
995
  &target,
996
996
  Some(&VersionSpecifiers::from_str(">=3.7").unwrap()),
997
997
  );
998
- assert_eq!(pythons.len(), 10);
998
+ assert_eq!(pythons.len(), 11);
999
999
 
1000
1000
  let pythons = PythonInterpreter::find_by_target(
1001
1001
  &target,
1002
1002
  Some(&VersionSpecifiers::from_str(">=3.10").unwrap()),
1003
1003
  );
1004
- assert_eq!(pythons.len(), 4);
1004
+ assert_eq!(pythons.len(), 5);
1005
1005
  }
1006
1006
 
1007
1007
  #[test]
@@ -6,6 +6,7 @@ use cargo_metadata::{Metadata, MetadataCommand};
6
6
  use fs_err as fs;
7
7
  use ignore::overrides::Override;
8
8
  use normpath::PathExt as _;
9
+ use path_slash::PathExt as _;
9
10
  use std::collections::HashMap;
10
11
  use std::path::{Path, PathBuf};
11
12
  use std::process::Command;
@@ -48,6 +49,7 @@ fn rewrite_cargo_toml(
48
49
  known_path_deps: &HashMap<String, PathDependency>,
49
50
  ) -> Result<String> {
50
51
  let manifest_path = manifest_path.as_ref();
52
+ debug!("Rewriting Cargo.toml at {}", manifest_path.display());
51
53
  let mut document = parse_toml_file(manifest_path, "Cargo.toml")?;
52
54
 
53
55
  // Update workspace members
@@ -64,25 +66,29 @@ fn rewrite_cargo_toml(
64
66
  let mut new_members = toml_edit::Array::new();
65
67
  for member in members {
66
68
  if let toml_edit::Value::String(ref s) = member {
67
- let path = Path::new(s.value());
68
- if let Some(name) = path.file_name().and_then(|x| x.to_str()) {
69
- // See https://github.com/rust-lang/cargo/blob/0de91c89e6479016d0ed8719fdc2947044335b36/src/cargo/util/restricted_names.rs#L119-L122
70
- let is_glob_pattern = name.contains(['*', '?', '[', ']']);
71
- if is_glob_pattern {
72
- let pattern = glob::Pattern::new(name).context(format!(
69
+ let member_path = s.value();
70
+ // See https://github.com/rust-lang/cargo/blob/0de91c89e6479016d0ed8719fdc2947044335b36/src/cargo/util/restricted_names.rs#L119-L122
71
+ let is_glob_pattern = member_path.contains(['*', '?', '[', ']']);
72
+ if is_glob_pattern {
73
+ let pattern = glob::Pattern::new(member_path).with_context(|| {
74
+ format!(
73
75
  "Invalid `workspace.members` glob pattern: {} in {}",
74
- name,
76
+ member_path,
75
77
  manifest_path.display()
76
- ))?;
77
- if known_path_deps
78
- .keys()
79
- .any(|path_dep| pattern.matches(path_dep))
80
- {
81
- new_members.push(s.value());
82
- }
83
- } else if known_path_deps.contains_key(name) {
84
- new_members.push(s.value());
78
+ )
79
+ })?;
80
+ if known_path_deps.values().any(|path_dep| {
81
+ let relative_path = path_dep
82
+ .manifest_path
83
+ .strip_prefix(&path_dep.workspace_root)
84
+ .unwrap();
85
+ let relative_path_str = relative_path.to_str().unwrap();
86
+ pattern.matches(relative_path_str)
87
+ }) {
88
+ new_members.push(member_path);
85
89
  }
90
+ } else if known_path_deps.contains_key(member_path) {
91
+ new_members.push(member_path);
86
92
  }
87
93
  }
88
94
  }
@@ -144,6 +150,7 @@ fn add_crate_to_source_distribution(
144
150
  prefix: impl AsRef<Path>,
145
151
  known_path_deps: &HashMap<String, PathDependency>,
146
152
  root_crate: bool,
153
+ skip_cargo_toml: bool,
147
154
  ) -> Result<()> {
148
155
  let manifest_path = manifest_path.as_ref();
149
156
  let output = Command::new("cargo")
@@ -212,7 +219,7 @@ fn add_crate_to_source_distribution(
212
219
  if root_crate {
213
220
  let rewritten_cargo_toml = rewrite_cargo_toml(manifest_path, known_path_deps)?;
214
221
  writer.add_bytes(cargo_toml_path, rewritten_cargo_toml.as_bytes())?;
215
- } else {
222
+ } else if !skip_cargo_toml {
216
223
  writer.add_file(cargo_toml_path, manifest_path)?;
217
224
  }
218
225
 
@@ -341,6 +348,10 @@ fn add_cargo_package_files_to_sdist(
341
348
  let workspace_manifest_path = workspace_root.join("Cargo.toml");
342
349
 
343
350
  let known_path_deps = find_path_deps(&build_context.cargo_metadata)?;
351
+ debug!(
352
+ "Found path dependencies: {:?}",
353
+ known_path_deps.keys().collect::<Vec<_>>()
354
+ );
344
355
  let mut sdist_root =
345
356
  common_path_prefix(workspace_root.as_std_path(), pyproject_toml_path).unwrap();
346
357
  for path_dep in known_path_deps.values() {
@@ -357,21 +368,31 @@ fn add_cargo_package_files_to_sdist(
357
368
 
358
369
  // Add local path dependencies
359
370
  for (name, path_dep) in known_path_deps.iter() {
371
+ debug!(
372
+ "Adding path dependency: {} at {}",
373
+ name,
374
+ path_dep.manifest_path.display()
375
+ );
360
376
  let path_dep_manifest_dir = path_dep.manifest_path.parent().unwrap();
361
377
  let relative_path_dep_manifest_dir =
362
378
  path_dep_manifest_dir.strip_prefix(&sdist_root).unwrap();
379
+ // we may need to rewrite workspace Cargo.toml later so don't add it to sdist yet
380
+ let skip_cargo_toml = workspace_manifest_path == path_dep.manifest_path;
363
381
  add_crate_to_source_distribution(
364
382
  writer,
365
383
  &path_dep.manifest_path,
366
384
  &root_dir.join(relative_path_dep_manifest_dir),
367
385
  &known_path_deps,
368
386
  false,
387
+ skip_cargo_toml,
369
388
  )
370
- .context(format!(
371
- "Failed to add local dependency {} at {} to the source distribution",
372
- name,
373
- path_dep.manifest_path.display()
374
- ))?;
389
+ .with_context(|| {
390
+ format!(
391
+ "Failed to add local dependency {} at {} to the source distribution",
392
+ name,
393
+ path_dep.manifest_path.display()
394
+ )
395
+ })?;
375
396
  // Handle possible relative readme field in Cargo.toml
376
397
  if let Some(readme) = path_dep.readme.as_ref() {
377
398
  let abs_readme = path_dep_manifest_dir
@@ -413,6 +434,7 @@ fn add_cargo_package_files_to_sdist(
413
434
  root_dir.join(relative_main_crate_manifest_dir),
414
435
  &known_path_deps,
415
436
  true,
437
+ false,
416
438
  )?;
417
439
  // Handle possible relative readme field in Cargo.toml
418
440
  if let Some(readme) = main_crate.readme.as_ref() {
@@ -453,9 +475,9 @@ fn add_cargo_package_files_to_sdist(
453
475
  let mut deps_to_keep = known_path_deps.clone();
454
476
  // Also need to the main Python binding crate
455
477
  let main_member_name = abs_manifest_dir
456
- .strip_prefix(&sdist_root)
478
+ .strip_prefix(workspace_root)
457
479
  .unwrap()
458
- .to_str()
480
+ .to_slash()
459
481
  .unwrap()
460
482
  .to_string();
461
483
  deps_to_keep.insert(
@@ -16,8 +16,8 @@ pyo3 = "0.19.0"
16
16
  {% elif bindings == "rust-cpython" -%}
17
17
  cpython = "0.7.1"
18
18
  {% elif bindings == "uniffi" -%}
19
- uniffi = "0.24.1"
19
+ uniffi = "0.25.0"
20
20
 
21
21
  [build-dependencies]
22
- uniffi = { version = "0.24.1", features = ["build"] }
22
+ uniffi = { version = "0.25.0", features = ["build"] }
23
23
  {% endif -%}
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "{{ name }}"
7
- requires-python = ">=3.7"
7
+ requires-python = ">=3.8"
8
8
  classifiers = [
9
9
  "Programming Language :: Rust",
10
10
  "Programming Language :: Python :: Implementation :: CPython",
@@ -13,6 +13,12 @@ classifiers = [
13
13
  {% if bindings == "cffi" -%}
14
14
  dependencies = ["cffi"]
15
15
  {% endif -%}
16
+ {% if mixed_non_src -%}
17
+ [project.optional-dependencies]
18
+ tests = [
19
+ "pytest",
20
+ ]
21
+ {% endif -%}
16
22
  dynamic = ["version"]
17
23
 
18
24
  {% if bindings in ["bin", "cffi", "pyo3", "rust-cpython"] or mixed_non_src -%}
@@ -0,0 +1,6 @@
1
+ import pytest
2
+ import {{ crate_name }}
3
+
4
+
5
+ def test_sum_as_string():
6
+ assert {{ crate_name }}.sum_as_string(1, 1) == "2"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes