salvatore 0.2.0__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.
@@ -0,0 +1,147 @@
1
+ # Python wheels for salvatore, built for Linux, macOS and Windows.
2
+ # Every push and pull request: Rust tests, Python tests, wheels.
3
+ # A tag py-vX.Y.Z (X.Y.Z = version in python/Cargo.toml): publication to PyPI by trusted publishing,
4
+ # no token stored in the repository. Adapted from `maturin generate-ci github` (maturin 1.16).
5
+ name: python
6
+
7
+ on:
8
+ push:
9
+ branches: [master]
10
+ tags: ["py-v*"]
11
+ pull_request:
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ test:
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ python-version: ["3.10", "3.13"]
24
+ steps:
25
+ - uses: actions/checkout@v6
26
+ - uses: actions/setup-python@v6
27
+ with:
28
+ python-version: ${{ matrix.python-version }}
29
+ - name: Rust tests
30
+ run: cargo test --release
31
+ - name: Python tests
32
+ run: |
33
+ python -m pip install --upgrade pip
34
+ python -m pip install . pytest numpy opt_einsum
35
+ python -m pytest -q
36
+
37
+ linux:
38
+ runs-on: ${{ matrix.platform.runner }}
39
+ strategy:
40
+ matrix:
41
+ platform:
42
+ - { runner: ubuntu-22.04, target: x86_64, manylinux: auto }
43
+ - { runner: ubuntu-22.04, target: aarch64, manylinux: auto }
44
+ - { runner: ubuntu-22.04, target: x86_64, manylinux: musllinux_1_2 }
45
+ steps:
46
+ - uses: actions/checkout@v6
47
+ - uses: actions/setup-python@v6
48
+ with:
49
+ python-version: "3.10"
50
+ - name: Build wheels
51
+ uses: PyO3/maturin-action@v1
52
+ with:
53
+ target: ${{ matrix.platform.target }}
54
+ args: --release --out dist
55
+ manylinux: ${{ matrix.platform.manylinux }}
56
+ - uses: actions/upload-artifact@v6
57
+ with:
58
+ name: wheels-linux-${{ matrix.platform.target }}-${{ matrix.platform.manylinux }}
59
+ path: dist
60
+
61
+ windows:
62
+ runs-on: windows-latest
63
+ steps:
64
+ - uses: actions/checkout@v6
65
+ - uses: actions/setup-python@v6
66
+ with:
67
+ python-version: "3.13"
68
+ architecture: x64
69
+ - name: Build wheels
70
+ uses: PyO3/maturin-action@v1
71
+ with:
72
+ target: x64
73
+ args: --release --out dist
74
+ - name: Smoke test
75
+ shell: bash
76
+ run: |
77
+ python -m pip install salvatore --no-index --find-links dist --force-reinstall
78
+ python -c "import salvatore; print(salvatore.optimize([('a','b'),('b','c')], ('a','c'), {'a':2,'b':3,'c':4}, time_budget=0.1))"
79
+ - uses: actions/upload-artifact@v6
80
+ with:
81
+ name: wheels-windows-x64
82
+ path: dist
83
+
84
+ macos:
85
+ runs-on: ${{ matrix.platform.runner }}
86
+ strategy:
87
+ matrix:
88
+ platform:
89
+ - { runner: macos-15-intel, target: x86_64 }
90
+ - { runner: macos-latest, target: aarch64 }
91
+ steps:
92
+ - uses: actions/checkout@v6
93
+ - uses: actions/setup-python@v6
94
+ with:
95
+ python-version: "3.13"
96
+ - name: Build wheels
97
+ uses: PyO3/maturin-action@v1
98
+ with:
99
+ target: ${{ matrix.platform.target }}
100
+ args: --release --out dist
101
+ - name: Smoke test
102
+ run: |
103
+ python -m pip install salvatore --no-index --find-links dist --force-reinstall
104
+ python -c "import salvatore; print(salvatore.optimize([('a','b'),('b','c')], ('a','c'), {'a':2,'b':3,'c':4}, time_budget=0.1))"
105
+ - uses: actions/upload-artifact@v6
106
+ with:
107
+ name: wheels-macos-${{ matrix.platform.target }}
108
+ path: dist
109
+
110
+ sdist:
111
+ runs-on: ubuntu-latest
112
+ steps:
113
+ - uses: actions/checkout@v6
114
+ - name: Build sdist
115
+ uses: PyO3/maturin-action@v1
116
+ with:
117
+ command: sdist
118
+ args: --out dist
119
+ - uses: actions/upload-artifact@v6
120
+ with:
121
+ name: wheels-sdist
122
+ path: dist
123
+
124
+ release:
125
+ name: Publish to PyPI
126
+ runs-on: ubuntu-latest
127
+ if: ${{ startsWith(github.ref, 'refs/tags/py-v') }}
128
+ needs: [test, linux, windows, macos, sdist]
129
+ environment: pypi
130
+ permissions:
131
+ id-token: write # trusted publishing to PyPI
132
+ attestations: write # provenance of the files
133
+ steps:
134
+ - uses: actions/checkout@v6
135
+ - name: Tag matches the package version
136
+ run: |
137
+ v=$(grep -m1 '^version' python/Cargo.toml | cut -d'"' -f2)
138
+ test "py-v$v" = "${GITHUB_REF_NAME}" || { echo "tag ${GITHUB_REF_NAME} != py-v$v"; exit 1; }
139
+ - uses: actions/download-artifact@v7
140
+ with:
141
+ path: artifacts
142
+ - uses: actions/attest@v4
143
+ with:
144
+ subject-path: "artifacts/wheels-*/*"
145
+ - uses: astral-sh/setup-uv@v7
146
+ - name: Publish
147
+ run: uv publish --trusted-publishing always 'artifacts/wheels-*/*'
@@ -0,0 +1,17 @@
1
+ /target/
2
+ /pyref/lib/
3
+ __pycache__/
4
+ .cargo/
5
+ *.tmp
6
+ *.log.tmp
7
+ /perf.data*
8
+ /flamegraph.svg
9
+ # Python
10
+ /.venv/
11
+ *.so
12
+ *.pyd
13
+ *.egg-info/
14
+ /dist/
15
+ /build/
16
+ .pytest_cache/
17
+ *.pyc
@@ -0,0 +1,349 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "cfg-if"
7
+ version = "1.0.5"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
10
+
11
+ [[package]]
12
+ name = "crossbeam-deque"
13
+ version = "0.8.8"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a"
16
+ dependencies = [
17
+ "crossbeam-epoch",
18
+ "crossbeam-utils",
19
+ ]
20
+
21
+ [[package]]
22
+ name = "crossbeam-epoch"
23
+ version = "0.9.21"
24
+ source = "registry+https://github.com/rust-lang/crates.io-index"
25
+ checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d"
26
+ dependencies = [
27
+ "crossbeam-utils",
28
+ ]
29
+
30
+ [[package]]
31
+ name = "crossbeam-utils"
32
+ version = "0.8.23"
33
+ source = "registry+https://github.com/rust-lang/crates.io-index"
34
+ checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
35
+
36
+ [[package]]
37
+ name = "either"
38
+ version = "1.19.0"
39
+ source = "registry+https://github.com/rust-lang/crates.io-index"
40
+ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
41
+
42
+ [[package]]
43
+ name = "getrandom"
44
+ version = "0.2.17"
45
+ source = "registry+https://github.com/rust-lang/crates.io-index"
46
+ checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
47
+ dependencies = [
48
+ "cfg-if",
49
+ "libc",
50
+ "wasi",
51
+ ]
52
+
53
+ [[package]]
54
+ name = "heck"
55
+ version = "0.5.0"
56
+ source = "registry+https://github.com/rust-lang/crates.io-index"
57
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
58
+
59
+ [[package]]
60
+ name = "itoa"
61
+ version = "1.0.19"
62
+ source = "registry+https://github.com/rust-lang/crates.io-index"
63
+ checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
64
+
65
+ [[package]]
66
+ name = "libc"
67
+ version = "0.2.191"
68
+ source = "registry+https://github.com/rust-lang/crates.io-index"
69
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
70
+
71
+ [[package]]
72
+ name = "memchr"
73
+ version = "2.8.3"
74
+ source = "registry+https://github.com/rust-lang/crates.io-index"
75
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
76
+
77
+ [[package]]
78
+ name = "once_cell"
79
+ version = "1.21.4"
80
+ source = "registry+https://github.com/rust-lang/crates.io-index"
81
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
82
+
83
+ [[package]]
84
+ name = "portable-atomic"
85
+ version = "1.15.0"
86
+ source = "registry+https://github.com/rust-lang/crates.io-index"
87
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
88
+
89
+ [[package]]
90
+ name = "ppv-lite86"
91
+ version = "0.2.21"
92
+ source = "registry+https://github.com/rust-lang/crates.io-index"
93
+ checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
94
+ dependencies = [
95
+ "zerocopy",
96
+ ]
97
+
98
+ [[package]]
99
+ name = "proc-macro2"
100
+ version = "1.0.107"
101
+ source = "registry+https://github.com/rust-lang/crates.io-index"
102
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
103
+ dependencies = [
104
+ "unicode-ident",
105
+ ]
106
+
107
+ [[package]]
108
+ name = "pyo3"
109
+ version = "0.30.1"
110
+ source = "registry+https://github.com/rust-lang/crates.io-index"
111
+ checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
112
+ dependencies = [
113
+ "libc",
114
+ "once_cell",
115
+ "portable-atomic",
116
+ "pyo3-build-config",
117
+ "pyo3-ffi",
118
+ "pyo3-macros",
119
+ ]
120
+
121
+ [[package]]
122
+ name = "pyo3-build-config"
123
+ version = "0.30.1"
124
+ source = "registry+https://github.com/rust-lang/crates.io-index"
125
+ checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
126
+ dependencies = [
127
+ "target-lexicon",
128
+ ]
129
+
130
+ [[package]]
131
+ name = "pyo3-ffi"
132
+ version = "0.30.1"
133
+ source = "registry+https://github.com/rust-lang/crates.io-index"
134
+ checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
135
+ dependencies = [
136
+ "libc",
137
+ "pyo3-build-config",
138
+ ]
139
+
140
+ [[package]]
141
+ name = "pyo3-macros"
142
+ version = "0.30.1"
143
+ source = "registry+https://github.com/rust-lang/crates.io-index"
144
+ checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
145
+ dependencies = [
146
+ "proc-macro2",
147
+ "pyo3-macros-backend",
148
+ "quote",
149
+ "syn 3.0.10",
150
+ ]
151
+
152
+ [[package]]
153
+ name = "pyo3-macros-backend"
154
+ version = "0.30.1"
155
+ source = "registry+https://github.com/rust-lang/crates.io-index"
156
+ checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
157
+ dependencies = [
158
+ "heck",
159
+ "proc-macro2",
160
+ "quote",
161
+ "syn 3.0.10",
162
+ ]
163
+
164
+ [[package]]
165
+ name = "quote"
166
+ version = "1.0.47"
167
+ source = "registry+https://github.com/rust-lang/crates.io-index"
168
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
169
+ dependencies = [
170
+ "proc-macro2",
171
+ ]
172
+
173
+ [[package]]
174
+ name = "rand"
175
+ version = "0.8.8"
176
+ source = "registry+https://github.com/rust-lang/crates.io-index"
177
+ checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c"
178
+ dependencies = [
179
+ "libc",
180
+ "rand_chacha",
181
+ "rand_core",
182
+ ]
183
+
184
+ [[package]]
185
+ name = "rand_chacha"
186
+ version = "0.3.1"
187
+ source = "registry+https://github.com/rust-lang/crates.io-index"
188
+ checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
189
+ dependencies = [
190
+ "ppv-lite86",
191
+ "rand_core",
192
+ ]
193
+
194
+ [[package]]
195
+ name = "rand_core"
196
+ version = "0.6.4"
197
+ source = "registry+https://github.com/rust-lang/crates.io-index"
198
+ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
199
+ dependencies = [
200
+ "getrandom",
201
+ ]
202
+
203
+ [[package]]
204
+ name = "rayon"
205
+ version = "1.12.0"
206
+ source = "registry+https://github.com/rust-lang/crates.io-index"
207
+ checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
208
+ dependencies = [
209
+ "either",
210
+ "rayon-core",
211
+ ]
212
+
213
+ [[package]]
214
+ name = "rayon-core"
215
+ version = "1.13.0"
216
+ source = "registry+https://github.com/rust-lang/crates.io-index"
217
+ checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
218
+ dependencies = [
219
+ "crossbeam-deque",
220
+ "crossbeam-utils",
221
+ ]
222
+
223
+ [[package]]
224
+ name = "salvatore"
225
+ version = "0.2.0"
226
+ dependencies = [
227
+ "rand",
228
+ "rand_chacha",
229
+ "rayon",
230
+ "serde",
231
+ "serde_json",
232
+ ]
233
+
234
+ [[package]]
235
+ name = "salvatore-python"
236
+ version = "0.2.0"
237
+ dependencies = [
238
+ "pyo3",
239
+ "salvatore",
240
+ ]
241
+
242
+ [[package]]
243
+ name = "serde"
244
+ version = "1.0.229"
245
+ source = "registry+https://github.com/rust-lang/crates.io-index"
246
+ checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
247
+ dependencies = [
248
+ "serde_core",
249
+ "serde_derive",
250
+ ]
251
+
252
+ [[package]]
253
+ name = "serde_core"
254
+ version = "1.0.229"
255
+ source = "registry+https://github.com/rust-lang/crates.io-index"
256
+ checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
257
+ dependencies = [
258
+ "serde_derive",
259
+ ]
260
+
261
+ [[package]]
262
+ name = "serde_derive"
263
+ version = "1.0.229"
264
+ source = "registry+https://github.com/rust-lang/crates.io-index"
265
+ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
266
+ dependencies = [
267
+ "proc-macro2",
268
+ "quote",
269
+ "syn 3.0.10",
270
+ ]
271
+
272
+ [[package]]
273
+ name = "serde_json"
274
+ version = "1.0.154"
275
+ source = "registry+https://github.com/rust-lang/crates.io-index"
276
+ checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
277
+ dependencies = [
278
+ "itoa",
279
+ "memchr",
280
+ "serde",
281
+ "serde_core",
282
+ "zmij",
283
+ ]
284
+
285
+ [[package]]
286
+ name = "syn"
287
+ version = "2.0.119"
288
+ source = "registry+https://github.com/rust-lang/crates.io-index"
289
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
290
+ dependencies = [
291
+ "proc-macro2",
292
+ "quote",
293
+ "unicode-ident",
294
+ ]
295
+
296
+ [[package]]
297
+ name = "syn"
298
+ version = "3.0.10"
299
+ source = "registry+https://github.com/rust-lang/crates.io-index"
300
+ checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
301
+ dependencies = [
302
+ "proc-macro2",
303
+ "quote",
304
+ "unicode-ident",
305
+ ]
306
+
307
+ [[package]]
308
+ name = "target-lexicon"
309
+ version = "0.13.6"
310
+ source = "registry+https://github.com/rust-lang/crates.io-index"
311
+ checksum = "8c447be3a2abfa84b2d91680c56600bd6b2873866de27b36ec911be705e291da"
312
+
313
+ [[package]]
314
+ name = "unicode-ident"
315
+ version = "1.0.27"
316
+ source = "registry+https://github.com/rust-lang/crates.io-index"
317
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
318
+
319
+ [[package]]
320
+ name = "wasi"
321
+ version = "0.11.1+wasi-snapshot-preview1"
322
+ source = "registry+https://github.com/rust-lang/crates.io-index"
323
+ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
324
+
325
+ [[package]]
326
+ name = "zerocopy"
327
+ version = "0.8.66"
328
+ source = "registry+https://github.com/rust-lang/crates.io-index"
329
+ checksum = "cba8a86aee14fc8cc6c208af60854b3d4ab7185a9a369a12c648faa2716ff42a"
330
+ dependencies = [
331
+ "zerocopy-derive",
332
+ ]
333
+
334
+ [[package]]
335
+ name = "zerocopy-derive"
336
+ version = "0.8.66"
337
+ source = "registry+https://github.com/rust-lang/crates.io-index"
338
+ checksum = "f89bca3b96ceb3cfcb4572790402f977442270d252b9a8504ebc258760c55f94"
339
+ dependencies = [
340
+ "proc-macro2",
341
+ "quote",
342
+ "syn 2.0.119",
343
+ ]
344
+
345
+ [[package]]
346
+ name = "zmij"
347
+ version = "1.0.23"
348
+ source = "registry+https://github.com/rust-lang/crates.io-index"
349
+ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
@@ -0,0 +1,26 @@
1
+ [package]
2
+ name = "salvatore"
3
+ version = "0.2.0"
4
+ edition = "2024"
5
+ rust-version = "1.85"
6
+ description = "Fast tensor network contraction path optimizer (greedy, hypergraph partitioning, DP reconfiguration, annealing)"
7
+ license = "MIT"
8
+ repository = "https://github.com/8falcone/salvatore"
9
+ readme = "README.md"
10
+ keywords = ["tensor-network", "contraction", "hypergraph", "quantum", "optimization"]
11
+ categories = ["algorithms", "science"]
12
+ exclude = ["bench/", "pyref/", "python/", "pyproject.toml", "RESEARCH_LOG.md", "TODO.md", "DONE.md", "PHASE2-REGLES.md"]
13
+
14
+ [workspace]
15
+ members = ["python"]
16
+
17
+ [dependencies]
18
+ rand = "0.8"
19
+ rand_chacha = "0.3"
20
+ serde = { version = "1", features = ["derive"] }
21
+ serde_json = "1"
22
+ rayon = "1"
23
+
24
+ [profile.release]
25
+ lto = "fat"
26
+ codegen-units = 1
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jules Falcone
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.