cotengrust 0.1.4__tar.gz → 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.
- cotengrust-0.2.0/.github/workflows/CI.yml +254 -0
- {cotengrust-0.1.4 → cotengrust-0.2.0}/Cargo.lock +116 -35
- {cotengrust-0.1.4 → cotengrust-0.2.0}/Cargo.toml +7 -5
- {cotengrust-0.1.4 → cotengrust-0.2.0}/PKG-INFO +64 -18
- {cotengrust-0.1.4 → cotengrust-0.2.0}/README.md +62 -16
- {cotengrust-0.1.4 → cotengrust-0.2.0}/cotengrust.pyi +17 -15
- {cotengrust-0.1.4 → cotengrust-0.2.0}/pyproject.toml +1 -1
- {cotengrust-0.1.4 → cotengrust-0.2.0}/src/lib.rs +705 -197
- cotengrust-0.1.4/.github/workflows/CI.yml +0 -169
- {cotengrust-0.1.4 → cotengrust-0.2.0}/.github/dependabot.yml +0 -0
- {cotengrust-0.1.4 → cotengrust-0.2.0}/.gitignore +0 -0
- {cotengrust-0.1.4 → cotengrust-0.2.0}/LICENSE +0 -0
- {cotengrust-0.1.4 → cotengrust-0.2.0}/tests/test_cotengrust.py +0 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# This file is autogenerated by maturin v1.9.4
|
|
2
|
+
# To update, run
|
|
3
|
+
#
|
|
4
|
+
# maturin generate-ci github --pytest
|
|
5
|
+
#
|
|
6
|
+
name: CI
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
- master
|
|
13
|
+
tags:
|
|
14
|
+
- '*'
|
|
15
|
+
pull_request:
|
|
16
|
+
workflow_dispatch:
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
linux:
|
|
23
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
24
|
+
strategy:
|
|
25
|
+
matrix:
|
|
26
|
+
platform:
|
|
27
|
+
- runner: ubuntu-22.04
|
|
28
|
+
target: x86_64
|
|
29
|
+
- runner: ubuntu-22.04
|
|
30
|
+
target: x86
|
|
31
|
+
- runner: ubuntu-22.04
|
|
32
|
+
target: aarch64
|
|
33
|
+
- runner: ubuntu-22.04
|
|
34
|
+
target: armv7
|
|
35
|
+
- runner: ubuntu-22.04
|
|
36
|
+
target: s390x
|
|
37
|
+
- runner: ubuntu-22.04
|
|
38
|
+
target: ppc64le
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v5
|
|
41
|
+
- uses: actions/setup-python@v6
|
|
42
|
+
with:
|
|
43
|
+
python-version: 3.x
|
|
44
|
+
- name: Build wheels
|
|
45
|
+
uses: PyO3/maturin-action@v1
|
|
46
|
+
with:
|
|
47
|
+
target: ${{ matrix.platform.target }}
|
|
48
|
+
args: --release --out dist --find-interpreter
|
|
49
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
50
|
+
manylinux: auto
|
|
51
|
+
- name: Upload wheels
|
|
52
|
+
uses: actions/upload-artifact@v4
|
|
53
|
+
with:
|
|
54
|
+
name: wheels-linux-${{ matrix.platform.target }}
|
|
55
|
+
path: dist
|
|
56
|
+
- name: pytest
|
|
57
|
+
if: ${{ startsWith(matrix.platform.target, 'x86_64') }}
|
|
58
|
+
shell: bash
|
|
59
|
+
run: |
|
|
60
|
+
set -e
|
|
61
|
+
python3 -m venv .venv
|
|
62
|
+
source .venv/bin/activate
|
|
63
|
+
pip install cotengrust --find-links dist --force-reinstall
|
|
64
|
+
pip install pytest
|
|
65
|
+
pytest
|
|
66
|
+
- name: pytest
|
|
67
|
+
if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'ppc64' }}
|
|
68
|
+
uses: uraimo/run-on-arch-action@v3
|
|
69
|
+
with:
|
|
70
|
+
arch: ${{ matrix.platform.target }}
|
|
71
|
+
distro: ubuntu22.04
|
|
72
|
+
githubToken: ${{ github.token }}
|
|
73
|
+
install: |
|
|
74
|
+
apt-get update
|
|
75
|
+
apt-get install -y --no-install-recommends python3 python3-pip
|
|
76
|
+
pip3 install -U pip pytest
|
|
77
|
+
run: |
|
|
78
|
+
set -e
|
|
79
|
+
pip3 install cotengrust --find-links dist --force-reinstall
|
|
80
|
+
pytest
|
|
81
|
+
|
|
82
|
+
musllinux:
|
|
83
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
84
|
+
strategy:
|
|
85
|
+
matrix:
|
|
86
|
+
platform:
|
|
87
|
+
- runner: ubuntu-22.04
|
|
88
|
+
target: x86_64
|
|
89
|
+
- runner: ubuntu-22.04
|
|
90
|
+
target: x86
|
|
91
|
+
- runner: ubuntu-22.04
|
|
92
|
+
target: aarch64
|
|
93
|
+
- runner: ubuntu-22.04
|
|
94
|
+
target: armv7
|
|
95
|
+
steps:
|
|
96
|
+
- uses: actions/checkout@v5
|
|
97
|
+
- uses: actions/setup-python@v6
|
|
98
|
+
with:
|
|
99
|
+
python-version: 3.x
|
|
100
|
+
- name: Build wheels
|
|
101
|
+
uses: PyO3/maturin-action@v1
|
|
102
|
+
with:
|
|
103
|
+
target: ${{ matrix.platform.target }}
|
|
104
|
+
args: --release --out dist --find-interpreter
|
|
105
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
106
|
+
manylinux: musllinux_1_2
|
|
107
|
+
- name: Upload wheels
|
|
108
|
+
uses: actions/upload-artifact@v4
|
|
109
|
+
with:
|
|
110
|
+
name: wheels-musllinux-${{ matrix.platform.target }}
|
|
111
|
+
path: dist
|
|
112
|
+
- name: pytest
|
|
113
|
+
if: ${{ startsWith(matrix.platform.target, 'x86_64') }}
|
|
114
|
+
uses: addnab/docker-run-action@v3
|
|
115
|
+
with:
|
|
116
|
+
image: alpine:latest
|
|
117
|
+
options: -v ${{ github.workspace }}:/io -w /io
|
|
118
|
+
run: |
|
|
119
|
+
set -e
|
|
120
|
+
apk add py3-pip py3-virtualenv
|
|
121
|
+
python3 -m virtualenv .venv
|
|
122
|
+
source .venv/bin/activate
|
|
123
|
+
pip install cotengrust --no-index --find-links dist --force-reinstall
|
|
124
|
+
pip install pytest
|
|
125
|
+
pytest
|
|
126
|
+
- name: pytest
|
|
127
|
+
if: ${{ !startsWith(matrix.platform.target, 'x86') }}
|
|
128
|
+
uses: uraimo/run-on-arch-action@v3
|
|
129
|
+
with:
|
|
130
|
+
arch: ${{ matrix.platform.target }}
|
|
131
|
+
distro: alpine_latest
|
|
132
|
+
githubToken: ${{ github.token }}
|
|
133
|
+
install: |
|
|
134
|
+
apk add py3-virtualenv
|
|
135
|
+
run: |
|
|
136
|
+
set -e
|
|
137
|
+
python3 -m virtualenv .venv
|
|
138
|
+
source .venv/bin/activate
|
|
139
|
+
pip install pytest
|
|
140
|
+
pip install cotengrust --find-links dist --force-reinstall
|
|
141
|
+
pytest
|
|
142
|
+
|
|
143
|
+
windows:
|
|
144
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
145
|
+
strategy:
|
|
146
|
+
matrix:
|
|
147
|
+
platform:
|
|
148
|
+
- runner: windows-latest
|
|
149
|
+
target: x64
|
|
150
|
+
- runner: windows-latest
|
|
151
|
+
target: x86
|
|
152
|
+
steps:
|
|
153
|
+
- uses: actions/checkout@v5
|
|
154
|
+
- uses: actions/setup-python@v6
|
|
155
|
+
with:
|
|
156
|
+
python-version: 3.x
|
|
157
|
+
architecture: ${{ matrix.platform.target }}
|
|
158
|
+
- name: Build wheels
|
|
159
|
+
uses: PyO3/maturin-action@v1
|
|
160
|
+
with:
|
|
161
|
+
target: ${{ matrix.platform.target }}
|
|
162
|
+
args: --release --out dist --find-interpreter
|
|
163
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
164
|
+
- name: Upload wheels
|
|
165
|
+
uses: actions/upload-artifact@v4
|
|
166
|
+
with:
|
|
167
|
+
name: wheels-windows-${{ matrix.platform.target }}
|
|
168
|
+
path: dist
|
|
169
|
+
- name: pytest
|
|
170
|
+
if: ${{ !startsWith(matrix.platform.target, 'aarch64') }}
|
|
171
|
+
shell: bash
|
|
172
|
+
run: |
|
|
173
|
+
set -e
|
|
174
|
+
python3 -m venv .venv
|
|
175
|
+
source .venv/Scripts/activate
|
|
176
|
+
pip install cotengrust --find-links dist --force-reinstall
|
|
177
|
+
pip install pytest
|
|
178
|
+
pytest
|
|
179
|
+
|
|
180
|
+
macos:
|
|
181
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
182
|
+
strategy:
|
|
183
|
+
matrix:
|
|
184
|
+
platform:
|
|
185
|
+
- runner: macos-13
|
|
186
|
+
target: x86_64
|
|
187
|
+
- runner: macos-14
|
|
188
|
+
target: aarch64
|
|
189
|
+
steps:
|
|
190
|
+
- uses: actions/checkout@v5
|
|
191
|
+
- uses: actions/setup-python@v6
|
|
192
|
+
with:
|
|
193
|
+
python-version: 3.x
|
|
194
|
+
- name: Build wheels
|
|
195
|
+
uses: PyO3/maturin-action@v1
|
|
196
|
+
with:
|
|
197
|
+
target: ${{ matrix.platform.target }}
|
|
198
|
+
args: --release --out dist --find-interpreter
|
|
199
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
200
|
+
- name: Upload wheels
|
|
201
|
+
uses: actions/upload-artifact@v4
|
|
202
|
+
with:
|
|
203
|
+
name: wheels-macos-${{ matrix.platform.target }}
|
|
204
|
+
path: dist
|
|
205
|
+
- name: pytest
|
|
206
|
+
run: |
|
|
207
|
+
set -e
|
|
208
|
+
python3 -m venv .venv
|
|
209
|
+
source .venv/bin/activate
|
|
210
|
+
pip install cotengrust --find-links dist --force-reinstall
|
|
211
|
+
pip install pytest
|
|
212
|
+
pytest
|
|
213
|
+
|
|
214
|
+
sdist:
|
|
215
|
+
runs-on: ubuntu-latest
|
|
216
|
+
steps:
|
|
217
|
+
- uses: actions/checkout@v5
|
|
218
|
+
- name: Build sdist
|
|
219
|
+
uses: PyO3/maturin-action@v1
|
|
220
|
+
with:
|
|
221
|
+
command: sdist
|
|
222
|
+
args: --out dist
|
|
223
|
+
- name: Upload sdist
|
|
224
|
+
uses: actions/upload-artifact@v4
|
|
225
|
+
with:
|
|
226
|
+
name: wheels-sdist
|
|
227
|
+
path: dist
|
|
228
|
+
|
|
229
|
+
release:
|
|
230
|
+
name: Release
|
|
231
|
+
runs-on: ubuntu-latest
|
|
232
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
233
|
+
needs: [linux, musllinux, windows, macos, sdist]
|
|
234
|
+
permissions:
|
|
235
|
+
# Use to sign the release artifacts
|
|
236
|
+
id-token: write
|
|
237
|
+
# Used to upload release artifacts
|
|
238
|
+
contents: write
|
|
239
|
+
# Used to generate artifact attestation
|
|
240
|
+
attestations: write
|
|
241
|
+
steps:
|
|
242
|
+
- uses: actions/download-artifact@v5
|
|
243
|
+
- name: Generate artifact attestation
|
|
244
|
+
uses: actions/attest-build-provenance@v3
|
|
245
|
+
with:
|
|
246
|
+
subject-path: 'wheels-*/*'
|
|
247
|
+
- name: Publish to PyPI
|
|
248
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
249
|
+
uses: PyO3/maturin-action@v1
|
|
250
|
+
env:
|
|
251
|
+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
252
|
+
with:
|
|
253
|
+
command: upload
|
|
254
|
+
args: --non-interactive --skip-existing wheels-*/*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This file is automatically @generated by Cargo.
|
|
2
2
|
# It is not intended for manual editing.
|
|
3
|
-
version =
|
|
3
|
+
version = 4
|
|
4
4
|
|
|
5
5
|
[[package]]
|
|
6
6
|
name = "autocfg"
|
|
@@ -23,6 +23,12 @@ version = "0.8.0"
|
|
|
23
23
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
24
24
|
checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
|
|
25
25
|
|
|
26
|
+
[[package]]
|
|
27
|
+
name = "bitflags"
|
|
28
|
+
version = "2.9.0"
|
|
29
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
30
|
+
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
|
|
31
|
+
|
|
26
32
|
[[package]]
|
|
27
33
|
name = "cfg-if"
|
|
28
34
|
version = "1.0.0"
|
|
@@ -31,9 +37,10 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
|
31
37
|
|
|
32
38
|
[[package]]
|
|
33
39
|
name = "cotengrust"
|
|
34
|
-
version = "0.
|
|
40
|
+
version = "0.2.0"
|
|
35
41
|
dependencies = [
|
|
36
42
|
"bit-set",
|
|
43
|
+
"num-traits",
|
|
37
44
|
"ordered-float",
|
|
38
45
|
"pyo3",
|
|
39
46
|
"rand",
|
|
@@ -42,13 +49,14 @@ dependencies = [
|
|
|
42
49
|
|
|
43
50
|
[[package]]
|
|
44
51
|
name = "getrandom"
|
|
45
|
-
version = "0.
|
|
52
|
+
version = "0.3.1"
|
|
46
53
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
47
|
-
checksum = "
|
|
54
|
+
checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8"
|
|
48
55
|
dependencies = [
|
|
49
56
|
"cfg-if",
|
|
50
57
|
"libc",
|
|
51
58
|
"wasi",
|
|
59
|
+
"windows-targets",
|
|
52
60
|
]
|
|
53
61
|
|
|
54
62
|
[[package]]
|
|
@@ -65,9 +73,9 @@ checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8"
|
|
|
65
73
|
|
|
66
74
|
[[package]]
|
|
67
75
|
name = "libc"
|
|
68
|
-
version = "0.2.
|
|
76
|
+
version = "0.2.170"
|
|
69
77
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
70
|
-
checksum = "
|
|
78
|
+
checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
|
|
71
79
|
|
|
72
80
|
[[package]]
|
|
73
81
|
name = "memoffset"
|
|
@@ -89,15 +97,15 @@ dependencies = [
|
|
|
89
97
|
|
|
90
98
|
[[package]]
|
|
91
99
|
name = "once_cell"
|
|
92
|
-
version = "1.
|
|
100
|
+
version = "1.21.3"
|
|
93
101
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
94
|
-
checksum = "
|
|
102
|
+
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
|
95
103
|
|
|
96
104
|
[[package]]
|
|
97
105
|
name = "ordered-float"
|
|
98
|
-
version = "
|
|
106
|
+
version = "5.1.0"
|
|
99
107
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
100
|
-
checksum = "
|
|
108
|
+
checksum = "7f4779c6901a562440c3786d08192c6fbda7c1c2060edd10006b05ee35d10f2d"
|
|
101
109
|
dependencies = [
|
|
102
110
|
"num-traits",
|
|
103
111
|
]
|
|
@@ -125,11 +133,10 @@ dependencies = [
|
|
|
125
133
|
|
|
126
134
|
[[package]]
|
|
127
135
|
name = "pyo3"
|
|
128
|
-
version = "0.
|
|
136
|
+
version = "0.26.0"
|
|
129
137
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
130
|
-
checksum = "
|
|
138
|
+
checksum = "7ba0117f4212101ee6544044dae45abe1083d30ce7b29c4b5cbdfa2354e07383"
|
|
131
139
|
dependencies = [
|
|
132
|
-
"cfg-if",
|
|
133
140
|
"indoc",
|
|
134
141
|
"libc",
|
|
135
142
|
"memoffset",
|
|
@@ -143,19 +150,18 @@ dependencies = [
|
|
|
143
150
|
|
|
144
151
|
[[package]]
|
|
145
152
|
name = "pyo3-build-config"
|
|
146
|
-
version = "0.
|
|
153
|
+
version = "0.26.0"
|
|
147
154
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
148
|
-
checksum = "
|
|
155
|
+
checksum = "4fc6ddaf24947d12a9aa31ac65431fb1b851b8f4365426e182901eabfb87df5f"
|
|
149
156
|
dependencies = [
|
|
150
|
-
"once_cell",
|
|
151
157
|
"target-lexicon",
|
|
152
158
|
]
|
|
153
159
|
|
|
154
160
|
[[package]]
|
|
155
161
|
name = "pyo3-ffi"
|
|
156
|
-
version = "0.
|
|
162
|
+
version = "0.26.0"
|
|
157
163
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
158
|
-
checksum = "
|
|
164
|
+
checksum = "025474d3928738efb38ac36d4744a74a400c901c7596199e20e45d98eb194105"
|
|
159
165
|
dependencies = [
|
|
160
166
|
"libc",
|
|
161
167
|
"pyo3-build-config",
|
|
@@ -163,9 +169,9 @@ dependencies = [
|
|
|
163
169
|
|
|
164
170
|
[[package]]
|
|
165
171
|
name = "pyo3-macros"
|
|
166
|
-
version = "0.
|
|
172
|
+
version = "0.26.0"
|
|
167
173
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
168
|
-
checksum = "
|
|
174
|
+
checksum = "2e64eb489f22fe1c95911b77c44cc41e7c19f3082fc81cce90f657cdc42ffded"
|
|
169
175
|
dependencies = [
|
|
170
176
|
"proc-macro2",
|
|
171
177
|
"pyo3-macros-backend",
|
|
@@ -175,9 +181,9 @@ dependencies = [
|
|
|
175
181
|
|
|
176
182
|
[[package]]
|
|
177
183
|
name = "pyo3-macros-backend"
|
|
178
|
-
version = "0.
|
|
184
|
+
version = "0.26.0"
|
|
179
185
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
180
|
-
checksum = "
|
|
186
|
+
checksum = "100246c0ecf400b475341b8455a9213344569af29a3c841d29270e53102e0fcf"
|
|
181
187
|
dependencies = [
|
|
182
188
|
"heck",
|
|
183
189
|
"proc-macro2",
|
|
@@ -197,20 +203,19 @@ dependencies = [
|
|
|
197
203
|
|
|
198
204
|
[[package]]
|
|
199
205
|
name = "rand"
|
|
200
|
-
version = "0.
|
|
206
|
+
version = "0.9.2"
|
|
201
207
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
202
|
-
checksum = "
|
|
208
|
+
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
|
|
203
209
|
dependencies = [
|
|
204
|
-
"libc",
|
|
205
210
|
"rand_chacha",
|
|
206
211
|
"rand_core",
|
|
207
212
|
]
|
|
208
213
|
|
|
209
214
|
[[package]]
|
|
210
215
|
name = "rand_chacha"
|
|
211
|
-
version = "0.
|
|
216
|
+
version = "0.9.0"
|
|
212
217
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
213
|
-
checksum = "
|
|
218
|
+
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
|
214
219
|
dependencies = [
|
|
215
220
|
"ppv-lite86",
|
|
216
221
|
"rand_core",
|
|
@@ -218,18 +223,18 @@ dependencies = [
|
|
|
218
223
|
|
|
219
224
|
[[package]]
|
|
220
225
|
name = "rand_core"
|
|
221
|
-
version = "0.
|
|
226
|
+
version = "0.9.3"
|
|
222
227
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
223
|
-
checksum = "
|
|
228
|
+
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
|
|
224
229
|
dependencies = [
|
|
225
230
|
"getrandom",
|
|
226
231
|
]
|
|
227
232
|
|
|
228
233
|
[[package]]
|
|
229
234
|
name = "rustc-hash"
|
|
230
|
-
version = "2.
|
|
235
|
+
version = "2.1.1"
|
|
231
236
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
232
|
-
checksum = "
|
|
237
|
+
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
|
233
238
|
|
|
234
239
|
[[package]]
|
|
235
240
|
name = "syn"
|
|
@@ -244,9 +249,9 @@ dependencies = [
|
|
|
244
249
|
|
|
245
250
|
[[package]]
|
|
246
251
|
name = "target-lexicon"
|
|
247
|
-
version = "0.
|
|
252
|
+
version = "0.13.2"
|
|
248
253
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
249
|
-
checksum = "
|
|
254
|
+
checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a"
|
|
250
255
|
|
|
251
256
|
[[package]]
|
|
252
257
|
name = "unicode-ident"
|
|
@@ -262,6 +267,82 @@ checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
|
|
|
262
267
|
|
|
263
268
|
[[package]]
|
|
264
269
|
name = "wasi"
|
|
265
|
-
version = "0.
|
|
270
|
+
version = "0.13.3+wasi-0.2.2"
|
|
271
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
272
|
+
checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2"
|
|
273
|
+
dependencies = [
|
|
274
|
+
"wit-bindgen-rt",
|
|
275
|
+
]
|
|
276
|
+
|
|
277
|
+
[[package]]
|
|
278
|
+
name = "windows-targets"
|
|
279
|
+
version = "0.52.6"
|
|
280
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
281
|
+
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
|
282
|
+
dependencies = [
|
|
283
|
+
"windows_aarch64_gnullvm",
|
|
284
|
+
"windows_aarch64_msvc",
|
|
285
|
+
"windows_i686_gnu",
|
|
286
|
+
"windows_i686_gnullvm",
|
|
287
|
+
"windows_i686_msvc",
|
|
288
|
+
"windows_x86_64_gnu",
|
|
289
|
+
"windows_x86_64_gnullvm",
|
|
290
|
+
"windows_x86_64_msvc",
|
|
291
|
+
]
|
|
292
|
+
|
|
293
|
+
[[package]]
|
|
294
|
+
name = "windows_aarch64_gnullvm"
|
|
295
|
+
version = "0.52.6"
|
|
296
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
297
|
+
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
|
298
|
+
|
|
299
|
+
[[package]]
|
|
300
|
+
name = "windows_aarch64_msvc"
|
|
301
|
+
version = "0.52.6"
|
|
266
302
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
267
|
-
checksum = "
|
|
303
|
+
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
|
304
|
+
|
|
305
|
+
[[package]]
|
|
306
|
+
name = "windows_i686_gnu"
|
|
307
|
+
version = "0.52.6"
|
|
308
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
309
|
+
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
|
310
|
+
|
|
311
|
+
[[package]]
|
|
312
|
+
name = "windows_i686_gnullvm"
|
|
313
|
+
version = "0.52.6"
|
|
314
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
315
|
+
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
|
316
|
+
|
|
317
|
+
[[package]]
|
|
318
|
+
name = "windows_i686_msvc"
|
|
319
|
+
version = "0.52.6"
|
|
320
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
321
|
+
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
|
322
|
+
|
|
323
|
+
[[package]]
|
|
324
|
+
name = "windows_x86_64_gnu"
|
|
325
|
+
version = "0.52.6"
|
|
326
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
327
|
+
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
|
328
|
+
|
|
329
|
+
[[package]]
|
|
330
|
+
name = "windows_x86_64_gnullvm"
|
|
331
|
+
version = "0.52.6"
|
|
332
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
333
|
+
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
|
334
|
+
|
|
335
|
+
[[package]]
|
|
336
|
+
name = "windows_x86_64_msvc"
|
|
337
|
+
version = "0.52.6"
|
|
338
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
339
|
+
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
|
340
|
+
|
|
341
|
+
[[package]]
|
|
342
|
+
name = "wit-bindgen-rt"
|
|
343
|
+
version = "0.33.0"
|
|
344
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
345
|
+
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
|
|
346
|
+
dependencies = [
|
|
347
|
+
"bitflags",
|
|
348
|
+
]
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "cotengrust"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.2.0"
|
|
4
4
|
edition = "2021"
|
|
5
|
+
readme = "README.md"
|
|
5
6
|
|
|
6
7
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
7
8
|
[lib]
|
|
@@ -10,10 +11,11 @@ crate-type = ["cdylib"]
|
|
|
10
11
|
|
|
11
12
|
[dependencies]
|
|
12
13
|
bit-set = "0.8"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
num-traits = "0.2"
|
|
15
|
+
ordered-float = "5.1"
|
|
16
|
+
pyo3 = "0.26"
|
|
17
|
+
rand = "0.9"
|
|
18
|
+
rustc-hash = "2.1"
|
|
17
19
|
|
|
18
20
|
[profile.release]
|
|
19
21
|
codegen-units = 1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: cotengrust
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -76,6 +76,51 @@ tree.plot_rubberband()
|
|
|
76
76
|

|
|
77
77
|
|
|
78
78
|
|
|
79
|
+
## Benchmarks
|
|
80
|
+
|
|
81
|
+
The following benchmarks illustrate performance and may be a useful comparison point for other implementations.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
First, the runtime of the optimal algorithm on random 3-regular graphs,
|
|
86
|
+
with all bond sizes set to 2, for different `mimimize` targets:
|
|
87
|
+
|
|
88
|
+
<img src="https://github.com/user-attachments/assets/e1b906a8-e234-4558-b183-7141c41beb24" width="400">
|
|
89
|
+
|
|
90
|
+
Taken over 20 instances, lines show mean and bands show standard error on mean. Note how much easier it is
|
|
91
|
+
to find optimal paths for the *maximum* intermediate size or cost only (vs. *total* for all contractions).
|
|
92
|
+
While the runtime generally scales exponentially, for some specific geometries it might reduce to
|
|
93
|
+
polynomial.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
For very large graphs, the `random_greedy` optimizer is appropriate, and there is a tradeoff between how
|
|
98
|
+
long one lets it run (`ntrials`) and the best cost it achieves. Here we plot these for various
|
|
99
|
+
$N=L\times L$ square grid graphs, with all bond sizes set to 2, for different `ntrials`
|
|
100
|
+
(labelled on each marker):
|
|
101
|
+
|
|
102
|
+
<img src="https://github.com/user-attachments/assets/e319b5cf-25ea-4273-aa0f-4f3acb3beaa6" width="400">
|
|
103
|
+
|
|
104
|
+
Again, data is taken over 20 runs, with lines and bands showing mean and standard error on the mean.
|
|
105
|
+
In most cases 32-64 trials is sufficient to achieve close to convergence, but for larger or harder
|
|
106
|
+
graphs you may need more. The empirical scaling of the random-greedy algorithm is very roughly
|
|
107
|
+
$\mathcal{O}(N^{1.5})$ here.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
The depth 20 sycamore quantum circuit amplitude is a standard benchmark nowadays, it is generally
|
|
112
|
+
a harder graph than the 2d lattice. Still, the random-greedy approach can do quite well due to its
|
|
113
|
+
sampling of both temperature and `costmod`:
|
|
114
|
+
|
|
115
|
+
<img src="https://github.com/user-attachments/assets/17b34e11-a755-4ed7-b88b-39b9e5424cfc" width="400">
|
|
116
|
+
|
|
117
|
+
Again, each point is a `ntrials` setting, and the lines and bands show the mean and error on the mean
|
|
118
|
+
respectively, across 20 repeats. The dashed line shows the roughly best known line from other more
|
|
119
|
+
advanced methods.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
|
|
79
124
|
## API
|
|
80
125
|
|
|
81
126
|
The optimize functions follow the api of the python implementations in `cotengra.pathfinders.path_basic.py`.
|
|
@@ -108,6 +153,8 @@ def optimize_optimal(
|
|
|
108
153
|
(also known as contraction cost)
|
|
109
154
|
- "size": minimize with respect to maximum intermediate size only
|
|
110
155
|
(also known as contraction width)
|
|
156
|
+
- 'max': minimize the single most expensive contraction, i.e. the
|
|
157
|
+
asymptotic (in index size) scaling of the contraction
|
|
111
158
|
- 'write' : minimize the sum of all tensor sizes, i.e. memory written
|
|
112
159
|
- 'combo' or 'combo={factor}` : minimize the sum of
|
|
113
160
|
FLOPS + factor * WRITE, with a default factor of 64.
|
|
@@ -129,11 +176,11 @@ def optimize_optimal(
|
|
|
129
176
|
simplify : bool, optional
|
|
130
177
|
Whether to perform simplifications before optimizing. These are:
|
|
131
178
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
179
|
+
- ignore any indices that appear in all terms
|
|
180
|
+
- combine any repeated indices within a single term
|
|
181
|
+
- reduce any non-output indices that only appear on a single term
|
|
182
|
+
- combine any scalar terms
|
|
183
|
+
- combine any tensors with matching indices (hadamard products)
|
|
137
184
|
|
|
138
185
|
Such simpifications may be required in the general case for the proper
|
|
139
186
|
functioning of the core optimization, but may be skipped if the input
|
|
@@ -189,11 +236,11 @@ def optimize_greedy(
|
|
|
189
236
|
simplify : bool, optional
|
|
190
237
|
Whether to perform simplifications before optimizing. These are:
|
|
191
238
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
239
|
+
- ignore any indices that appear in all terms
|
|
240
|
+
- combine any repeated indices within a single term
|
|
241
|
+
- reduce any non-output indices that only appear on a single term
|
|
242
|
+
- combine any scalar terms
|
|
243
|
+
- combine any tensors with matching indices (hadamard products)
|
|
197
244
|
|
|
198
245
|
Such simpifications may be required in the general case for the proper
|
|
199
246
|
functioning of the core optimization, but may be skipped if the input
|
|
@@ -238,7 +285,6 @@ def optimize_simplify(
|
|
|
238
285
|
path : list[list[int]]
|
|
239
286
|
The contraction path, given as a sequence of pairs of node indices. It
|
|
240
287
|
may also have single term contractions.
|
|
241
|
-
|
|
242
288
|
"""
|
|
243
289
|
...
|
|
244
290
|
|
|
@@ -287,11 +333,11 @@ def optimize_random_greedy_track_flops(
|
|
|
287
333
|
simplify : bool, optional
|
|
288
334
|
Whether to perform simplifications before optimizing. These are:
|
|
289
335
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
336
|
+
- ignore any indices that appear in all terms
|
|
337
|
+
- combine any repeated indices within a single term
|
|
338
|
+
- reduce any non-output indices that only appear on a single term
|
|
339
|
+
- combine any scalar terms
|
|
340
|
+
- combine any tensors with matching indices (hadamard products)
|
|
295
341
|
|
|
296
342
|
Such simpifications may be required in the general case for the proper
|
|
297
343
|
functioning of the core optimization, but may be skipped if the input
|