siderust 0.2.1__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 (45) hide show
  1. siderust-0.2.1/.github/workflows/ci.yml +244 -0
  2. siderust-0.2.1/.github/workflows/release.yml +263 -0
  3. siderust-0.2.1/.gitignore +58 -0
  4. siderust-0.2.1/CHANGELOG.md +49 -0
  5. siderust-0.2.1/Cargo.lock +948 -0
  6. siderust-0.2.1/Cargo.toml +22 -0
  7. siderust-0.2.1/LICENSE +661 -0
  8. siderust-0.2.1/PKG-INFO +314 -0
  9. siderust-0.2.1/README.md +286 -0
  10. siderust-0.2.1/doc/developers/interop.md +115 -0
  11. siderust-0.2.1/examples/01_basic_coordinates.py +147 -0
  12. siderust-0.2.1/examples/02_coordinate_transformations.py +196 -0
  13. siderust-0.2.1/examples/03_all_frames_conversions.py +71 -0
  14. siderust-0.2.1/examples/04_all_center_conversions.py +94 -0
  15. siderust-0.2.1/examples/05_target_tracking.py +208 -0
  16. siderust-0.2.1/examples/06_night_events.py +116 -0
  17. siderust-0.2.1/examples/07_moon_properties.py +65 -0
  18. siderust-0.2.1/examples/08_solar_system.py +108 -0
  19. siderust-0.2.1/examples/09_star_observability.py +71 -0
  20. siderust-0.2.1/examples/10_time_periods.py +177 -0
  21. siderust-0.2.1/examples/11_serialization.py +277 -0
  22. siderust-0.2.1/examples/12_runtime_ephemeris.py +134 -0
  23. siderust-0.2.1/examples/13_coordinate_operations.py +179 -0
  24. siderust-0.2.1/pyproject.toml +62 -0
  25. siderust-0.2.1/python/siderust/__init__.py +97 -0
  26. siderust-0.2.1/scripts/ci.sh +48 -0
  27. siderust-0.2.1/scripts/publish-release.sh +170 -0
  28. siderust-0.2.1/scripts/test-publish-release-policy.sh +58 -0
  29. siderust-0.2.1/scripts/test_interop_contract.py +40 -0
  30. siderust-0.2.1/src/bodies.rs +367 -0
  31. siderust-0.2.1/src/coordinates.rs +182 -0
  32. siderust-0.2.1/src/ephemeris.rs +131 -0
  33. siderust-0.2.1/src/errors.rs +23 -0
  34. siderust-0.2.1/src/events.rs +188 -0
  35. siderust-0.2.1/src/interop.rs +206 -0
  36. siderust-0.2.1/src/lib.rs +110 -0
  37. siderust-0.2.1/src/observer.rs +189 -0
  38. siderust-0.2.1/src/orbit.rs +367 -0
  39. siderust-0.2.1/src/phase.rs +281 -0
  40. siderust-0.2.1/src/position.rs +791 -0
  41. siderust-0.2.1/src/queries.rs +322 -0
  42. siderust-0.2.1/src/star.rs +232 -0
  43. siderust-0.2.1/src/target.rs +357 -0
  44. siderust-0.2.1/tests/test_api.py +426 -0
  45. siderust-0.2.1/tests/test_interop.py +68 -0
@@ -0,0 +1,244 @@
1
+ name: Siderust Python CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ pull_request:
7
+ types: [opened, synchronize, reopened, ready_for_review]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ env:
17
+ CARGO_TERM_COLOR: always
18
+ PACKAGE_NAME: siderust
19
+ MATURIN_VERSION: v1.15.0
20
+
21
+ jobs:
22
+ fmt:
23
+ name: Format
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@v7.0.1
27
+ with:
28
+ fetch-depth: 0
29
+ - uses: dtolnay/rust-toolchain@stable
30
+ with:
31
+ components: rustfmt
32
+ - uses: actions/setup-python@v7.0.0
33
+ with:
34
+ python-version: "3.14"
35
+ cache: pip
36
+ - name: Install formatter
37
+ run: python -m pip install --upgrade pip ruff
38
+ - name: Check Rust formatting
39
+ run: |
40
+ cargo fmt --all -- --check
41
+ cargo fmt --manifest-path tests/interop_consumer/Cargo.toml -- --check
42
+ - name: Check Python formatting
43
+ run: python -m ruff format --check python tests examples scripts
44
+
45
+ lint:
46
+ name: Lint
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - uses: actions/checkout@v7.0.1
50
+ with:
51
+ fetch-depth: 0
52
+ - uses: dtolnay/rust-toolchain@stable
53
+ with:
54
+ components: clippy
55
+ - uses: Swatinem/rust-cache@v2
56
+ - uses: actions/setup-python@v7.0.0
57
+ with:
58
+ python-version: "3.14"
59
+ cache: pip
60
+ - name: Install linters
61
+ run: python -m pip install --upgrade pip ruff
62
+ - name: Run clippy
63
+ run: |
64
+ cargo clippy --all-targets --all-features -- -D warnings
65
+ cargo clippy --manifest-path tests/interop_consumer/Cargo.toml --all-targets -- -D warnings
66
+ - name: Run ruff
67
+ run: python -m ruff check python tests examples scripts
68
+
69
+ rust-test:
70
+ name: Rust Test
71
+ runs-on: ubuntu-latest
72
+ steps:
73
+ - uses: actions/checkout@v7.0.1
74
+ with:
75
+ fetch-depth: 0
76
+ - uses: dtolnay/rust-toolchain@stable
77
+ - uses: Swatinem/rust-cache@v2
78
+ - name: Run Rust tests
79
+ run: cargo test --all-targets
80
+
81
+ crates-package:
82
+ name: crates.io Package Validation
83
+ runs-on: ubuntu-latest
84
+ steps:
85
+ - uses: actions/checkout@v7.0.1
86
+ with:
87
+ fetch-depth: 0
88
+ - uses: dtolnay/rust-toolchain@stable
89
+ with:
90
+ components: rustfmt, clippy
91
+ - uses: Swatinem/rust-cache@v2
92
+ - uses: actions/setup-python@v7.0.0
93
+ with:
94
+ python-version: "3.14"
95
+ - name: Test release policy guards
96
+ run: bash scripts/test-publish-release-policy.sh
97
+ - name: Validate packaged crate and publish dry-run
98
+ run: bash scripts/publish-release.sh --dry-run
99
+
100
+ bridge-contract:
101
+ name: Bridge Contract (${{ matrix.os }})
102
+ runs-on: ${{ matrix.os }}
103
+ strategy:
104
+ fail-fast: false
105
+ matrix:
106
+ os: [ubuntu-latest, macos-latest, windows-latest]
107
+ steps:
108
+ - uses: actions/checkout@v7.0.1
109
+ with:
110
+ fetch-depth: 0
111
+ - uses: dtolnay/rust-toolchain@stable
112
+ - uses: Swatinem/rust-cache@v2
113
+ - uses: actions/setup-python@v7.0.0
114
+ with:
115
+ python-version: "3.14"
116
+ cache: pip
117
+ - name: Build extensions and run bridge contract
118
+ run: python scripts/test_interop_contract.py
119
+
120
+ python-test:
121
+ name: Python Test (3.${{ matrix.python-minor }})
122
+ runs-on: ubuntu-latest
123
+ strategy:
124
+ fail-fast: false
125
+ matrix:
126
+ python-minor: ["8", "9", "10", "11", "12", "13", "14"]
127
+ steps:
128
+ - uses: actions/checkout@v7.0.1
129
+ with:
130
+ fetch-depth: 0
131
+ - uses: dtolnay/rust-toolchain@stable
132
+ - uses: Swatinem/rust-cache@v2
133
+ - name: Set up Python 3.${{ matrix.python-minor }}
134
+ uses: actions/setup-python@v7.0.0
135
+ with:
136
+ python-version: "3.${{ matrix.python-minor }}"
137
+ cache: pip
138
+ - name: Install test dependencies
139
+ run: |
140
+ python -m pip install --upgrade pip
141
+ python -m pip install pytest
142
+ python -m pip install .
143
+ python -m pip install ./tests/interop_consumer
144
+ - name: Run Python tests
145
+ run: |
146
+ tmpdir="$(mktemp -d)"
147
+ cd "$tmpdir"
148
+ python -m pytest --rootdir "$GITHUB_WORKSPACE" "$GITHUB_WORKSPACE/tests"
149
+
150
+ distribution-package:
151
+ name: PyPI Distribution Validation
152
+ runs-on: ubuntu-24.04
153
+ steps:
154
+ - uses: actions/checkout@v7.0.1
155
+ with:
156
+ fetch-depth: 0
157
+
158
+ - uses: actions/setup-python@v7.0.0
159
+ with:
160
+ python-version: "3.14"
161
+
162
+ - name: Install wheel test dependencies
163
+ run: python -m pip install --upgrade pip pytest
164
+
165
+ - name: Build PyPI-compatible wheel
166
+ uses: PyO3/maturin-action@v1.51.0
167
+ with:
168
+ command: build
169
+ maturin-version: ${{ env.MATURIN_VERSION }}
170
+ manylinux: "2_28"
171
+ args: >-
172
+ --release
173
+ --compatibility pypi
174
+ --out dist
175
+ -i python3.14
176
+
177
+ - name: Install built wheel
178
+ run: python -m pip install --force-reinstall dist/*.whl
179
+
180
+ - name: Test installed wheel
181
+ run: |
182
+ tmpdir="$(mktemp -d)"
183
+ cd "$tmpdir"
184
+ python -m pytest --rootdir "$GITHUB_WORKSPACE" "$GITHUB_WORKSPACE/tests/test_api.py"
185
+
186
+ - name: Build source distribution
187
+ uses: PyO3/maturin-action@v1.51.0
188
+ with:
189
+ command: sdist
190
+ maturin-version: ${{ env.MATURIN_VERSION }}
191
+ args: --out dist
192
+
193
+ - uses: actions/upload-artifact@v7.0.1
194
+ with:
195
+ name: siderust-release-package
196
+ path: |
197
+ dist/*.whl
198
+ dist/*.tar.gz
199
+ if-no-files-found: error
200
+ retention-days: 7
201
+
202
+ coverage:
203
+ name: Coverage
204
+ if: ${{ github.event_name == 'push' || github.event.pull_request.draft == false }}
205
+ runs-on: ubuntu-latest
206
+ steps:
207
+ - uses: actions/checkout@v7.0.1
208
+ with:
209
+ fetch-depth: 0
210
+ - uses: dtolnay/rust-toolchain@stable
211
+ - uses: Swatinem/rust-cache@v2
212
+ - uses: actions/setup-python@v7.0.0
213
+ with:
214
+ python-version: "3.14"
215
+ cache: pip
216
+ - name: Install coverage dependencies
217
+ run: |
218
+ python -m pip install --upgrade pip
219
+ python -m pip install pytest pytest-cov
220
+ python -m pip install .
221
+ python -m pip install ./tests/interop_consumer
222
+ - name: Run coverage
223
+ run: |
224
+ rm -f coverage.xml
225
+ rm -rf htmlcov
226
+ tmpdir="$(mktemp -d)"
227
+ cd "$tmpdir"
228
+ python -m pytest \
229
+ --rootdir "$GITHUB_WORKSPACE" \
230
+ --cov="${PACKAGE_NAME}" \
231
+ --cov-branch \
232
+ --cov-report=term-missing \
233
+ --cov-report=xml:"$GITHUB_WORKSPACE/coverage.xml" \
234
+ --cov-report=html:"$GITHUB_WORKSPACE/htmlcov" \
235
+ "$GITHUB_WORKSPACE/tests"
236
+ - name: Upload coverage artifacts
237
+ if: always()
238
+ uses: actions/upload-artifact@v7.0.1
239
+ with:
240
+ name: siderust-coverage
241
+ path: |
242
+ coverage.xml
243
+ htmlcov
244
+ retention-days: 7
@@ -0,0 +1,263 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v[0-9]*"
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ concurrency:
12
+ group: release-${{ github.ref }}
13
+ cancel-in-progress: false
14
+
15
+ env:
16
+ MATURIN_VERSION: v1.15.0
17
+
18
+ jobs:
19
+ validate:
20
+ name: Validate release
21
+ runs-on: ubuntu-24.04
22
+ steps:
23
+ - uses: actions/checkout@v7.0.1
24
+ with:
25
+ fetch-depth: 0
26
+
27
+ - uses: actions/setup-python@v7.0.0
28
+ with:
29
+ python-version: "3.14"
30
+
31
+ - uses: dtolnay/rust-toolchain@stable
32
+
33
+ - name: Verify tag and package metadata
34
+ shell: python
35
+ run: |
36
+ import os
37
+ import re
38
+ import tomllib
39
+ from pathlib import Path
40
+
41
+ tag = os.environ["GITHUB_REF_NAME"]
42
+ if not re.fullmatch(r"v\d+\.\d+\.\d+", tag):
43
+ raise SystemExit(f"release tag must be vMAJOR.MINOR.PATCH, got {tag!r}")
44
+
45
+ pyproject = tomllib.loads(Path("pyproject.toml").read_text())
46
+ cargo = tomllib.loads(Path("Cargo.toml").read_text())
47
+
48
+ python_name = pyproject["project"]["name"]
49
+ python_version = pyproject["project"]["version"]
50
+ cargo_version = cargo["package"]["version"]
51
+
52
+ if python_name != "siderust":
53
+ raise SystemExit(
54
+ f"expected PyPI project name 'siderust', got {python_name!r}"
55
+ )
56
+ if python_version != cargo_version:
57
+ raise SystemExit(
58
+ f"version mismatch: pyproject.toml={python_version}, Cargo.toml={cargo_version}"
59
+ )
60
+ if tag != f"v{python_version}":
61
+ raise SystemExit(
62
+ f"tag {tag!r} does not match package version v{python_version}"
63
+ )
64
+
65
+ - name: Validate crate release package
66
+ run: bash scripts/publish-release.sh --dry-run --tag "${GITHUB_REF_NAME}"
67
+
68
+ linux-wheels:
69
+ name: Linux wheels (${{ matrix.arch }})
70
+ needs: validate
71
+ strategy:
72
+ fail-fast: false
73
+ matrix:
74
+ include:
75
+ - runner: ubuntu-24.04
76
+ arch: x86_64
77
+ target: x86_64-unknown-linux-gnu
78
+ - runner: ubuntu-24.04-arm
79
+ arch: aarch64
80
+ target: aarch64-unknown-linux-gnu
81
+ runs-on: ${{ matrix.runner }}
82
+ steps:
83
+ - uses: actions/checkout@v7.0.1
84
+
85
+ - name: Build wheels
86
+ uses: PyO3/maturin-action@v1.51.0
87
+ with:
88
+ command: build
89
+ maturin-version: ${{ env.MATURIN_VERSION }}
90
+ target: ${{ matrix.target }}
91
+ manylinux: "2_28"
92
+ args: >-
93
+ --release
94
+ --compatibility pypi
95
+ --out dist
96
+ -i python3.8
97
+ -i python3.9
98
+ -i python3.10
99
+ -i python3.11
100
+ -i python3.12
101
+ -i python3.13
102
+ -i python3.14
103
+
104
+ - uses: actions/upload-artifact@v7.0.1
105
+ with:
106
+ name: wheels-linux-${{ matrix.arch }}
107
+ path: dist/*.whl
108
+ if-no-files-found: error
109
+
110
+ macos-wheels:
111
+ name: macOS wheels (${{ matrix.arch }})
112
+ needs: validate
113
+ strategy:
114
+ fail-fast: false
115
+ matrix:
116
+ include:
117
+ - runner: macos-15-intel
118
+ arch: x86_64
119
+ python_versions: |
120
+ 3.8
121
+ 3.9
122
+ 3.10
123
+ 3.11
124
+ 3.12
125
+ 3.13
126
+ 3.14
127
+ - runner: macos-15
128
+ arch: aarch64
129
+ python_versions: |
130
+ 3.11
131
+ 3.12
132
+ 3.13
133
+ 3.14
134
+ runs-on: ${{ matrix.runner }}
135
+ steps:
136
+ - uses: actions/checkout@v7.0.1
137
+
138
+ - uses: actions/setup-python@v7.0.0
139
+ with:
140
+ python-version: ${{ matrix.python_versions }}
141
+
142
+ - name: Build wheels
143
+ uses: PyO3/maturin-action@v1.51.0
144
+ with:
145
+ command: build
146
+ maturin-version: ${{ env.MATURIN_VERSION }}
147
+ args: >-
148
+ --release
149
+ --compatibility pypi
150
+ --out dist
151
+ --find-interpreter
152
+
153
+ - uses: actions/upload-artifact@v7.0.1
154
+ with:
155
+ name: wheels-macos-${{ matrix.arch }}
156
+ path: dist/*.whl
157
+ if-no-files-found: error
158
+
159
+ windows-wheels:
160
+ name: Windows wheels (x86_64)
161
+ needs: validate
162
+ runs-on: windows-2025
163
+ steps:
164
+ - uses: actions/checkout@v7.0.1
165
+
166
+ - uses: actions/setup-python@v7.0.0
167
+ with:
168
+ python-version: |
169
+ 3.8
170
+ 3.9
171
+ 3.10
172
+ 3.11
173
+ 3.12
174
+ 3.13
175
+ 3.14
176
+
177
+ - name: Build wheels
178
+ uses: PyO3/maturin-action@v1.51.0
179
+ with:
180
+ command: build
181
+ maturin-version: ${{ env.MATURIN_VERSION }}
182
+ args: >-
183
+ --release
184
+ --compatibility pypi
185
+ --out dist
186
+ --find-interpreter
187
+
188
+ - uses: actions/upload-artifact@v7.0.1
189
+ with:
190
+ name: wheels-windows-x86_64
191
+ path: dist/*.whl
192
+ if-no-files-found: error
193
+
194
+ sdist:
195
+ name: Source distribution
196
+ needs: validate
197
+ runs-on: ubuntu-24.04
198
+ steps:
199
+ - uses: actions/checkout@v7.0.1
200
+
201
+ - name: Build sdist
202
+ uses: PyO3/maturin-action@v1.51.0
203
+ with:
204
+ command: sdist
205
+ maturin-version: ${{ env.MATURIN_VERSION }}
206
+ args: --out dist
207
+
208
+ - uses: actions/upload-artifact@v7.0.1
209
+ with:
210
+ name: sdist
211
+ path: dist/*.tar.gz
212
+ if-no-files-found: error
213
+
214
+ publish-pypi:
215
+ name: Publish to PyPI
216
+ needs:
217
+ - linux-wheels
218
+ - macos-wheels
219
+ - windows-wheels
220
+ - sdist
221
+ runs-on: ubuntu-24.04
222
+ environment:
223
+ name: pypi
224
+ permissions:
225
+ contents: read
226
+ id-token: write
227
+ steps:
228
+ - uses: actions/download-artifact@v8.0.1
229
+ with:
230
+ path: dist
231
+ merge-multiple: true
232
+
233
+ - name: Show release artifacts
234
+ run: ls -lah dist
235
+
236
+ - name: Publish Python distribution
237
+ uses: pypa/gh-action-pypi-publish@v1.14.2
238
+
239
+ publish-crates:
240
+ name: Publish to crates.io if missing
241
+ needs:
242
+ - linux-wheels
243
+ - macos-wheels
244
+ - windows-wheels
245
+ - sdist
246
+ runs-on: ubuntu-24.04
247
+ steps:
248
+ - uses: actions/checkout@v7.0.1
249
+ with:
250
+ fetch-depth: 0
251
+
252
+ - uses: dtolnay/rust-toolchain@stable
253
+ with:
254
+ components: rustfmt, clippy
255
+
256
+ - uses: actions/setup-python@v7.0.0
257
+ with:
258
+ python-version: "3.14"
259
+
260
+ - name: Publish crate or skip existing version
261
+ run: bash scripts/publish-release.sh --tag "${GITHUB_REF_NAME}"
262
+ env:
263
+ CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
@@ -0,0 +1,58 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+ MANIFEST
23
+ venv/
24
+ ENV/
25
+ env/
26
+
27
+ # Rust
28
+ /target/
29
+ **/target/
30
+ **/*.rs.bk
31
+ Cargo.lock
32
+
33
+ # PyO3/maturin
34
+ *.so
35
+ *.pyd
36
+ *.dylib
37
+
38
+ # IDE
39
+ .vscode/
40
+ .idea/
41
+ *.swp
42
+ *.swo
43
+ *~
44
+
45
+ # Testing
46
+ .pytest_cache/
47
+ .coverage
48
+ .coverage.*
49
+ .ruff_cache/
50
+ coverage.xml
51
+ htmlcov/
52
+ .tox/
53
+
54
+ # OS
55
+ .DS_Store
56
+ Thumbs.db
57
+
58
+ .venv/
@@ -0,0 +1,49 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.1] - 2026-10-04
9
+
10
+ ### Added
11
+
12
+ - Added automated PyPI publishing through GitHub Actions and PyPI Trusted Publishing/OIDC.
13
+ - Added cross-platform release wheels for Linux x86_64/aarch64, macOS x86_64/arm64, and Windows x86_64, plus a source distribution.
14
+ - Added CI validation of built Python distribution artifacts before release tags are created.
15
+ - Added declared and tested CPython 3.13 and 3.14 support.
16
+
17
+ ### Changed
18
+
19
+ - Consolidated tag-driven PyPI and crates.io publication into a single release workflow.
20
+ - Kept crates.io publication idempotent: an already-published crate version is detected and skipped instead of failing the release.
21
+
22
+ ## [0.2.0] - 2026-10-04
23
+
24
+ ### Added
25
+
26
+ - Added `rlib` output alongside the Python `cdylib` so downstream Rust/PyO3
27
+ crates can depend on `siderust-py`.
28
+ - Added the public `siderust_py::interop` API for converting Observer and
29
+ Direction values across independently compiled Python extensions.
30
+ - Added a versioned, primitive-only bridge protocol that preserves canonical
31
+ Python type identity across extension boundaries.
32
+ - Added independent downstream-consumer and bridge-contract tests for the
33
+ Observer/Direction interoperability surface.
34
+
35
+ ### Changed
36
+
37
+ - Updated the bindings to Siderust 0.12.x and affn 0.10.x.
38
+ - Aligned the extension and downstream consumer with PyO3 0.29.x.
39
+ - Kept Rust and Python package version metadata synchronized at 0.2.0.
40
+
41
+ ### Removed
42
+
43
+ - Removed the legacy Siderust submodule and obsolete dependency overrides.
44
+
45
+ ## [0.1.0] - 2026-03-07
46
+
47
+ ### Added
48
+
49
+ - Initial `siderust` Python bindings backed by the Siderust Rust library.