tempoch 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.
@@ -0,0 +1,245 @@
1
+ name: Tempoch 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: tempoch
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 --check
41
+ cargo fmt --manifest-path tests/fixtures/downstream-extension/Cargo.toml --check
42
+ - name: Check Python formatting
43
+ run: python -m ruff format --check python tests examples
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 -- -D warnings
65
+ cargo clippy --manifest-path tests/fixtures/downstream-extension/Cargo.toml -- -D warnings
66
+ - name: Run ruff
67
+ run: python -m ruff check python tests examples
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
+ - uses: actions/setup-python@v7.0.0
79
+ with:
80
+ python-version: "3.14"
81
+ - name: Run Rust tests
82
+ run: cargo test --all-targets
83
+
84
+ python-test:
85
+ name: Python Test (3.${{ matrix.python-minor }})
86
+ runs-on: ubuntu-latest
87
+ strategy:
88
+ fail-fast: false
89
+ matrix:
90
+ python-minor: ["8", "9", "10", "11", "12", "13", "14"]
91
+ steps:
92
+ - uses: actions/checkout@v7.0.1
93
+ with:
94
+ fetch-depth: 0
95
+ - uses: dtolnay/rust-toolchain@stable
96
+ - uses: Swatinem/rust-cache@v2
97
+ - name: Set up Python 3.${{ matrix.python-minor }}
98
+ uses: actions/setup-python@v7.0.0
99
+ with:
100
+ python-version: "3.${{ matrix.python-minor }}"
101
+ cache: pip
102
+ - name: Install test dependencies
103
+ run: |
104
+ python -m pip install --upgrade pip
105
+ python -m pip install pytest
106
+ python -m pip install .
107
+ - name: Run Python tests
108
+ run: |
109
+ tmpdir="$(mktemp -d)"
110
+ cd "$tmpdir"
111
+ python -m pytest --rootdir "$GITHUB_WORKSPACE" "$GITHUB_WORKSPACE/tests"
112
+
113
+ coverage:
114
+ name: Coverage
115
+ if: ${{ github.event_name == 'push' || github.event.pull_request.draft == false }}
116
+ runs-on: ubuntu-latest
117
+ steps:
118
+ - uses: actions/checkout@v7.0.1
119
+ with:
120
+ fetch-depth: 0
121
+ - uses: dtolnay/rust-toolchain@stable
122
+ - uses: Swatinem/rust-cache@v2
123
+ - uses: actions/setup-python@v7.0.0
124
+ with:
125
+ python-version: "3.14"
126
+ cache: pip
127
+ - name: Install coverage dependencies
128
+ run: |
129
+ python -m pip install --upgrade pip
130
+ python -m pip install pytest pytest-cov
131
+ python -m pip install .
132
+ - name: Run coverage
133
+ run: |
134
+ rm -f coverage.xml
135
+ rm -rf htmlcov
136
+ tmpdir="$(mktemp -d)"
137
+ cd "$tmpdir"
138
+ python -m pytest \
139
+ --rootdir "$GITHUB_WORKSPACE" \
140
+ --cov="${PACKAGE_NAME}" \
141
+ --cov-branch \
142
+ --cov-report=term-missing \
143
+ --cov-report=xml:"$GITHUB_WORKSPACE/coverage.xml" \
144
+ --cov-report=html:"$GITHUB_WORKSPACE/htmlcov" \
145
+ "$GITHUB_WORKSPACE/tests"
146
+ - name: Upload coverage artifacts
147
+ if: always()
148
+ uses: actions/upload-artifact@v7.0.1
149
+ with:
150
+ name: tempoch-coverage
151
+ path: |
152
+ coverage.xml
153
+ htmlcov
154
+ retention-days: 7
155
+
156
+ downstream-test:
157
+ name: Downstream PyO3 Consumption
158
+ runs-on: ubuntu-latest
159
+ steps:
160
+ - uses: actions/checkout@v7.0.1
161
+ with:
162
+ fetch-depth: 0
163
+ - uses: dtolnay/rust-toolchain@stable
164
+ - uses: Swatinem/rust-cache@v2
165
+ - uses: actions/setup-python@v7.0.0
166
+ with:
167
+ python-version: "3.14"
168
+ cache: pip
169
+ - name: Install packages
170
+ run: |
171
+ python -m pip install --upgrade pip
172
+ python -m pip install pytest
173
+ python -m pip install .
174
+ python -m pip install ./tests/fixtures/downstream-extension
175
+ - name: Exercise downstream extension
176
+ run: python -m pytest tests/test_downstream_fixture.py -v
177
+
178
+ crate-release-validation:
179
+ name: crates.io Package Validation
180
+ runs-on: ubuntu-latest
181
+ steps:
182
+ - uses: actions/checkout@v7.0.1
183
+ with:
184
+ fetch-depth: 0
185
+ - uses: dtolnay/rust-toolchain@stable
186
+ - uses: Swatinem/rust-cache@v2
187
+ - name: Run Rust doctests
188
+ run: cargo test --doc
189
+ - name: Validate crate package and publish dry-run
190
+ run: bash scripts/publish.sh --dry-run
191
+ - name: Validate packaged downstream consumer
192
+ run: bash scripts/check-packaged-downstream.sh
193
+
194
+ distribution-package:
195
+ name: PyPI Distribution Validation
196
+ runs-on: ubuntu-24.04
197
+ steps:
198
+ - uses: actions/checkout@v7.0.1
199
+ with:
200
+ fetch-depth: 0
201
+
202
+ - uses: actions/setup-python@v7.0.0
203
+ with:
204
+ python-version: "3.14"
205
+
206
+ - name: Install wheel test dependencies
207
+ run: python -m pip install --upgrade pip pytest
208
+
209
+ - name: Build PyPI-compatible wheel
210
+ uses: PyO3/maturin-action@v1.51.0
211
+ with:
212
+ command: build
213
+ maturin-version: ${{ env.MATURIN_VERSION }}
214
+ manylinux: "2_28"
215
+ args: >-
216
+ --release
217
+ --locked
218
+ --compatibility pypi
219
+ --out dist
220
+ -i python3.14
221
+
222
+ - name: Install built wheel
223
+ run: python -m pip install --force-reinstall dist/tempoch-*.whl
224
+
225
+ - name: Test installed wheel
226
+ run: |
227
+ tmpdir="$(mktemp -d)"
228
+ cd "$tmpdir"
229
+ python -m pytest --rootdir "$GITHUB_WORKSPACE" "$GITHUB_WORKSPACE/tests"
230
+
231
+ - name: Build source distribution
232
+ uses: PyO3/maturin-action@v1.51.0
233
+ with:
234
+ command: sdist
235
+ maturin-version: ${{ env.MATURIN_VERSION }}
236
+ args: --out dist
237
+
238
+ - uses: actions/upload-artifact@v7.0.1
239
+ with:
240
+ name: tempoch-release-package
241
+ path: |
242
+ dist/*.whl
243
+ dist/*.tar.gz
244
+ if-no-files-found: error
245
+ retention-days: 7
@@ -0,0 +1,224 @@
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: dtolnay/rust-toolchain@stable
28
+
29
+ - name: Validate tag, versions, and crate package
30
+ run: bash scripts/publish.sh --dry-run
31
+
32
+ linux-wheels:
33
+ name: Linux wheels (${{ matrix.arch }})
34
+ needs: validate
35
+ strategy:
36
+ fail-fast: false
37
+ matrix:
38
+ include:
39
+ - runner: ubuntu-24.04
40
+ arch: x86_64
41
+ target: x86_64-unknown-linux-gnu
42
+ - runner: ubuntu-24.04-arm
43
+ arch: aarch64
44
+ target: aarch64-unknown-linux-gnu
45
+ runs-on: ${{ matrix.runner }}
46
+ steps:
47
+ - uses: actions/checkout@v7.0.1
48
+
49
+ - name: Build wheels
50
+ uses: PyO3/maturin-action@v1.51.0
51
+ with:
52
+ command: build
53
+ maturin-version: ${{ env.MATURIN_VERSION }}
54
+ target: ${{ matrix.target }}
55
+ manylinux: "2_28"
56
+ args: >-
57
+ --release
58
+ --locked
59
+ --compatibility pypi
60
+ --out dist
61
+ -i python3.8
62
+ -i python3.9
63
+ -i python3.10
64
+ -i python3.11
65
+ -i python3.12
66
+ -i python3.13
67
+ -i python3.14
68
+
69
+ - uses: actions/upload-artifact@v7.0.1
70
+ with:
71
+ name: wheels-linux-${{ matrix.arch }}
72
+ path: dist/*.whl
73
+ if-no-files-found: error
74
+
75
+ macos-wheels:
76
+ name: macOS wheels (${{ matrix.arch }})
77
+ needs: validate
78
+ strategy:
79
+ fail-fast: false
80
+ matrix:
81
+ include:
82
+ - runner: macos-15-intel
83
+ arch: x86_64
84
+ python_versions: |
85
+ 3.8
86
+ 3.9
87
+ 3.10
88
+ 3.11
89
+ 3.12
90
+ 3.13
91
+ 3.14
92
+ - runner: macos-15
93
+ arch: aarch64
94
+ python_versions: |
95
+ 3.11
96
+ 3.12
97
+ 3.13
98
+ 3.14
99
+ runs-on: ${{ matrix.runner }}
100
+ steps:
101
+ - uses: actions/checkout@v7.0.1
102
+
103
+ - uses: actions/setup-python@v7.0.0
104
+ with:
105
+ python-version: ${{ matrix.python_versions }}
106
+
107
+ - name: Build wheels
108
+ uses: PyO3/maturin-action@v1.51.0
109
+ with:
110
+ command: build
111
+ maturin-version: ${{ env.MATURIN_VERSION }}
112
+ args: >-
113
+ --release
114
+ --locked
115
+ --compatibility pypi
116
+ --out dist
117
+ --find-interpreter
118
+
119
+ - uses: actions/upload-artifact@v7.0.1
120
+ with:
121
+ name: wheels-macos-${{ matrix.arch }}
122
+ path: dist/*.whl
123
+ if-no-files-found: error
124
+
125
+ windows-wheels:
126
+ name: Windows wheels (x86_64)
127
+ needs: validate
128
+ runs-on: windows-2025
129
+ steps:
130
+ - uses: actions/checkout@v7.0.1
131
+
132
+ - uses: actions/setup-python@v7.0.0
133
+ with:
134
+ python-version: |
135
+ 3.8
136
+ 3.9
137
+ 3.10
138
+ 3.11
139
+ 3.12
140
+ 3.13
141
+ 3.14
142
+
143
+ - name: Build wheels
144
+ uses: PyO3/maturin-action@v1.51.0
145
+ with:
146
+ command: build
147
+ maturin-version: ${{ env.MATURIN_VERSION }}
148
+ args: >-
149
+ --release
150
+ --locked
151
+ --compatibility pypi
152
+ --out dist
153
+ --find-interpreter
154
+
155
+ - uses: actions/upload-artifact@v7.0.1
156
+ with:
157
+ name: wheels-windows-x86_64
158
+ path: dist/*.whl
159
+ if-no-files-found: error
160
+
161
+ sdist:
162
+ name: Source distribution
163
+ needs: validate
164
+ runs-on: ubuntu-24.04
165
+ steps:
166
+ - uses: actions/checkout@v7.0.1
167
+
168
+ - name: Build sdist
169
+ uses: PyO3/maturin-action@v1.51.0
170
+ with:
171
+ command: sdist
172
+ maturin-version: ${{ env.MATURIN_VERSION }}
173
+ args: --out dist
174
+
175
+ - uses: actions/upload-artifact@v7.0.1
176
+ with:
177
+ name: sdist
178
+ path: dist/*.tar.gz
179
+ if-no-files-found: error
180
+
181
+ publish-pypi:
182
+ name: Publish to PyPI
183
+ needs:
184
+ - linux-wheels
185
+ - macos-wheels
186
+ - windows-wheels
187
+ - sdist
188
+ runs-on: ubuntu-24.04
189
+ environment:
190
+ name: pypi
191
+ permissions:
192
+ contents: read
193
+ id-token: write
194
+ steps:
195
+ - uses: actions/download-artifact@v8.0.1
196
+ with:
197
+ path: dist
198
+ merge-multiple: true
199
+
200
+ - name: Show release artifacts
201
+ run: ls -lah dist
202
+
203
+ - name: Publish Python distribution
204
+ uses: pypa/gh-action-pypi-publish@v1.14.2
205
+
206
+ publish-crates:
207
+ name: Publish to crates.io if missing
208
+ needs:
209
+ - linux-wheels
210
+ - macos-wheels
211
+ - windows-wheels
212
+ - sdist
213
+ runs-on: ubuntu-24.04
214
+ steps:
215
+ - uses: actions/checkout@v7.0.1
216
+ with:
217
+ fetch-depth: 0
218
+
219
+ - uses: dtolnay/rust-toolchain@stable
220
+
221
+ - name: Publish crate or skip existing version
222
+ run: bash scripts/publish.sh
223
+ env:
224
+ CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
@@ -0,0 +1,38 @@
1
+ # Generated by Cargo
2
+ # will have compiled files and executables
3
+ debug
4
+ target
5
+
6
+ # Python
7
+ __pycache__/
8
+ *.pyc
9
+ *.pyo
10
+ .venv/
11
+ *.egg-info/
12
+ dist/
13
+ .coverage
14
+ .coverage.*
15
+ .pytest_cache/
16
+ .ruff_cache/
17
+ coverage.xml
18
+ htmlcov/
19
+
20
+ # These are backup files generated by rustfmt
21
+ **/*.rs.bk
22
+
23
+ # MSVC Windows builds of rustc generate these, which store debugging information
24
+ *.pdb
25
+
26
+ # Generated by cargo mutants
27
+ # Contains mutation testing data
28
+ **/mutants.out*/
29
+
30
+ # Binary
31
+ *.so
32
+
33
+ # RustRover
34
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
35
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
36
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
37
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
38
+ #.idea/
@@ -0,0 +1,55 @@
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
+ ## [Unreleased]
9
+
10
+ ## [0.2.1] - 2026-10-04
11
+
12
+ ### Added
13
+
14
+ - Added automated PyPI publication through GitHub Actions and PyPI Trusted Publishing/OIDC.
15
+ - Added cross-platform release wheels for Linux x86_64/aarch64, macOS x86_64/arm64, and Windows x86_64, plus a source distribution.
16
+ - Added CI validation of built Python distribution artifacts before release tags are created.
17
+ - Added declared and tested CPython 3.13 and 3.14 support.
18
+
19
+ ### Changed
20
+
21
+ - Consolidated tag-driven PyPI and crates.io publication into a single release workflow.
22
+ - Kept crates.io publication idempotent: an already-published crate version is detected and skipped instead of failing the release.
23
+
24
+
25
+ ## [0.2.0] - 2026-10-04
26
+
27
+ ### Added
28
+
29
+ - Added `rlib` output alongside the Python extension `cdylib` so downstream Rust/PyO3 crates can reuse `tempoch-py`.
30
+ - Added the public `tempoch_py::interop` API for converting timezone-aware Python datetimes to `Time<UTC>` and converting `Time<UTC>` back to aware UTC Python datetimes.
31
+ - Added `Period<UTC>` endpoint conversion helpers and explicit `TimeContext` variants for context-dependent conversions.
32
+ - Added downstream PyO3 consumer integration coverage for the reusable Rust interop surface.
33
+ - Added tag-driven crates.io publication with release validation, dry-run support, and duplicate-version detection.
34
+
35
+ ### Changed
36
+
37
+ - Updated the Rust dependency to `tempoch` 0.7.x.
38
+ - Aligned the bindings and downstream integration surface with PyO3 0.29.x.
39
+ - Normalized timezone-aware Python datetimes with non-UTC offsets to UTC before conversion.
40
+ - Synchronized the Rust crate and Python distribution metadata at version 0.2.0.
41
+
42
+ ### Fixed
43
+
44
+ - Reject naive Python datetimes instead of silently assigning timezone semantics.
45
+
46
+ ### Removed
47
+
48
+ - Removed the stale embedded tempoch submodule in favor of the published `tempoch` crate.
49
+
50
+ ## [0.1.0] - 2026-03-07
51
+
52
+ ### Added
53
+
54
+ - Initial `tempoch` Python bindings for Julian Date, Modified Julian Date, astronomical time-scale conversion, and time periods.
55
+ - Initial Rust-backed Python package, examples, tests, and CI coverage.