leapex 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 (90) hide show
  1. leapex-0.1.0/.gitattributes +2 -0
  2. leapex-0.1.0/.github/workflows/build_and_publish.yml +207 -0
  3. leapex-0.1.0/.gitignore +30 -0
  4. leapex-0.1.0/ALGORITHM.md +640 -0
  5. leapex-0.1.0/CONTRIBUTING.md +148 -0
  6. leapex-0.1.0/Cargo.lock +264 -0
  7. leapex-0.1.0/Cargo.toml +34 -0
  8. leapex-0.1.0/DIFFERENCES_FROM_BATSS.md +42 -0
  9. leapex-0.1.0/LICENSE +21 -0
  10. leapex-0.1.0/PKG-INFO +358 -0
  11. leapex-0.1.0/README.md +318 -0
  12. leapex-0.1.0/benchmark/benchmark.ipynb +1687 -0
  13. leapex-0.1.0/benchmark/benchmarking.py +469 -0
  14. leapex-0.1.0/benchmark/challenges.py +710 -0
  15. leapex-0.1.0/benchmark/data/Dimerization_runtime_batss_t0.5.json +42 -0
  16. leapex-0.1.0/benchmark/data/Dimerization_runtime_leapex_t0.5.json +46 -0
  17. leapex-0.1.0/benchmark/data/Dimerization_runtime_rebop_t0.5.json +38 -0
  18. leapex-0.1.0/benchmark/data/Dimerization_stats_leapex_t0.5.json +134 -0
  19. leapex-0.1.0/benchmark/data/Lotka Volterra_runtime_batss_t1.0.json +38 -0
  20. leapex-0.1.0/benchmark/data/Lotka Volterra_runtime_leapex_t1.0.json +46 -0
  21. leapex-0.1.0/benchmark/data/Lotka Volterra_runtime_rebop_t1.0.json +34 -0
  22. leapex-0.1.0/benchmark/data/Lotka Volterra_stats_leapex_t1.0.json +134 -0
  23. leapex-0.1.0/benchmark/data/Order-3 Brusselator_runtime_batss_t40.0.json +26 -0
  24. leapex-0.1.0/benchmark/data/Order-3 Brusselator_runtime_leapex_t40.0.json +38 -0
  25. leapex-0.1.0/benchmark/data/Order-3 Brusselator_runtime_rebop_t40.0.json +26 -0
  26. leapex-0.1.0/benchmark/data/Order-3 Brusselator_stats_leapex_t40.0.json +110 -0
  27. leapex-0.1.0/benchmark/data/Oregonator_runtime_batss_t1.0.json +30 -0
  28. leapex-0.1.0/benchmark/data/Oregonator_runtime_leapex_t1.0.json +38 -0
  29. leapex-0.1.0/benchmark/data/Oregonator_runtime_rebop_t1.0.json +30 -0
  30. leapex-0.1.0/benchmark/data/Oregonator_stats_leapex_t1.0.json +110 -0
  31. leapex-0.1.0/benchmark/data/R/303/266ssler-Willamowski_runtime_batss_t1.0.json +26 -0
  32. leapex-0.1.0/benchmark/data/R/303/266ssler-Willamowski_runtime_leapex_t1.0.json +38 -0
  33. leapex-0.1.0/benchmark/data/R/303/266ssler-Willamowski_runtime_rebop_t1.0.json +22 -0
  34. leapex-0.1.0/benchmark/data/R/303/266ssler-Willamowski_stats_leapex_t1.0.json +110 -0
  35. leapex-0.1.0/benchmark/data/challenges/Colloidal aggregation (q=20)_runtime_batss_t1.0.json +30 -0
  36. leapex-0.1.0/benchmark/data/challenges/Colloidal aggregation (q=20)_runtime_leapex_t1.0.json +42 -0
  37. leapex-0.1.0/benchmark/data/challenges/Colloidal aggregation (q=20)_runtime_rebop_t1.0.json +30 -0
  38. leapex-0.1.0/benchmark/data/challenges/Colloidal aggregation (q=20)_stats_leapex_t1.0.json +122 -0
  39. leapex-0.1.0/benchmark/data/challenges/Lattice diffusion (q=100)_runtime_batss_t1.0.json +38 -0
  40. leapex-0.1.0/benchmark/data/challenges/Lattice diffusion (q=100)_runtime_leapex_t1.0.json +34 -0
  41. leapex-0.1.0/benchmark/data/challenges/Lattice diffusion (q=100)_runtime_rebop_t1.0.json +30 -0
  42. leapex-0.1.0/benchmark/data/challenges/Lattice diffusion (q=100)_stats_leapex_t1.0.json +98 -0
  43. leapex-0.1.0/benchmark/data/challenges/Schl/303/266gl_runtime_batss_t1.0.json +34 -0
  44. leapex-0.1.0/benchmark/data/challenges/Schl/303/266gl_runtime_leapex_t1.0.json +46 -0
  45. leapex-0.1.0/benchmark/data/challenges/Schl/303/266gl_runtime_rebop_t1.0.json +34 -0
  46. leapex-0.1.0/benchmark/data/challenges/Schl/303/266gl_stats_leapex_t1.0.json +134 -0
  47. leapex-0.1.0/benchmark/data/challenges/Stiff decaying dimerization (s=1)_runtime_batss_t0.2.json +26 -0
  48. leapex-0.1.0/benchmark/data/challenges/Stiff decaying dimerization (s=1)_runtime_leapex_t0.2.json +38 -0
  49. leapex-0.1.0/benchmark/data/challenges/Stiff decaying dimerization (s=1)_runtime_rebop_t0.2.json +26 -0
  50. leapex-0.1.0/benchmark/data/challenges/Stiff decaying dimerization (s=1)_stats_leapex_t0.2.json +110 -0
  51. leapex-0.1.0/benchmark/data/challenges/Telegraph gene expression (g=1)_runtime_batss_t1.0.json +34 -0
  52. leapex-0.1.0/benchmark/data/challenges/Telegraph gene expression (g=1)_runtime_leapex_t1.0.json +34 -0
  53. leapex-0.1.0/benchmark/data/challenges/Telegraph gene expression (g=1)_runtime_rebop_t1.0.json +34 -0
  54. leapex-0.1.0/benchmark/data/challenges/Telegraph gene expression (g=1)_stats_leapex_t1.0.json +98 -0
  55. leapex-0.1.0/benchmark/data/challenges/machine.txt +6 -0
  56. leapex-0.1.0/benchmark/data/challenges/reactions_per_batch.png +0 -0
  57. leapex-0.1.0/benchmark/data/challenges/runtimes.png +0 -0
  58. leapex-0.1.0/benchmark/data/challenges/summary.md +53 -0
  59. leapex-0.1.0/benchmark/data/dsd_realtime/realtime.json +1 -0
  60. leapex-0.1.0/benchmark/data/machine.txt +6 -0
  61. leapex-0.1.0/benchmark/data/runtimes.png +0 -0
  62. leapex-0.1.0/benchmark/data/speedups.md +51 -0
  63. leapex-0.1.0/benchmark/run_benchmarks.py +96 -0
  64. leapex-0.1.0/benchmark/run_challenges.py +100 -0
  65. leapex-0.1.0/benchmark/run_dsd_realtime.py +534 -0
  66. leapex-0.1.0/examples/crn_examples.ipynb +1172 -0
  67. leapex-0.1.0/examples/dsd_oscillator.ipynb +1661 -0
  68. leapex-0.1.0/pyproject.toml +54 -0
  69. leapex-0.1.0/python/leapex/__init__.py +39 -0
  70. leapex-0.1.0/python/leapex/crn.py +808 -0
  71. leapex-0.1.0/python/leapex/leapex_rust.pyi +104 -0
  72. leapex-0.1.0/python/leapex/py.typed +0 -0
  73. leapex-0.1.0/python/leapex/simulation.py +681 -0
  74. leapex-0.1.0/python/leapex/snapshot.py +333 -0
  75. leapex-0.1.0/rust-toolchain.toml +4 -0
  76. leapex-0.1.0/scripts/make_benchmark_notebook.py +174 -0
  77. leapex-0.1.0/scripts/make_dsd_oscillator_notebook.py +930 -0
  78. leapex-0.1.0/scripts/make_examples_notebook.py +619 -0
  79. leapex-0.1.0/scripts/mutation_test.py +209 -0
  80. leapex-0.1.0/scripts/notebook_tools.py +46 -0
  81. leapex-0.1.0/src/binomial.rs +364 -0
  82. leapex-0.1.0/src/crn.rs +401 -0
  83. leapex-0.1.0/src/lib.rs +22 -0
  84. leapex-0.1.0/src/python.rs +341 -0
  85. leapex-0.1.0/src/sampling.rs +257 -0
  86. leapex-0.1.0/src/simulator.rs +702 -0
  87. leapex-0.1.0/tests/__init__.py +1 -0
  88. leapex-0.1.0/tests/exact.py +183 -0
  89. leapex-0.1.0/tests/test_api.py +572 -0
  90. leapex-0.1.0/tests/test_exactness.py +344 -0
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,207 @@
1
+ name: Build and Publish Python Package
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch: # Keeping manual trigger for testing
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ # Rust unit tests and the Python test suite (including the statistical exactness tests),
14
+ # run before anything is published.
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v7
18
+ - uses: actions/setup-python@v6
19
+ with:
20
+ python-version: "3.12"
21
+ - name: Rust unit tests
22
+ run: cargo test --release --no-default-features
23
+ - name: Build and install the package
24
+ run: |
25
+ pip install maturin
26
+ maturin build --release --out dist
27
+ pip install dist/*.whl scipy seaborn pytest
28
+ - name: Python tests
29
+ # The package source is under python/, which is not on sys.path, so this tests the installed wheel.
30
+ run: python -m pytest tests -q
31
+
32
+ linux:
33
+ runs-on: ${{ matrix.platform.runner }}
34
+ strategy:
35
+ matrix:
36
+ # Build only architectures common in personal computers: x86_64 and arm64
37
+ # (aarch64). Dropped 32-bit x86, armv7, and the server-only s390x/ppc64le —
38
+ # near-zero desktop audience, and 32-bit x86 can't even resolve (NumPy 2 ships
39
+ # no 32-bit wheels for Python >=3.10). sdist remains for anything omitted; the
40
+ # musllinux and windows jobs follow the same policy.
41
+ platform:
42
+ - runner: ubuntu-latest
43
+ target: x86_64
44
+ - runner: ubuntu-latest
45
+ target: aarch64
46
+ steps:
47
+ - uses: actions/checkout@v7
48
+ # No setup-python: the manylinux container supplies the interpreters that
49
+ # --find-interpreter builds against; the host Python would be unused here.
50
+ - name: Build wheels
51
+ uses: PyO3/maturin-action@v1
52
+ with:
53
+ target: ${{ matrix.platform.target }}
54
+ args: --release --out dist --find-interpreter
55
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
56
+ manylinux: auto
57
+ - name: Upload wheels
58
+ uses: actions/upload-artifact@v7
59
+ with:
60
+ name: wheels-linux-${{ matrix.platform.target }}
61
+ path: dist
62
+
63
+ musllinux:
64
+ runs-on: ${{ matrix.platform.runner }}
65
+ strategy:
66
+ matrix:
67
+ # Same personal-computer arch policy as the linux job: x86_64 + arm64 only.
68
+ platform:
69
+ - runner: ubuntu-latest
70
+ target: x86_64
71
+ - runner: ubuntu-latest
72
+ target: aarch64
73
+ steps:
74
+ - uses: actions/checkout@v7
75
+ # No setup-python: the musllinux container supplies the interpreters that
76
+ # --find-interpreter builds against; the host Python would be unused here.
77
+ - name: Build wheels
78
+ uses: PyO3/maturin-action@v1
79
+ with:
80
+ target: ${{ matrix.platform.target }}
81
+ args: --release --out dist --find-interpreter
82
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
83
+ manylinux: musllinux_1_2
84
+ - name: Upload wheels
85
+ uses: actions/upload-artifact@v7
86
+ with:
87
+ name: wheels-musllinux-${{ matrix.platform.target }}
88
+ path: dist
89
+
90
+ windows:
91
+ runs-on: ${{ matrix.platform.runner }}
92
+ strategy:
93
+ matrix:
94
+ # x64 only; 32-bit win32 has no NumPy 2 wheels and near-zero desktop use.
95
+ platform:
96
+ - runner: windows-latest
97
+ target: x64
98
+ steps:
99
+ - uses: actions/checkout@v7
100
+ - uses: actions/setup-python@v6
101
+ with:
102
+ # abi3 builds ONE forward-compatible wheel against a single interpreter
103
+ # (any CPython >=3.10 works as the build host).
104
+ python-version: "3.14"
105
+ architecture: ${{ matrix.platform.target }}
106
+ - name: Build wheels
107
+ uses: PyO3/maturin-action@v1
108
+ with:
109
+ target: ${{ matrix.platform.target }}
110
+ args: --release --out dist
111
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
112
+ - name: Upload wheels
113
+ uses: actions/upload-artifact@v7
114
+ with:
115
+ name: wheels-windows-${{ matrix.platform.target }}
116
+ path: dist
117
+
118
+ macos:
119
+ runs-on: ${{ matrix.platform.runner }}
120
+ strategy:
121
+ matrix:
122
+ # macOS hosted runners retire on GitHub's N-1 OS-version cadence: macos-13
123
+ # (Ventura) was retired 2025-12-04, which is why a macos-13 job now hangs
124
+ # unassigned. Pin to currently-supported macOS 15 and build BOTH Mac
125
+ # architectures — macos-15 (Apple Silicon / arm64) and macos-15-intel
126
+ # (Intel / x86_64) — so wheels cover essentially all Mac users. Intel hosted
127
+ # runners exist until ~Fall 2027; bump both labels when macOS 15 nears retirement.
128
+ platform:
129
+ - runner: macos-15-intel
130
+ target: x86_64
131
+ deployment_target: "10.13" # reach older Intel Macs (High Sierra, 2017+)
132
+ - runner: macos-15
133
+ target: aarch64
134
+ deployment_target: "11.0" # Apple Silicon floor (Big Sur); arm64 ignores lower
135
+ steps:
136
+ - uses: actions/checkout@v7
137
+ - uses: actions/setup-python@v6
138
+ with:
139
+ # abi3 builds ONE forward-compatible wheel against a single interpreter
140
+ # (any CPython >=3.10 works as the build host).
141
+ python-version: "3.14"
142
+ - name: Build wheels
143
+ uses: PyO3/maturin-action@v1
144
+ env:
145
+ MACOSX_DEPLOYMENT_TARGET: ${{ matrix.platform.deployment_target }}
146
+ with:
147
+ target: ${{ matrix.platform.target }}
148
+ args: --release --out dist
149
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
150
+ - name: Upload wheels
151
+ uses: actions/upload-artifact@v7
152
+ with:
153
+ name: wheels-macos-${{ matrix.platform.target }}
154
+ path: dist
155
+
156
+ sdist:
157
+ runs-on: ubuntu-latest
158
+ steps:
159
+ - uses: actions/checkout@v7
160
+ - name: Build sdist
161
+ uses: PyO3/maturin-action@v1
162
+ with:
163
+ command: sdist
164
+ args: --out dist
165
+ - name: Upload sdist
166
+ uses: actions/upload-artifact@v7
167
+ with:
168
+ name: wheels-sdist
169
+ path: dist
170
+
171
+ release:
172
+ name: Release
173
+ # Publish to PyPI ONLY for an actual GitHub Release. A manual "Run workflow"
174
+ # (workflow_dispatch) then builds every platform WITHOUT publishing — a safe
175
+ # all-platform build test that never touches PyPI.
176
+ if: github.event_name == 'release'
177
+ runs-on: ubuntu-latest
178
+ needs: [test, linux, musllinux, windows, macos, sdist]
179
+ environment: pypi
180
+ permissions:
181
+ # Use to sign the release artifacts
182
+ id-token: write
183
+ # Used to upload release artifacts
184
+ contents: write
185
+ # Used to generate artifact attestation
186
+ attestations: write
187
+ steps:
188
+ # Merge every platform's uploaded artifact into a single dist/ directory.
189
+ - uses: actions/download-artifact@v8
190
+ with:
191
+ path: dist
192
+ merge-multiple: true
193
+ - name: Generate artifact attestation
194
+ uses: actions/attest-build-provenance@v4
195
+ with:
196
+ subject-path: 'dist/*'
197
+ # Publish with the PyPA action (twine under the hood), replacing the deprecated
198
+ # `maturin upload` (PyO3/maturin#2334, removed in a future maturin). Uses PyPI
199
+ # Trusted Publishing via the id-token above — same OIDC mechanism as before, so
200
+ # no PyPI API token is needed and the existing trusted-publisher config still applies.
201
+ - name: Publish to PyPI
202
+ uses: pypa/gh-action-pypi-publish@release/v1
203
+ with:
204
+ skip-existing: true
205
+ # Keep the existing attest-build-provenance step as the provenance source;
206
+ # flip to true later if you also want PEP 740 attestations uploaded to PyPI.
207
+ attestations: false
@@ -0,0 +1,30 @@
1
+ # Rust build output (point CARGO_TARGET_DIR outside Dropbox; see CONTRIBUTING.md)
2
+ target/
3
+ **/*.rs.bk
4
+ *.pdb
5
+
6
+ # compiled extension module installed in-place by `maturin develop`
7
+ python/leapex/*.pyd
8
+ python/leapex/*.so
9
+
10
+ # Python
11
+ __pycache__/
12
+ *.py[cod]
13
+ *.egg-info/
14
+ build/
15
+ dist/
16
+ wheels/
17
+ .pytest_cache/
18
+ .ruff_cache/
19
+ .mypy_cache/
20
+ .ipynb_checkpoints/
21
+ .virtual_documents/
22
+ .venv/
23
+
24
+ # editors / tools
25
+ .vscode/
26
+ .idea/
27
+ .claude/
28
+
29
+ # benchmark scratch output (cached results under benchmark/data/ ARE committed)
30
+ benchmark/scratch/