qslib-quantum 0.1.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.
Files changed (136) hide show
  1. qslib_quantum-0.1.0/.gitattributes +3 -0
  2. qslib_quantum-0.1.0/.github/workflows/ci.yml +189 -0
  3. qslib_quantum-0.1.0/.github/workflows/docs.yml +55 -0
  4. qslib_quantum-0.1.0/.github/workflows/release.yml +223 -0
  5. qslib_quantum-0.1.0/.gitignore +48 -0
  6. qslib_quantum-0.1.0/Cargo.lock +1065 -0
  7. qslib_quantum-0.1.0/Cargo.toml +65 -0
  8. qslib_quantum-0.1.0/LICENSE +201 -0
  9. qslib_quantum-0.1.0/LICENSE-APACHE +201 -0
  10. qslib_quantum-0.1.0/PKG-INFO +42 -0
  11. qslib_quantum-0.1.0/PYTHON_README.md +19 -0
  12. qslib_quantum-0.1.0/README.md +94 -0
  13. qslib_quantum-0.1.0/benches/kernels.rs +145 -0
  14. qslib_quantum-0.1.0/book.toml +9 -0
  15. qslib_quantum-0.1.0/crates/qslib-core/Cargo.toml +23 -0
  16. qslib_quantum-0.1.0/crates/qslib-core/src/basis.rs +512 -0
  17. qslib_quantum-0.1.0/crates/qslib-core/src/error.rs +127 -0
  18. qslib_quantum-0.1.0/crates/qslib-core/src/geometry.rs +748 -0
  19. qslib_quantum-0.1.0/crates/qslib-core/src/identifiers.rs +144 -0
  20. qslib_quantum-0.1.0/crates/qslib-core/src/interactions.rs +715 -0
  21. qslib_quantum-0.1.0/crates/qslib-core/src/lib.rs +45 -0
  22. qslib_quantum-0.1.0/crates/qslib-core/src/models.rs +501 -0
  23. qslib_quantum-0.1.0/crates/qslib-core/src/operators.rs +427 -0
  24. qslib_quantum-0.1.0/crates/qslib-core/src/randomness.rs +25 -0
  25. qslib_quantum-0.1.0/crates/qslib-core/src/scalar.rs +16 -0
  26. qslib_quantum-0.1.0/crates/qslib-core/src/symmetry.rs +817 -0
  27. qslib_quantum-0.1.0/crates/qslib-core/tests/basis.rs +223 -0
  28. qslib_quantum-0.1.0/crates/qslib-core/tests/geometry.rs +182 -0
  29. qslib_quantum-0.1.0/crates/qslib-core/tests/interactions.rs +206 -0
  30. qslib_quantum-0.1.0/crates/qslib-core/tests/interoperability.rs +27 -0
  31. qslib_quantum-0.1.0/crates/qslib-core/tests/models.rs +679 -0
  32. qslib_quantum-0.1.0/crates/qslib-core/tests/operators.rs +185 -0
  33. qslib_quantum-0.1.0/crates/qslib-core/tests/symmetry.rs +408 -0
  34. qslib_quantum-0.1.0/crates/qslib-exact/Cargo.toml +16 -0
  35. qslib_quantum-0.1.0/crates/qslib-exact/examples/heterogeneous_ground_state.rs +40 -0
  36. qslib_quantum-0.1.0/crates/qslib-exact/src/lib.rs +1418 -0
  37. qslib_quantum-0.1.0/crates/qslib-exact/tests/exact.rs +583 -0
  38. qslib_quantum-0.1.0/crates/qslib-io/Cargo.toml +23 -0
  39. qslib_quantum-0.1.0/crates/qslib-io/examples/io_artifacts.rs +76 -0
  40. qslib_quantum-0.1.0/crates/qslib-io/src/lib.rs +2570 -0
  41. qslib_quantum-0.1.0/crates/qslib-io/tests/io.rs +607 -0
  42. qslib_quantum-0.1.0/crates/qslib-python/Cargo.toml +21 -0
  43. qslib_quantum-0.1.0/crates/qslib-python/LICENSE-APACHE +201 -0
  44. qslib_quantum-0.1.0/crates/qslib-python/PYTHON_README.md +19 -0
  45. qslib_quantum-0.1.0/crates/qslib-python/src/lib.rs +517 -0
  46. qslib_quantum-0.1.0/crates/qslib-python/tests/python_contract.py +171 -0
  47. qslib_quantum-0.1.0/crates/qslib-sse/Cargo.toml +22 -0
  48. qslib_quantum-0.1.0/crates/qslib-sse/examples/parity_fixture.rs +44 -0
  49. qslib_quantum-0.1.0/crates/qslib-sse/src/legacy.rs +58 -0
  50. qslib_quantum-0.1.0/crates/qslib-sse/src/lib.rs +18 -0
  51. qslib_quantum-0.1.0/crates/qslib-sse/src/measurements.rs +73 -0
  52. qslib_quantum-0.1.0/crates/qslib-sse/src/model.rs +525 -0
  53. qslib_quantum-0.1.0/crates/qslib-sse/src/sampler.rs +466 -0
  54. qslib_quantum-0.1.0/crates/qslib-sse/src/state.rs +150 -0
  55. qslib_quantum-0.1.0/crates/qslib-sse/tests/conformance.rs +628 -0
  56. qslib_quantum-0.1.0/crates/qslib-sse/tests/fixtures/sse_parity_v1.json +54 -0
  57. qslib_quantum-0.1.0/crates/qslib-test-support/Cargo.toml +18 -0
  58. qslib_quantum-0.1.0/crates/qslib-test-support/examples/fixture_digests.rs +18 -0
  59. qslib_quantum-0.1.0/crates/qslib-test-support/src/fixture.rs +965 -0
  60. qslib_quantum-0.1.0/crates/qslib-test-support/src/lib.rs +15 -0
  61. qslib_quantum-0.1.0/crates/qslib-test-support/tests/conventions.rs +225 -0
  62. qslib_quantum-0.1.0/crates/qslib-test-support/tests/workspace.rs +232 -0
  63. qslib_quantum-0.1.0/crates/qslib-variational/Cargo.toml +22 -0
  64. qslib_quantum-0.1.0/crates/qslib-variational/src/evolution.rs +763 -0
  65. qslib_quantum-0.1.0/crates/qslib-variational/src/lib.rs +506 -0
  66. qslib_quantum-0.1.0/crates/qslib-variational/src/tdvp.rs +1267 -0
  67. qslib_quantum-0.1.0/crates/qslib-variational/tests/evolution.rs +431 -0
  68. qslib_quantum-0.1.0/crates/qslib-variational/tests/statistics.rs +123 -0
  69. qslib_quantum-0.1.0/crates/qslib-variational/tests/tdvp.rs +361 -0
  70. qslib_quantum-0.1.0/deny.toml +27 -0
  71. qslib_quantum-0.1.0/dist/bin/qslib +0 -0
  72. qslib_quantum-0.1.0/dist/rust-source/qslib-0.1.0-source.tar.gz +0 -0
  73. qslib_quantum-0.1.0/dist/rust-source/qslib-quantum-core-0.1.0.crate +0 -0
  74. qslib_quantum-0.1.0/dist/wheels/qslib_quantum-0.1.0-cp312-abi3-manylinux_2_35_x86_64.whl +0 -0
  75. qslib_quantum-0.1.0/docs/SUMMARY.md +26 -0
  76. qslib_quantum-0.1.0/docs/api-stability.md +53 -0
  77. qslib_quantum-0.1.0/docs/architecture/README.md +228 -0
  78. qslib_quantum-0.1.0/docs/benchmarks.md +31 -0
  79. qslib_quantum-0.1.0/docs/cli.md +101 -0
  80. qslib_quantum-0.1.0/docs/contribution-policy.md +17 -0
  81. qslib_quantum-0.1.0/docs/conventions.md +1246 -0
  82. qslib_quantum-0.1.0/docs/decisions/0000-template.md +29 -0
  83. qslib_quantum-0.1.0/docs/decisions/0001-workspace-boundaries.md +75 -0
  84. qslib_quantum-0.1.0/docs/decisions/0002-linear-algebra-sparse-storage.md +78 -0
  85. qslib_quantum-0.1.0/docs/decisions/0003-randomness-reproducibility.md +69 -0
  86. qslib_quantum-0.1.0/docs/decisions/0004-artifacts-serialization.md +75 -0
  87. qslib_quantum-0.1.0/docs/decisions/0005-python-ffi-ownership.md +68 -0
  88. qslib_quantum-0.1.0/docs/decisions/0006-api-stability-and-features.md +56 -0
  89. qslib_quantum-0.1.0/docs/decisions/0007-standalone-sse-migration.md +53 -0
  90. qslib_quantum-0.1.0/docs/decisions/0008-repository-ownership.md +54 -0
  91. qslib_quantum-0.1.0/docs/decisions/0009-registry-package-names.md +58 -0
  92. qslib_quantum-0.1.0/docs/decisions/README.md +39 -0
  93. qslib_quantum-0.1.0/docs/evolution.md +46 -0
  94. qslib_quantum-0.1.0/docs/exact.md +55 -0
  95. qslib_quantum-0.1.0/docs/geometry-interactions.md +75 -0
  96. qslib_quantum-0.1.0/docs/index.md +58 -0
  97. qslib_quantum-0.1.0/docs/installation.md +88 -0
  98. qslib_quantum-0.1.0/docs/io.md +46 -0
  99. qslib_quantum-0.1.0/docs/limitations.md +23 -0
  100. qslib_quantum-0.1.0/docs/migration-ncli.md +20 -0
  101. qslib_quantum-0.1.0/docs/migration-sse.md +22 -0
  102. qslib_quantum-0.1.0/docs/observables-statistics.md +41 -0
  103. qslib_quantum-0.1.0/docs/operators-models.md +71 -0
  104. qslib_quantum-0.1.0/docs/python.md +63 -0
  105. qslib_quantum-0.1.0/docs/release-evidence.md +107 -0
  106. qslib_quantum-0.1.0/docs/reproducibility.md +26 -0
  107. qslib_quantum-0.1.0/docs/security-policy.md +22 -0
  108. qslib_quantum-0.1.0/docs/sse.md +39 -0
  109. qslib_quantum-0.1.0/docs/symmetry.md +41 -0
  110. qslib_quantum-0.1.0/docs/tdvp.md +37 -0
  111. qslib_quantum-0.1.0/docs/toolchain-policy.md +25 -0
  112. qslib_quantum-0.1.0/examples/heisenberg_disordered_4.yaml +15 -0
  113. qslib_quantum-0.1.0/examples/python_exact_ground_state.py +21 -0
  114. qslib_quantum-0.1.0/examples/tfim_4.yaml +16 -0
  115. qslib_quantum-0.1.0/examples/tfim_thermal_4.yaml +25 -0
  116. qslib_quantum-0.1.0/fixtures/conformance/v1/README.md +15 -0
  117. qslib_quantum-0.1.0/fixtures/conformance/v1/_schema.json +88 -0
  118. qslib_quantum-0.1.0/fixtures/conformance/v1/basis_rotation_spectrum.json +53 -0
  119. qslib_quantum-0.1.0/fixtures/conformance/v1/bit_packing.json +29 -0
  120. qslib_quantum-0.1.0/fixtures/conformance/v1/heisenberg_heterogeneous.json +36 -0
  121. qslib_quantum-0.1.0/fixtures/conformance/v1/heisenberg_one_bond.json +42 -0
  122. qslib_quantum-0.1.0/fixtures/conformance/v1/manifest.json +16 -0
  123. qslib_quantum-0.1.0/fixtures/conformance/v1/observable_normalization.json +31 -0
  124. qslib_quantum-0.1.0/fixtures/conformance/v1/rectangular_indexing.json +35 -0
  125. qslib_quantum-0.1.0/fixtures/conformance/v1/rydberg_two_site.json +47 -0
  126. qslib_quantum-0.1.0/fixtures/conformance/v1/tfim_one_bond.json +45 -0
  127. qslib_quantum-0.1.0/pyproject.toml +34 -0
  128. qslib_quantum-0.1.0/rust-toolchain.toml +4 -0
  129. qslib_quantum-0.1.0/src/lib.rs +29 -0
  130. qslib_quantum-0.1.0/tests/facade.rs +9 -0
  131. qslib_quantum-0.1.0/tools/build_docs_site.py +49 -0
  132. qslib_quantum-0.1.0/tools/check_markdown_links.py +37 -0
  133. qslib_quantum-0.1.0/tools/package_cli_release.py +84 -0
  134. qslib_quantum-0.1.0/tools/test_distribution_contract.py +89 -0
  135. qslib_quantum-0.1.0/tools/test_package_cli_release.py +69 -0
  136. qslib_quantum-0.1.0/tools/verify_io_artifacts.py +154 -0
@@ -0,0 +1,3 @@
1
+ # Conformance fixtures are checksummed as exact UTF-8 bytes. Keep their
2
+ # canonical LF representation independent of a contributor's platform.
3
+ fixtures/conformance/v1/** text eol=lf
@@ -0,0 +1,189 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ env:
12
+ CARGO_INCREMENTAL: "0"
13
+ CARGO_TERM_COLOR: always
14
+
15
+ jobs:
16
+ test:
17
+ name: Test (${{ matrix.os }}, Rust ${{ matrix.rust }})
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ os: [ubuntu-latest, macos-latest, windows-latest]
22
+ rust: [stable, "1.85.0"]
23
+ runs-on: ${{ matrix.os }}
24
+ steps:
25
+ - name: Checkout
26
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
27
+ with:
28
+ persist-credentials: false
29
+ - name: Install Rust
30
+ run: rustup toolchain install ${{ matrix.rust }} --profile minimal
31
+ - name: Check Rust workspace (Python cdylib excluded)
32
+ run: cargo +${{ matrix.rust }} check --locked --workspace --exclude qslib-quantum-python --all-targets --all-features
33
+ - name: Test Rust workspace (Python cdylib excluded)
34
+ run: cargo +${{ matrix.rust }} test --locked --workspace --exclude qslib-quantum-python --all-targets --all-features
35
+
36
+ quality:
37
+ name: Formatting, lint, docs, and policy
38
+ runs-on: ubuntu-latest
39
+ steps:
40
+ - name: Checkout
41
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
42
+ with:
43
+ persist-credentials: false
44
+ - name: Install stable Rust
45
+ run: rustup toolchain install stable --profile minimal --component rustfmt,clippy
46
+ - name: Install MSRV Rust
47
+ run: rustup toolchain install 1.85.0 --profile minimal
48
+ - name: Check formatting
49
+ run: cargo +stable fmt --all --check
50
+ - name: Run Clippy with warnings denied (Python cdylib excluded)
51
+ run: cargo +stable clippy --locked --workspace --exclude qslib-quantum-python --all-targets --all-features -- -D warnings
52
+ - name: Build documentation with warnings denied
53
+ env:
54
+ RUSTDOCFLAGS: -D warnings
55
+ run: cargo +stable doc --locked --workspace --exclude qslib-quantum-python --no-deps --all-features
56
+ - name: Install mdBook
57
+ run: cargo +stable install mdbook --version 0.5.4 --locked
58
+ - name: Build combined Markdown and Rust API site
59
+ run: python3 tools/build_docs_site.py "$RUNNER_TEMP/qslib-site"
60
+ - name: Test neutral conformance harness
61
+ run: cargo +stable test --locked -p qslib-test-support --test conventions --test workspace
62
+ - name: Check Markdown links
63
+ run: python3 tools/check_markdown_links.py
64
+ - name: Test third-party distribution contracts
65
+ run: |
66
+ PYTHONPATH=tools python3 tools/test_distribution_contract.py
67
+ PYTHONPATH=tools python3 tools/test_package_cli_release.py
68
+ - name: Run bounded structured CLI fuzz smoke
69
+ run: cargo +stable test --locked -p qslib-quantum-cli --lib structured_config_fuzz_never_panics_during_resolution
70
+ - name: Install cargo-deny
71
+ run: cargo +stable install cargo-deny --version 0.20.2 --locked
72
+ - name: Check dependency policy
73
+ run: cargo +stable deny check advisories licenses sources
74
+ - name: Install independent artifact readers
75
+ run: python3 -m pip install --disable-pip-version-check pyarrow blake3
76
+ - name: Verify generated IO artifacts through Python
77
+ run: |
78
+ fixture="${{ runner.temp }}/qslib-io-fixture"
79
+ cargo +stable run --locked -p qslib-quantum-io --example io_artifacts -- "$fixture"
80
+ python3 tools/verify_io_artifacts.py --checkpoint "$fixture/checkpoint" --dataset "$fixture/dataset"
81
+ - name: Build and test the local Python wheel
82
+ env:
83
+ RUSTUP_TOOLCHAIN: 1.85.0
84
+ run: |
85
+ python3 -m pip install --disable-pip-version-check maturin pytest numpy
86
+ maturin build --locked --manifest-path crates/qslib-python/Cargo.toml --out "$RUNNER_TEMP/qslib-wheel"
87
+ python3 -m venv "$RUNNER_TEMP/qslib-venv"
88
+ "$RUNNER_TEMP/qslib-venv/bin/pip" install --disable-pip-version-check "$RUNNER_TEMP"/qslib-wheel/*.whl pytest numpy
89
+ "$RUNNER_TEMP/qslib-venv/bin/pytest" -q crates/qslib-python/tests/python_contract.py
90
+ "$RUNNER_TEMP/qslib-venv/bin/python" examples/python_exact_ground_state.py
91
+
92
+ python-wheels:
93
+ name: Python wheel (${{ matrix.os }}, Python ${{ matrix.python }})
94
+ strategy:
95
+ fail-fast: false
96
+ matrix:
97
+ os: [ubuntu-latest, macos-latest, windows-latest]
98
+ python: ["3.12", "3.13"]
99
+ runs-on: ${{ matrix.os }}
100
+ steps:
101
+ - name: Checkout
102
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
103
+ with:
104
+ persist-credentials: false
105
+ - name: Set up Python
106
+ uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v6.1.0
107
+ with:
108
+ python-version: ${{ matrix.python }}
109
+ - name: Install Rust
110
+ run: rustup toolchain install 1.85.0 --profile minimal
111
+ - name: Build ABI3 wheel
112
+ env:
113
+ RUSTUP_TOOLCHAIN: 1.85.0
114
+ run: |
115
+ python -m pip install --disable-pip-version-check maturin pytest numpy
116
+ maturin build --locked --manifest-path crates/qslib-python/Cargo.toml --out wheelhouse
117
+ - name: Install and exercise wheel
118
+ run: |
119
+ python -m pip install --disable-pip-version-check --find-links wheelhouse qslib-quantum pytest numpy
120
+ python -m pytest -q crates/qslib-python/tests/python_contract.py
121
+ python examples/python_exact_ground_state.py
122
+
123
+ features:
124
+ name: Facade feature boundaries
125
+ runs-on: ubuntu-latest
126
+ steps:
127
+ - name: Checkout
128
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
129
+ with:
130
+ persist-credentials: false
131
+ - name: Install stable Rust
132
+ run: rustup toolchain install stable --profile minimal
133
+ - name: Check core-only facade
134
+ run: cargo +stable check --locked -p qslib-quantum --no-default-features
135
+ - name: Check exact facade
136
+ run: cargo +stable check --locked -p qslib-quantum --no-default-features --features exact
137
+ - name: Check variational facade
138
+ run: cargo +stable check --locked -p qslib-quantum --no-default-features --features variational
139
+ - name: Check SSE facade
140
+ run: cargo +stable check --locked -p qslib-quantum --no-default-features --features sse
141
+ - name: Check IO facade
142
+ run: cargo +stable check --locked -p qslib-quantum --no-default-features --features io
143
+ - name: Check full Rust facade
144
+ run: cargo +stable check --locked -p qslib-quantum --no-default-features --features full
145
+ - name: Audit workspace graph and feature metadata
146
+ run: cargo +stable test --locked -p qslib-test-support --test workspace
147
+
148
+ fuzz-state-conversion:
149
+ name: Bounded state-conversion fuzz
150
+ runs-on: ubuntu-latest
151
+ steps:
152
+ - name: Checkout
153
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
154
+ with:
155
+ persist-credentials: false
156
+ - name: Install stable Rust
157
+ run: rustup toolchain install stable --profile minimal
158
+ - name: Install cargo-fuzz
159
+ run: cargo +stable install cargo-fuzz --version 0.13.2 --locked
160
+ - name: Run bounded state-conversion fuzz target
161
+ run: cargo fuzz run state_conversion --sanitizer none -- -runs=1000
162
+
163
+ coverage:
164
+ name: Branch coverage
165
+ runs-on: ubuntu-latest
166
+ steps:
167
+ - name: Checkout
168
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
169
+ with:
170
+ persist-credentials: false
171
+ - name: Install nightly coverage toolchain
172
+ run: rustup toolchain install nightly --profile minimal --component llvm-tools-preview --component rust-src
173
+ - name: Install cargo-llvm-cov
174
+ run: cargo +stable install cargo-llvm-cov --version 0.6.21 --locked
175
+ - name: Run branch-enabled workspace coverage (Python cdylib excluded)
176
+ run: cargo +nightly llvm-cov --locked --workspace --exclude qslib-quantum-python --all-features --branch --summary-only
177
+
178
+ miri-core:
179
+ name: Miri core safety checks
180
+ runs-on: ubuntu-latest
181
+ steps:
182
+ - name: Checkout
183
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
184
+ with:
185
+ persist-credentials: false
186
+ - name: Install nightly Miri
187
+ run: rustup toolchain install nightly --profile minimal --component miri --component rust-src
188
+ - name: Run core tests under Miri
189
+ run: cargo +nightly miri test --locked -p qslib-quantum-core --all-targets
@@ -0,0 +1,55 @@
1
+ name: Documentation site
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: pages
14
+ cancel-in-progress: false
15
+
16
+ env:
17
+ CARGO_INCREMENTAL: "0"
18
+ CARGO_TERM_COLOR: always
19
+
20
+ jobs:
21
+ build:
22
+ name: Build combined documentation site
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - name: Checkout repository
26
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
27
+ with:
28
+ persist-credentials: false
29
+ - name: Install stable Rust
30
+ run: rustup toolchain install stable --profile minimal
31
+ - name: Install pinned mdBook
32
+ run: cargo +stable install mdbook --version 0.5.4 --locked
33
+ - name: Build the combined Markdown and Rust API site
34
+ run: python3 tools/build_docs_site.py "$RUNNER_TEMP/qslib-site"
35
+ - name: Upload Pages artifact
36
+ uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
37
+ with:
38
+ path: ${{ runner.temp }}/qslib-site
39
+
40
+ deploy:
41
+ name: Deploy to GitHub Pages
42
+ needs: build
43
+ runs-on: ubuntu-latest
44
+ permissions:
45
+ pages: write
46
+ id-token: write
47
+ environment:
48
+ name: github-pages
49
+ url: ${{ steps.deployment.outputs.page_url }}
50
+ steps:
51
+ - name: Configure GitHub Pages
52
+ uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
53
+ - name: Deploy the built site
54
+ id: deployment
55
+ uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
@@ -0,0 +1,223 @@
1
+ name: Release preparation
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch:
8
+ inputs:
9
+ publish:
10
+ description: Create the GitHub release for this checked-out version
11
+ required: true
12
+ default: false
13
+ type: boolean
14
+ publish_pypi:
15
+ description: Publish Python wheel and source distributions to PyPI
16
+ required: true
17
+ default: false
18
+ type: boolean
19
+ publish_crates:
20
+ description: Publish the Rust workspace crates to crates.io
21
+ required: true
22
+ default: false
23
+ type: boolean
24
+
25
+ permissions:
26
+ contents: read
27
+
28
+ env:
29
+ CARGO_INCREMENTAL: "0"
30
+ CARGO_TERM_COLOR: always
31
+
32
+ jobs:
33
+ prepare:
34
+ name: Build publication artifacts
35
+ runs-on: ubuntu-latest
36
+ steps:
37
+ - name: Checkout full repository history
38
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
39
+ with:
40
+ fetch-depth: 0
41
+ persist-credentials: false
42
+ - name: Install stable Rust
43
+ run: rustup toolchain install stable --profile minimal
44
+ - name: Install MSRV Rust
45
+ run: rustup toolchain install 1.85.0 --profile minimal
46
+ - name: Set up Python
47
+ uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v6.1.0
48
+ with:
49
+ python-version: "3.12"
50
+ - name: Build and verify release artifacts
51
+ shell: bash
52
+ run: |
53
+ set -euo pipefail
54
+ version="$(cargo +stable metadata --locked --no-deps --format-version 1 | python3 -c 'import json, sys; packages=json.load(sys.stdin)["packages"]; print(next(p["version"] for p in packages if p["name"] == "qslib-quantum"))')"
55
+ if [[ "$GITHUB_REF_TYPE" == "tag" && "$GITHUB_REF_NAME" != "v$version" ]]; then
56
+ echo "tag $GITHUB_REF_NAME does not match workspace version v$version" >&2
57
+ exit 1
58
+ fi
59
+ rm -rf dist
60
+ cargo +stable package --locked -p qslib-quantum-core
61
+ mkdir -p dist/bin dist/rust-source dist/wheels
62
+ python3 tools/test_distribution_contract.py
63
+ python3 tools/test_package_cli_release.py
64
+ cargo +stable test --locked --workspace --exclude qslib-quantum-python --all-targets --all-features
65
+ cargo +stable build --locked --release -p qslib-quantum-cli
66
+ cp target/release/qslib dist/bin/qslib
67
+ cp target/package/qslib-quantum-core-*.crate dist/rust-source/
68
+ git archive --format=tar.gz --prefix="qslib-$version/" HEAD > "dist/rust-source/qslib-$version-source.tar.gz"
69
+ python3 -m pip install --disable-pip-version-check maturin pytest numpy
70
+ RUSTUP_TOOLCHAIN=1.85.0 maturin build --locked --manifest-path crates/qslib-python/Cargo.toml --out dist/wheels
71
+ RUSTUP_TOOLCHAIN=1.85.0 maturin sdist --manifest-path crates/qslib-python/Cargo.toml --out dist/wheels
72
+ python3 -m venv "$RUNNER_TEMP/qslib-wheel-venv"
73
+ "$RUNNER_TEMP/qslib-wheel-venv/bin/pip" install --disable-pip-version-check \
74
+ dist/wheels/*.whl pytest numpy
75
+ "$RUNNER_TEMP/qslib-wheel-venv/bin/pytest" -q crates/qslib-python/tests/python_contract.py
76
+ "$RUNNER_TEMP/qslib-wheel-venv/bin/python" examples/python_exact_ground_state.py
77
+ python3 -m venv "$RUNNER_TEMP/qslib-sdist-venv"
78
+ "$RUNNER_TEMP/qslib-sdist-venv/bin/pip" install --disable-pip-version-check \
79
+ dist/wheels/*.tar.gz pytest numpy
80
+ "$RUNNER_TEMP/qslib-sdist-venv/bin/pytest" -q crates/qslib-python/tests/python_contract.py
81
+ "$RUNNER_TEMP/qslib-sdist-venv/bin/python" examples/python_exact_ground_state.py
82
+ dist/bin/qslib --help
83
+ cargo +stable install mdbook --version 0.5.4 --locked
84
+ python3 tools/build_docs_site.py dist/qslib-site
85
+ cp README.md LICENSE dist/
86
+ cp docs/release-evidence.md dist/
87
+ tar -C dist -czf "dist/qslib-$version-artifacts.tar.gz" \
88
+ bin rust-source wheels qslib-site LICENSE README.md release-evidence.md
89
+ printf 'qslib version: %s\ncommit: %s\n' "$version" "$(git rev-parse HEAD)" > dist/BUILD_METADATA.txt
90
+ (cd dist && find . -type f ! -name SHA256SUMS -print0 | sort -z | xargs -0 shasum -a 256 > SHA256SUMS)
91
+ (cd dist && shasum -a 256 -c SHA256SUMS)
92
+ - name: Upload release candidate for review
93
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
94
+ with:
95
+ name: qslib-release-${{ github.run_id }}
96
+ path: dist
97
+ if-no-files-found: error
98
+
99
+ cli-binaries:
100
+ name: CLI archive (${{ matrix.platform }})
101
+ strategy:
102
+ fail-fast: false
103
+ matrix:
104
+ include:
105
+ - os: ubuntu-latest
106
+ platform: linux-x86_64
107
+ binary: target/release/qslib
108
+ - os: macos-latest
109
+ platform: macos
110
+ binary: target/release/qslib
111
+ - os: windows-latest
112
+ platform: windows-x86_64
113
+ binary: target/release/qslib.exe
114
+ runs-on: ${{ matrix.os }}
115
+ steps:
116
+ - name: Checkout full repository history
117
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
118
+ with:
119
+ fetch-depth: 0
120
+ persist-credentials: false
121
+ - name: Install stable Rust
122
+ run: rustup toolchain install stable --profile minimal
123
+ - name: Build optimized CLI
124
+ run: cargo +stable build --locked --release -p qslib-quantum-cli
125
+ - name: Package CLI archive
126
+ shell: bash
127
+ run: |
128
+ set -euo pipefail
129
+ version="$(cargo +stable metadata --locked --no-deps --format-version 1 | python3 -c 'import json, sys; packages=json.load(sys.stdin)["packages"]; print(next(p["version"] for p in packages if p["name"] == "qslib-quantum"))')"
130
+ python3 tools/package_cli_release.py \
131
+ --binary "${{ matrix.binary }}" \
132
+ --version "$version" \
133
+ --platform "${{ matrix.platform }}" \
134
+ --output dist/cli
135
+ - name: Upload CLI archive
136
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
137
+ with:
138
+ name: qslib-cli-${{ matrix.platform }}-${{ github.run_id }}
139
+ path: dist/cli/*
140
+ if-no-files-found: error
141
+
142
+ publish:
143
+ name: Create GitHub release (manual)
144
+ needs: [prepare, cli-binaries]
145
+ if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish && startsWith(github.ref, 'refs/tags/v') }}
146
+ runs-on: ubuntu-latest
147
+ permissions:
148
+ contents: write
149
+ steps:
150
+ - name: Checkout tag history for gh verification
151
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
152
+ with:
153
+ fetch-depth: 0
154
+ persist-credentials: false
155
+ - name: Download reviewed release candidate
156
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
157
+ with:
158
+ name: qslib-release-${{ github.run_id }}
159
+ path: dist
160
+ - name: Download reviewed CLI archives
161
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
162
+ with:
163
+ pattern: qslib-cli-*-${{ github.run_id }}
164
+ path: dist/cli
165
+ merge-multiple: true
166
+ - name: Create GitHub release from the checked-out tag
167
+ env:
168
+ GH_TOKEN: ${{ github.token }}
169
+ run: gh release create "$GITHUB_REF_NAME" dist/qslib-*-artifacts.tar.gz dist/SHA256SUMS dist/BUILD_METADATA.txt dist/cli/* --verify-tag --generate-notes
170
+
171
+ publish-crates:
172
+ name: Publish Rust crates (manual)
173
+ needs: prepare
174
+ if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish_crates && startsWith(github.ref, 'refs/tags/v') }}
175
+ runs-on: ubuntu-latest
176
+ steps:
177
+ - name: Checkout the release tag
178
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
179
+ with:
180
+ persist-credentials: false
181
+ - name: Install stable Rust
182
+ run: rustup toolchain install stable --profile minimal
183
+ - name: Publish crates in dependency order
184
+ env:
185
+ CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
186
+ run: |
187
+ set -euo pipefail
188
+ if [[ -z "$CARGO_REGISTRY_TOKEN" ]]; then
189
+ echo "the CARGO_REGISTRY_TOKEN repository secret is not configured" >&2
190
+ exit 1
191
+ fi
192
+ for package in \
193
+ qslib-quantum-core \
194
+ qslib-quantum-exact \
195
+ qslib-quantum-io \
196
+ qslib-quantum-sse \
197
+ qslib-quantum-variational \
198
+ qslib-quantum \
199
+ qslib-quantum-cli; do
200
+ cargo +stable publish --locked -p "$package"
201
+ done
202
+
203
+ publish-pypi:
204
+ name: Publish Python distributions (manual)
205
+ needs: prepare
206
+ if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish_pypi && startsWith(github.ref, 'refs/tags/v') }}
207
+ runs-on: ubuntu-latest
208
+ environment:
209
+ name: pypi
210
+ url: https://pypi.org/p/qslib-quantum
211
+ permissions:
212
+ id-token: write
213
+ steps:
214
+ - name: Download reviewed release candidate
215
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
216
+ with:
217
+ name: qslib-release-${{ github.run_id }}
218
+ path: dist
219
+ - name: Publish Python distributions with trusted publishing
220
+ uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # release/v1
221
+ with:
222
+ packages-dir: dist/wheels/
223
+ skip-existing: true
@@ -0,0 +1,48 @@
1
+
2
+ # Generated by Cargo
3
+ # will have compiled files and executables
4
+ debug
5
+ target
6
+
7
+ # These are backup files generated by rustfmt
8
+ **/*.rs.bk
9
+
10
+ # MSVC Windows builds of rustc generate these, which store debugging information
11
+ *.pdb
12
+
13
+ # Generated by cargo mutants
14
+ # Contains mutation testing data
15
+ **/mutants.out*/
16
+
17
+ # RustRover
18
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
19
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
20
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
21
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
22
+ #.idea/
23
+
24
+ AGENTS.md
25
+ PLANS.md
26
+ SECURITY.md
27
+ .agents/
28
+ .codex/
29
+ docs/plans
30
+ docs/governance/target/
31
+
32
+ /target/
33
+ /fuzz/target/
34
+
35
+ # Local-only agent, governance, and planning metadata.
36
+ .DS_Store
37
+ .agents/
38
+ .codex/
39
+ docs/governance/
40
+ docs/plans
41
+ AGENTS.md
42
+ SECURITY.md
43
+ PLANS.md
44
+ CONTRIBUTING.md
45
+ __pycache__/
46
+ *.pyc
47
+ CHANGELOG.md
48
+ RELEASE_NOTES.md