keplemon 3.0.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.
Files changed (148) hide show
  1. keplemon-3.0.2/.DS_Store +0 -0
  2. keplemon-3.0.2/.github/workflows/docs.yml +46 -0
  3. keplemon-3.0.2/.github/workflows/release.yml +544 -0
  4. keplemon-3.0.2/.github/workflows/test.yml +351 -0
  5. keplemon-3.0.2/.gitignore +23 -0
  6. keplemon-3.0.2/AGENTS.md +17 -0
  7. keplemon-3.0.2/Cargo.lock +1631 -0
  8. keplemon-3.0.2/Cargo.toml +63 -0
  9. keplemon-3.0.2/Makefile.toml +14 -0
  10. keplemon-3.0.2/PKG-INFO +21 -0
  11. keplemon-3.0.2/README.md +90 -0
  12. keplemon-3.0.2/build.rs +58 -0
  13. keplemon-3.0.2/mkdocs.yml +66 -0
  14. keplemon-3.0.2/pyproject.toml +41 -0
  15. keplemon-3.0.2/python/keplemon/__init__.py +33 -0
  16. keplemon-3.0.2/python/keplemon/__main__.py +20 -0
  17. keplemon-3.0.2/python/keplemon/bodies.py +8 -0
  18. keplemon-3.0.2/python/keplemon/catalogs.py +5 -0
  19. keplemon-3.0.2/python/keplemon/elements.py +39 -0
  20. keplemon-3.0.2/python/keplemon/enums.py +21 -0
  21. keplemon-3.0.2/python/keplemon/estimation.py +9 -0
  22. keplemon-3.0.2/python/keplemon/events.py +17 -0
  23. keplemon-3.0.2/python/keplemon/exceptions.py +5 -0
  24. keplemon-3.0.2/python/keplemon/propagation.py +15 -0
  25. keplemon-3.0.2/python/keplemon/py.typed +0 -0
  26. keplemon-3.0.2/python/keplemon/time.py +118 -0
  27. keplemon-3.0.2/rustfmt.toml +1 -0
  28. keplemon-3.0.2/src/bindings/bodies/constellation.rs +191 -0
  29. keplemon-3.0.2/src/bindings/bodies/observatory.rs +157 -0
  30. keplemon-3.0.2/src/bindings/bodies/satellite.rs +249 -0
  31. keplemon-3.0.2/src/bindings/bodies/sensor.rs +73 -0
  32. keplemon-3.0.2/src/bindings/bodies.rs +26 -0
  33. keplemon-3.0.2/src/bindings/catalogs/tle_catalog.rs +87 -0
  34. keplemon-3.0.2/src/bindings/catalogs.rs +16 -0
  35. keplemon-3.0.2/src/bindings/elements/bore_to_body_angles.rs +45 -0
  36. keplemon-3.0.2/src/bindings/elements/cartesian_state.rs +70 -0
  37. keplemon-3.0.2/src/bindings/elements/cartesian_vector.rs +82 -0
  38. keplemon-3.0.2/src/bindings/elements/ephemeris.rs +102 -0
  39. keplemon-3.0.2/src/bindings/elements/equinoctial_elements.rs +77 -0
  40. keplemon-3.0.2/src/bindings/elements/geodetic_position.rs +43 -0
  41. keplemon-3.0.2/src/bindings/elements/horizon_elements.rs +96 -0
  42. keplemon-3.0.2/src/bindings/elements/horizon_state.rs +144 -0
  43. keplemon-3.0.2/src/bindings/elements/keplerian_elements.rs +181 -0
  44. keplemon-3.0.2/src/bindings/elements/keplerian_state.rs +138 -0
  45. keplemon-3.0.2/src/bindings/elements/orbit_plot_data.rs +183 -0
  46. keplemon-3.0.2/src/bindings/elements/relative_state.rs +63 -0
  47. keplemon-3.0.2/src/bindings/elements/spherical_vector.rs +63 -0
  48. keplemon-3.0.2/src/bindings/elements/tle.rs +151 -0
  49. keplemon-3.0.2/src/bindings/elements/topocentric_elements.rs +118 -0
  50. keplemon-3.0.2/src/bindings/elements/topocentric_state.rs +95 -0
  51. keplemon-3.0.2/src/bindings/elements.rs +64 -0
  52. keplemon-3.0.2/src/bindings/enums/association_confidence.rs +63 -0
  53. keplemon-3.0.2/src/bindings/enums/classification.rs +59 -0
  54. keplemon-3.0.2/src/bindings/enums/covariance_type.rs +63 -0
  55. keplemon-3.0.2/src/bindings/enums/geodetic_model.rs +57 -0
  56. keplemon-3.0.2/src/bindings/enums/keplerian_type.rs +69 -0
  57. keplemon-3.0.2/src/bindings/enums/mean_equinox.rs +71 -0
  58. keplemon-3.0.2/src/bindings/enums/reference_frame.rs +67 -0
  59. keplemon-3.0.2/src/bindings/enums/time_system.rs +79 -0
  60. keplemon-3.0.2/src/bindings/enums.rs +39 -0
  61. keplemon-3.0.2/src/bindings/estimation/batch_least_squares.rs +152 -0
  62. keplemon-3.0.2/src/bindings/estimation/covariance.rs +64 -0
  63. keplemon-3.0.2/src/bindings/estimation/observation.rs +166 -0
  64. keplemon-3.0.2/src/bindings/estimation/observation_association.rs +59 -0
  65. keplemon-3.0.2/src/bindings/estimation/observation_residual.rs +83 -0
  66. keplemon-3.0.2/src/bindings/estimation.rs +30 -0
  67. keplemon-3.0.2/src/bindings/events/close_approach.rs +52 -0
  68. keplemon-3.0.2/src/bindings/events/close_approach_report.rs +62 -0
  69. keplemon-3.0.2/src/bindings/events/field_of_view_candidate.rs +40 -0
  70. keplemon-3.0.2/src/bindings/events/field_of_view_report.rs +89 -0
  71. keplemon-3.0.2/src/bindings/events/horizon_access.rs +62 -0
  72. keplemon-3.0.2/src/bindings/events/horizon_access_report.rs +68 -0
  73. keplemon-3.0.2/src/bindings/events.rs +31 -0
  74. keplemon-3.0.2/src/bindings/propagation/force_properties.rs +142 -0
  75. keplemon-3.0.2/src/bindings/propagation/inertial_propagator.rs +106 -0
  76. keplemon-3.0.2/src/bindings/propagation/sgp4_output.rs +44 -0
  77. keplemon-3.0.2/src/bindings/propagation.rs +36 -0
  78. keplemon-3.0.2/src/bindings/time/epoch.rs +163 -0
  79. keplemon-3.0.2/src/bindings/time/time_components.rs +121 -0
  80. keplemon-3.0.2/src/bindings/time/time_span.rs +67 -0
  81. keplemon-3.0.2/src/bindings/time.rs +22 -0
  82. keplemon-3.0.2/src/bindings.rs +40 -0
  83. keplemon-3.0.2/src/bodies/constellation.rs +341 -0
  84. keplemon-3.0.2/src/bodies/observatory.rs +185 -0
  85. keplemon-3.0.2/src/bodies/satellite.rs +582 -0
  86. keplemon-3.0.2/src/bodies/sensor.rs +24 -0
  87. keplemon-3.0.2/src/bodies.rs +9 -0
  88. keplemon-3.0.2/src/catalogs/tle_catalog.rs +75 -0
  89. keplemon-3.0.2/src/catalogs.rs +3 -0
  90. keplemon-3.0.2/src/configs.rs +16 -0
  91. keplemon-3.0.2/src/elements/bore_to_body_angles.rs +27 -0
  92. keplemon-3.0.2/src/elements/cartesian_state.rs +168 -0
  93. keplemon-3.0.2/src/elements/cartesian_vector.rs +131 -0
  94. keplemon-3.0.2/src/elements/ephemeris.rs +522 -0
  95. keplemon-3.0.2/src/elements/equinoctial_elements.rs +95 -0
  96. keplemon-3.0.2/src/elements/geodetic_position.rs +16 -0
  97. keplemon-3.0.2/src/elements/horizon_elements.rs +50 -0
  98. keplemon-3.0.2/src/elements/horizon_state.rs +65 -0
  99. keplemon-3.0.2/src/elements/keplerian_elements.rs +147 -0
  100. keplemon-3.0.2/src/elements/keplerian_state.rs +158 -0
  101. keplemon-3.0.2/src/elements/orbit_plot_data.rs +187 -0
  102. keplemon-3.0.2/src/elements/relative_state.rs +29 -0
  103. keplemon-3.0.2/src/elements/spherical_vector.rs +31 -0
  104. keplemon-3.0.2/src/elements/tle.rs +788 -0
  105. keplemon-3.0.2/src/elements/topocentric_elements.rs +55 -0
  106. keplemon-3.0.2/src/elements/topocentric_state.rs +50 -0
  107. keplemon-3.0.2/src/elements.rs +35 -0
  108. keplemon-3.0.2/src/enums/association_confidence.rs +6 -0
  109. keplemon-3.0.2/src/enums/classification.rs +31 -0
  110. keplemon-3.0.2/src/enums/covariance_type.rs +6 -0
  111. keplemon-3.0.2/src/enums/equinox_type.rs +20 -0
  112. keplemon-3.0.2/src/enums/geodetic_model.rs +8 -0
  113. keplemon-3.0.2/src/enums/keplerian_type.rs +36 -0
  114. keplemon-3.0.2/src/enums/reference_frame.rs +7 -0
  115. keplemon-3.0.2/src/enums/time_system.rs +20 -0
  116. keplemon-3.0.2/src/enums.rs +17 -0
  117. keplemon-3.0.2/src/estimation/batch_least_squares.rs +720 -0
  118. keplemon-3.0.2/src/estimation/covariance.rs +64 -0
  119. keplemon-3.0.2/src/estimation/observation.rs +376 -0
  120. keplemon-3.0.2/src/estimation/observation_association.rs +42 -0
  121. keplemon-3.0.2/src/estimation/observation_residual.rs +86 -0
  122. keplemon-3.0.2/src/estimation.rs +11 -0
  123. keplemon-3.0.2/src/events/close_approach.rs +36 -0
  124. keplemon-3.0.2/src/events/close_approach_report.rs +40 -0
  125. keplemon-3.0.2/src/events/field_of_view_candidate.rs +24 -0
  126. keplemon-3.0.2/src/events/field_of_view_report.rs +64 -0
  127. keplemon-3.0.2/src/events/horizon_access.rs +44 -0
  128. keplemon-3.0.2/src/events/horizon_access_report.rs +46 -0
  129. keplemon-3.0.2/src/events.rs +13 -0
  130. keplemon-3.0.2/src/lib.rs +34 -0
  131. keplemon-3.0.2/src/propagation/force_properties.rs +102 -0
  132. keplemon-3.0.2/src/propagation/inertial_propagator.rs +171 -0
  133. keplemon-3.0.2/src/propagation/sgp4_output.rs +75 -0
  134. keplemon-3.0.2/src/propagation.rs +10 -0
  135. keplemon-3.0.2/src/test_lock.rs +3 -0
  136. keplemon-3.0.2/src/time/epoch.rs +334 -0
  137. keplemon-3.0.2/src/time/time_components.rs +47 -0
  138. keplemon-3.0.2/src/time/time_span.rs +75 -0
  139. keplemon-3.0.2/src/time.rs +14 -0
  140. keplemon-3.0.2/stubs/keplemon/__init__.pyi +54 -0
  141. keplemon-3.0.2/stubs/keplemon/bodies.pyi +365 -0
  142. keplemon-3.0.2/stubs/keplemon/catalogs.pyi +17 -0
  143. keplemon-3.0.2/stubs/keplemon/elements.pyi +519 -0
  144. keplemon-3.0.2/stubs/keplemon/enums.pyi +120 -0
  145. keplemon-3.0.2/stubs/keplemon/estimation.pyi +198 -0
  146. keplemon-3.0.2/stubs/keplemon/events.pyi +103 -0
  147. keplemon-3.0.2/stubs/keplemon/propagation.pyi +48 -0
  148. keplemon-3.0.2/stubs/keplemon/time.pyi +293 -0
Binary file
@@ -0,0 +1,46 @@
1
+ name: Deploy MkDocs site
2
+
3
+ permissions:
4
+ contents: read
5
+ id-token: write
6
+ pages: write
7
+
8
+ on:
9
+ push:
10
+ branches:
11
+ - main
12
+
13
+ jobs:
14
+ deploy:
15
+ runs-on: ubuntu-latest
16
+ environment:
17
+ name: github-pages
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+
21
+ - name: Set up Python
22
+ uses: actions/setup-python@v4
23
+ with:
24
+ python-version: '3.13'
25
+
26
+ - name: Install dependencies
27
+ run: |
28
+ sudo apt-get update && sudo apt-get install -y libssl-dev
29
+ python -m pip install --upgrade pip
30
+ pip install ".[dev]"
31
+
32
+ - name: Build site
33
+ run: |
34
+ PYTHONPATH=stubs mkdocs build --clean --verbose
35
+
36
+ - name: Add CNAME for custom domain
37
+ run: echo 'keplemon.citra.space' > site/CNAME
38
+
39
+ - uses: actions/configure-pages@v3
40
+
41
+ - name: Upload Pages Artifact
42
+ uses: actions/upload-pages-artifact@v3
43
+ with:
44
+ path: site
45
+
46
+ - uses: actions/deploy-pages@v4
@@ -0,0 +1,544 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*'
7
+
8
+ env:
9
+ BUILD_PYTHON_VERSION: '3.10'
10
+
11
+ jobs:
12
+ build-linux-x86:
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ contents: read
16
+ defaults:
17
+ run:
18
+ shell: bash
19
+ steps:
20
+ - name: Checkout
21
+ uses: actions/checkout@v4
22
+
23
+ - name: Install Rust
24
+ uses: dtolnay/rust-toolchain@stable
25
+
26
+ - name: Test Rust
27
+ run: cargo test --target x86_64-unknown-linux-gnu --lib --tests --bins
28
+
29
+ - name: Build wheel (linux x86)
30
+ run: |
31
+ docker run --rm \
32
+ -v ${{ github.workspace }}:/io \
33
+ -e HOME=/root \
34
+ -w /io quay.io/pypa/manylinux2014_x86_64 \
35
+ bash -c '
36
+ yum install -y curl gcc gcc-c++ make openssl-devel openssl && \
37
+ export CARGO_HOME="$HOME/.cargo" && export RUSTUP_HOME="$HOME/.rustup" && \
38
+ curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable && \
39
+ source "$CARGO_HOME/env" && \
40
+ cargo clean && \
41
+ cargo install --locked maturin && \
42
+ export OPENSSL_DIR=/usr && \
43
+ export OPENSSL_LIB_DIR=/usr/lib64 && \
44
+ export OPENSSL_INCLUDE_DIR=/usr/include && \
45
+ PYTHON_VERSION=${{ env.BUILD_PYTHON_VERSION }} && \
46
+ TAG=${PYTHON_VERSION//./} && \
47
+ PY_BIN=/opt/python/cp${TAG}-cp${TAG}/bin/python && \
48
+ PIP="${PY_BIN%/python}/pip" && \
49
+ $PIP install --upgrade pip setuptools wheel auditwheel && \
50
+ maturin build --release --compatibility manylinux2014 -i $PY_BIN
51
+ '
52
+
53
+ - name: Upload wheels
54
+ uses: actions/upload-artifact@v4
55
+ with:
56
+ name: pypi-linux-x86_64-gnu
57
+ path: target/wheels/*.whl
58
+
59
+ build-linux-arm:
60
+ runs-on: ubuntu-24.04-arm
61
+ permissions:
62
+ contents: read
63
+ defaults:
64
+ run:
65
+ shell: bash
66
+ steps:
67
+ - name: Checkout
68
+ uses: actions/checkout@v4
69
+
70
+ - name: Install Rust
71
+ uses: dtolnay/rust-toolchain@stable
72
+
73
+ - name: Test Rust
74
+ run: cargo test --target aarch64-unknown-linux-gnu --lib --tests --bins
75
+
76
+ - name: Build wheel (linux arm)
77
+ run: |
78
+ docker run --rm \
79
+ -v ${{ github.workspace }}:/io \
80
+ -e HOME=/root \
81
+ -w /io quay.io/pypa/manylinux2014_aarch64 \
82
+ bash -c '
83
+ yum install -y curl gcc gcc-c++ make openssl-devel openssl && \
84
+ export CARGO_HOME="$HOME/.cargo" && export RUSTUP_HOME="$HOME/.rustup" && \
85
+ curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable && \
86
+ source "$CARGO_HOME/env" && \
87
+ cargo clean && \
88
+ cargo install --locked maturin && \
89
+ export OPENSSL_DIR=/usr && \
90
+ export OPENSSL_LIB_DIR=/usr/lib64 && \
91
+ export OPENSSL_INCLUDE_DIR=/usr/include && \
92
+ PYTHON_VERSION=${{ env.BUILD_PYTHON_VERSION }} && \
93
+ TAG=${PYTHON_VERSION//./} && \
94
+ PY_BIN=/opt/python/cp${TAG}-cp${TAG}/bin/python && \
95
+ PIP="${PY_BIN%/python}/pip" && \
96
+ $PIP install --upgrade pip setuptools wheel auditwheel && \
97
+ maturin build --release --compatibility manylinux2014 -i $PY_BIN
98
+ '
99
+
100
+ - name: Upload wheels
101
+ uses: actions/upload-artifact@v4
102
+ with:
103
+ name: pypi-linux-aarch64-gnu
104
+ path: target/wheels/*.whl
105
+
106
+ build-macos-x86:
107
+ runs-on: macos-15-intel
108
+ permissions:
109
+ contents: read
110
+ env:
111
+ TARGET: x86_64-apple-darwin
112
+ defaults:
113
+ run:
114
+ shell: bash
115
+ steps:
116
+ - name: Checkout
117
+ uses: actions/checkout@v4
118
+
119
+ - name: Install Rust
120
+ uses: dtolnay/rust-toolchain@stable
121
+
122
+ - name: Setup Python
123
+ uses: actions/setup-python@v5
124
+ with:
125
+ python-version: ${{ env.BUILD_PYTHON_VERSION }}
126
+
127
+ - name: Test Rust
128
+ run: cargo test --target x86_64-apple-darwin --lib --tests --bins
129
+
130
+ - name: Build wheel
131
+ run: |
132
+ python -m pip install --upgrade pip maturin
133
+ maturin build --release --locked --target x86_64-apple-darwin
134
+
135
+ - name: Upload wheels
136
+ uses: actions/upload-artifact@v4
137
+ with:
138
+ name: pypi-macos-x86_64
139
+ path: target/wheels/*.whl
140
+
141
+ build-macos-arm:
142
+ runs-on: macos-latest
143
+ permissions:
144
+ contents: read
145
+ env:
146
+ TARGET: aarch64-apple-darwin
147
+ defaults:
148
+ run:
149
+ shell: bash
150
+ steps:
151
+ - name: Checkout
152
+ uses: actions/checkout@v4
153
+
154
+ - name: Install Rust
155
+ uses: dtolnay/rust-toolchain@stable
156
+
157
+ - name: Setup Python
158
+ uses: actions/setup-python@v5
159
+ with:
160
+ python-version: ${{ env.BUILD_PYTHON_VERSION }}
161
+
162
+ - name: Test Rust
163
+ run: cargo test --target aarch64-apple-darwin --lib --tests --bins
164
+
165
+ - name: Build wheel
166
+ run: |
167
+ python -m pip install --upgrade pip maturin
168
+ maturin build --release --locked --target aarch64-apple-darwin
169
+
170
+ - name: Upload wheels
171
+ uses: actions/upload-artifact@v4
172
+ with:
173
+ name: pypi-macos-aarch64
174
+ path: target/wheels/*.whl
175
+
176
+ build-windows:
177
+ runs-on: windows-latest
178
+ permissions:
179
+ contents: read
180
+ defaults:
181
+ run:
182
+ shell: bash
183
+ steps:
184
+ - name: Checkout
185
+ uses: actions/checkout@v4
186
+
187
+ - name: Install Rust
188
+ uses: dtolnay/rust-toolchain@stable
189
+
190
+ - name: Setup Python
191
+ uses: actions/setup-python@v5
192
+ with:
193
+ python-version: ${{ env.BUILD_PYTHON_VERSION }}
194
+
195
+ - name: Test Rust
196
+ run: cargo test --target x86_64-pc-windows-msvc --lib --tests --bins
197
+
198
+ - name: Build wheel
199
+ run: |
200
+ python -m pip install --upgrade pip maturin
201
+ maturin build --release --locked --target x86_64-pc-windows-msvc
202
+
203
+ - name: Upload wheels
204
+ uses: actions/upload-artifact@v4
205
+ with:
206
+ name: pypi-windows-x86_64
207
+ path: target/wheels/*.whl
208
+
209
+ test-linux-x86:
210
+ runs-on: ubuntu-latest
211
+ needs: build-linux-x86
212
+ strategy:
213
+ fail-fast: false
214
+ matrix:
215
+ python-version: ['3.9', '3.14']
216
+ defaults:
217
+ run:
218
+ shell: bash
219
+ steps:
220
+ - name: Checkout
221
+ uses: actions/checkout@v4
222
+
223
+ - name: Setup Python
224
+ uses: actions/setup-python@v5
225
+ with:
226
+ python-version: ${{ matrix.python-version }}
227
+
228
+ - name: Download wheels
229
+ uses: actions/download-artifact@v4
230
+ with:
231
+ name: pypi-linux-x86_64-gnu
232
+ path: dist
233
+
234
+ - name: Install and test
235
+ run: |
236
+ python -m pip install --upgrade pip pytest
237
+ python -m pip install dist/*.whl
238
+ python -m pytest
239
+
240
+ test-linux-arm:
241
+ runs-on: ubuntu-24.04-arm
242
+ needs: build-linux-arm
243
+ strategy:
244
+ fail-fast: false
245
+ matrix:
246
+ python-version: ['3.9', '3.14']
247
+ defaults:
248
+ run:
249
+ shell: bash
250
+ steps:
251
+ - name: Checkout
252
+ uses: actions/checkout@v4
253
+
254
+ - name: Setup Python
255
+ uses: actions/setup-python@v5
256
+ with:
257
+ python-version: ${{ matrix.python-version }}
258
+
259
+ - name: Download wheels
260
+ uses: actions/download-artifact@v4
261
+ with:
262
+ name: pypi-linux-aarch64-gnu
263
+ path: dist
264
+
265
+ - name: Install and test
266
+ run: |
267
+ python -m pip install --upgrade pip pytest
268
+ python -m pip install dist/*.whl
269
+ python -m pytest
270
+
271
+ test-macos-x86:
272
+ runs-on: macos-15-intel
273
+ needs: build-macos-x86
274
+ strategy:
275
+ fail-fast: false
276
+ matrix:
277
+ python-version: ['3.9', '3.14']
278
+ defaults:
279
+ run:
280
+ shell: bash
281
+ steps:
282
+ - name: Checkout
283
+ uses: actions/checkout@v4
284
+
285
+ - name: Setup Python
286
+ uses: actions/setup-python@v5
287
+ with:
288
+ python-version: ${{ matrix.python-version }}
289
+
290
+ - name: Download wheels
291
+ uses: actions/download-artifact@v4
292
+ with:
293
+ name: pypi-macos-x86_64
294
+ path: dist
295
+
296
+ - name: Install and test
297
+ run: |
298
+ python -m pip install --upgrade pip pytest
299
+ python -m pip install dist/*.whl
300
+ python -m pytest
301
+
302
+ test-macos-arm:
303
+ runs-on: macos-latest
304
+ needs: build-macos-arm
305
+ strategy:
306
+ fail-fast: false
307
+ matrix:
308
+ python-version: ['3.9', '3.14']
309
+ defaults:
310
+ run:
311
+ shell: bash
312
+ steps:
313
+ - name: Checkout
314
+ uses: actions/checkout@v4
315
+
316
+ - name: Setup Python
317
+ uses: actions/setup-python@v5
318
+ with:
319
+ python-version: ${{ matrix.python-version }}
320
+
321
+ - name: Download wheels
322
+ uses: actions/download-artifact@v4
323
+ with:
324
+ name: pypi-macos-aarch64
325
+ path: dist
326
+
327
+ - name: Install and test
328
+ run: |
329
+ python -m pip install --upgrade pip pytest
330
+ python -m pip install dist/*.whl
331
+ python -m pytest
332
+
333
+ test-windows:
334
+ runs-on: windows-latest
335
+ needs: build-windows
336
+ strategy:
337
+ fail-fast: false
338
+ matrix:
339
+ python-version: ['3.9', '3.14']
340
+ defaults:
341
+ run:
342
+ shell: bash
343
+ steps:
344
+ - name: Checkout
345
+ uses: actions/checkout@v4
346
+
347
+ - name: Setup Python
348
+ uses: actions/setup-python@v5
349
+ with:
350
+ python-version: ${{ matrix.python-version }}
351
+
352
+ - name: Download wheels
353
+ uses: actions/download-artifact@v4
354
+ with:
355
+ name: pypi-windows-x86_64
356
+ path: dist
357
+
358
+ - name: Install and test
359
+ run: |
360
+ python -m pip install --upgrade pip pytest
361
+ python -m pip install dist/*.whl
362
+ python -m pytest
363
+
364
+ build-sdist:
365
+ name: Build sdist
366
+ runs-on: ubuntu-latest
367
+ permissions:
368
+ contents: read
369
+ defaults:
370
+ run:
371
+ shell: bash
372
+ steps:
373
+ - name: Checkout
374
+ uses: actions/checkout@v4
375
+
376
+ - name: Validate tag
377
+ run: |
378
+ tag="${GITHUB_REF_NAME}"
379
+ if ! [[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
380
+ echo "Tag $tag does not match v.x.y.z"
381
+ exit 1
382
+ fi
383
+ echo "VERSION=${tag#v}" >> "$GITHUB_ENV"
384
+
385
+ - name: Install Rust
386
+ uses: dtolnay/rust-toolchain@stable
387
+
388
+ - name: Setup Python
389
+ uses: actions/setup-python@v5
390
+ with:
391
+ python-version: '3.11'
392
+
393
+ - name: Build sdist
394
+ run: |
395
+ python -m pip install --upgrade pip maturin
396
+ maturin build --release --sdist
397
+
398
+ - name: Upload sdist
399
+ uses: actions/upload-artifact@v4
400
+ with:
401
+ name: pypi-sdist
402
+ path: target/wheels/*.tar.gz
403
+
404
+ publish-pypi:
405
+ name: Publish to PyPI
406
+ runs-on: ubuntu-latest
407
+ needs:
408
+ - build-linux-x86
409
+ - build-linux-arm
410
+ - build-macos-x86
411
+ - build-macos-arm
412
+ - build-windows
413
+ - test-linux-x86
414
+ - test-linux-arm
415
+ - test-macos-x86
416
+ - test-macos-arm
417
+ - test-windows
418
+ - build-sdist
419
+ permissions:
420
+ contents: read
421
+ id-token: write
422
+ steps:
423
+ - name: Checkout
424
+ uses: actions/checkout@v4
425
+
426
+ - name: Validate PyPI version matches tag
427
+ run: |
428
+ tag="${GITHUB_REF_NAME}"
429
+ if ! [[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
430
+ echo "Tag $tag does not match v.x.y.z"
431
+ exit 1
432
+ fi
433
+ version="${tag#v}"
434
+ py_version="$(awk -F' = ' '
435
+ $0=="[project]"{in_project=1;next}
436
+ /^\[/{if(in_project)exit}
437
+ in_project && $1=="version"{gsub(/"/,"",$2);print $2;exit}
438
+ ' pyproject.toml)"
439
+ if [ -z "$py_version" ]; then
440
+ echo "version not found in pyproject.toml"
441
+ exit 1
442
+ fi
443
+ if [ "$py_version" != "$version" ]; then
444
+ echo "pyproject.toml version $py_version does not match tag $version"
445
+ exit 1
446
+ fi
447
+
448
+ - name: Download artifacts
449
+ uses: actions/download-artifact@v4
450
+ with:
451
+ pattern: pypi-*
452
+ path: dist
453
+ merge-multiple: true
454
+
455
+ - name: Publish via Trusted Publisher
456
+ uses: pypa/gh-action-pypi-publish@release/v1
457
+ with:
458
+ packages-dir: dist
459
+ skip-existing: true
460
+
461
+ create-github-release:
462
+ name: Create GitHub release
463
+ runs-on: ubuntu-latest
464
+ needs:
465
+ - build-linux-x86
466
+ - build-linux-arm
467
+ - build-macos-x86
468
+ - build-macos-arm
469
+ - build-windows
470
+ - test-linux-x86
471
+ - test-linux-arm
472
+ - test-macos-x86
473
+ - test-macos-arm
474
+ - test-windows
475
+ - build-sdist
476
+ permissions:
477
+ contents: write
478
+ steps:
479
+ - name: Download artifacts
480
+ uses: actions/download-artifact@v4
481
+ with:
482
+ pattern: pypi-*
483
+ path: dist
484
+ merge-multiple: true
485
+
486
+ - name: Create release
487
+ uses: softprops/action-gh-release@v2
488
+ with:
489
+ files: dist/*
490
+ generate_release_notes: true
491
+
492
+ publish-crates:
493
+ name: Publish to crates.io
494
+ runs-on: ubuntu-latest
495
+ needs:
496
+ - test-linux-x86
497
+ - test-linux-arm
498
+ - test-macos-x86
499
+ - test-macos-arm
500
+ - test-windows
501
+ permissions:
502
+ contents: read
503
+ defaults:
504
+ run:
505
+ shell: bash
506
+ steps:
507
+ - name: Checkout
508
+ uses: actions/checkout@v4
509
+
510
+ - name: Validate tag and Cargo version
511
+ run: |
512
+ tag="${GITHUB_REF_NAME}"
513
+ if ! [[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
514
+ echo "Tag $tag does not match v.x.y.z"
515
+ exit 1
516
+ fi
517
+ version="${tag#v}"
518
+ cargo_version="$(awk -F' = ' '
519
+ $0=="[package]"{in_pkg=1;next}
520
+ /^\[/{if(in_pkg)exit}
521
+ in_pkg && $1=="version"{gsub(/"/,"",$2);print $2;exit}
522
+ ' Cargo.toml)"
523
+ if [ -z "$cargo_version" ]; then
524
+ echo "version not found in Cargo.toml [package]"
525
+ exit 1
526
+ fi
527
+ if [ "$cargo_version" != "$version" ]; then
528
+ echo "Cargo.toml version $cargo_version does not match tag $version"
529
+ exit 1
530
+ fi
531
+ echo "VERSION=$version" >> "$GITHUB_ENV"
532
+
533
+ - name: Install Rust
534
+ uses: dtolnay/rust-toolchain@stable
535
+
536
+ - name: Setup Python
537
+ uses: actions/setup-python@v5
538
+ with:
539
+ python-version: '3.11'
540
+
541
+ - name: Publish to crates.io
542
+ env:
543
+ CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
544
+ run: cargo publish --locked