fasttime-rs 0.3.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.
- fasttime_rs-0.3.0/.github/workflows/publish-crates.yml +39 -0
- fasttime_rs-0.3.0/.github/workflows/publish-pypi.yml +243 -0
- fasttime_rs-0.3.0/.github/workflows/test.yml +65 -0
- fasttime_rs-0.3.0/.gitignore +15 -0
- fasttime_rs-0.3.0/Cargo.lock +720 -0
- fasttime_rs-0.3.0/Cargo.toml +31 -0
- fasttime_rs-0.3.0/LICENSE +202 -0
- fasttime_rs-0.3.0/PKG-INFO +312 -0
- fasttime_rs-0.3.0/README.md +138 -0
- fasttime_rs-0.3.0/benches/unix_timestamp.rs +121 -0
- fasttime_rs-0.3.0/benchmark.png +0 -0
- fasttime_rs-0.3.0/pyproject.toml +36 -0
- fasttime_rs-0.3.0/python/README.md +286 -0
- fasttime_rs-0.3.0/python/examples/basic_usage.py +122 -0
- fasttime_rs-0.3.0/python/examples/durations.py +155 -0
- fasttime_rs-0.3.0/python/examples/parsing.py +130 -0
- fasttime_rs-0.3.0/python/examples/timezones.py +176 -0
- fasttime_rs-0.3.0/python/examples/unix_timestamps.py +193 -0
- fasttime_rs-0.3.0/python/fasttime/__init__.py +15 -0
- fasttime_rs-0.3.0/python/fasttime/__init__.pyi +272 -0
- fasttime_rs-0.3.0/python/fasttime/py.typed +0 -0
- fasttime_rs-0.3.0/python/tests/test_fasttime.py +278 -0
- fasttime_rs-0.3.0/src/lib.rs +1102 -0
- fasttime_rs-0.3.0/src/python.rs +829 -0
- fasttime_rs-0.3.0/tests/tests.rs +465 -0
- fasttime_rs-0.3.0/uv.lock +8 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Publish Crate
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
dry_run:
|
|
7
|
+
description: "Run cargo publish in dry-run mode"
|
|
8
|
+
required: true
|
|
9
|
+
type: boolean
|
|
10
|
+
default: true
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
env:
|
|
16
|
+
CARGO_TERM_COLOR: always
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
publish:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v7
|
|
24
|
+
|
|
25
|
+
- name: Install Rust
|
|
26
|
+
uses: dtolnay/rust-toolchain@stable
|
|
27
|
+
|
|
28
|
+
- name: Package validation
|
|
29
|
+
run: cargo package --locked
|
|
30
|
+
|
|
31
|
+
- name: Publish (dry-run)
|
|
32
|
+
if: ${{ inputs.dry_run }}
|
|
33
|
+
run: cargo publish --locked --dry-run
|
|
34
|
+
|
|
35
|
+
- name: Publish to crates.io
|
|
36
|
+
if: ${{ !inputs.dry_run }}
|
|
37
|
+
run: cargo publish --locked
|
|
38
|
+
env:
|
|
39
|
+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
name: Publish Python distributions
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
CARGO_TERM_COLOR: always
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
validate:
|
|
17
|
+
name: Validate release version
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v7
|
|
21
|
+
|
|
22
|
+
- uses: actions/setup-python@v6
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.14"
|
|
25
|
+
|
|
26
|
+
- name: Check package versions and release tag
|
|
27
|
+
shell: bash
|
|
28
|
+
run: |
|
|
29
|
+
python - <<'PY'
|
|
30
|
+
import os
|
|
31
|
+
import tomllib
|
|
32
|
+
|
|
33
|
+
with open("pyproject.toml", "rb") as file:
|
|
34
|
+
python_version = tomllib.load(file)["project"]["version"]
|
|
35
|
+
|
|
36
|
+
with open("Cargo.toml", "rb") as file:
|
|
37
|
+
rust_version = tomllib.load(file)["package"]["version"]
|
|
38
|
+
|
|
39
|
+
if python_version != rust_version:
|
|
40
|
+
raise SystemExit(
|
|
41
|
+
f"Version mismatch: pyproject.toml={python_version}, Cargo.toml={rust_version}"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
if os.environ["GITHUB_EVENT_NAME"] == "push":
|
|
45
|
+
expected_tag = f"v{python_version}"
|
|
46
|
+
actual_tag = os.environ["GITHUB_REF_NAME"]
|
|
47
|
+
if actual_tag != expected_tag:
|
|
48
|
+
raise SystemExit(
|
|
49
|
+
f"Release tag {actual_tag!r} does not match {expected_tag!r}"
|
|
50
|
+
)
|
|
51
|
+
PY
|
|
52
|
+
|
|
53
|
+
manylinux:
|
|
54
|
+
name: manylinux ${{ matrix.target }}
|
|
55
|
+
needs: validate
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
strategy:
|
|
58
|
+
fail-fast: false
|
|
59
|
+
matrix:
|
|
60
|
+
target: [x86_64, aarch64]
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v7
|
|
63
|
+
|
|
64
|
+
- uses: actions/setup-python@v6
|
|
65
|
+
with:
|
|
66
|
+
python-version: "3.14"
|
|
67
|
+
|
|
68
|
+
- name: Build wheels
|
|
69
|
+
uses: PyO3/maturin-action@v1
|
|
70
|
+
with:
|
|
71
|
+
command: build
|
|
72
|
+
maturin-version: v1.14.1
|
|
73
|
+
target: ${{ matrix.target }}
|
|
74
|
+
manylinux: "2_17"
|
|
75
|
+
args: >-
|
|
76
|
+
--release --locked --compatibility pypi --find-interpreter --out dist
|
|
77
|
+
|
|
78
|
+
- name: Test wheel
|
|
79
|
+
if: matrix.target == 'x86_64'
|
|
80
|
+
run: |
|
|
81
|
+
python -m pip install pytest
|
|
82
|
+
python -m pip install --no-index --no-deps --force-reinstall --find-links dist fasttime-rs
|
|
83
|
+
python -m pytest python/tests
|
|
84
|
+
|
|
85
|
+
- name: Upload wheels
|
|
86
|
+
uses: actions/upload-artifact@v6
|
|
87
|
+
with:
|
|
88
|
+
name: python-dist-manylinux-${{ matrix.target }}
|
|
89
|
+
path: dist/*
|
|
90
|
+
if-no-files-found: error
|
|
91
|
+
|
|
92
|
+
musllinux:
|
|
93
|
+
name: musllinux ${{ matrix.target }}
|
|
94
|
+
needs: validate
|
|
95
|
+
runs-on: ubuntu-latest
|
|
96
|
+
strategy:
|
|
97
|
+
fail-fast: false
|
|
98
|
+
matrix:
|
|
99
|
+
target: [x86_64, aarch64]
|
|
100
|
+
steps:
|
|
101
|
+
- uses: actions/checkout@v7
|
|
102
|
+
|
|
103
|
+
- name: Build wheels
|
|
104
|
+
uses: PyO3/maturin-action@v1
|
|
105
|
+
with:
|
|
106
|
+
command: build
|
|
107
|
+
maturin-version: v1.14.1
|
|
108
|
+
target: ${{ matrix.target }}
|
|
109
|
+
manylinux: musllinux_1_2
|
|
110
|
+
args: >-
|
|
111
|
+
--release --locked --compatibility pypi --find-interpreter --out dist
|
|
112
|
+
|
|
113
|
+
- name: Upload wheels
|
|
114
|
+
uses: actions/upload-artifact@v6
|
|
115
|
+
with:
|
|
116
|
+
name: python-dist-musllinux-${{ matrix.target }}
|
|
117
|
+
path: dist/*
|
|
118
|
+
if-no-files-found: error
|
|
119
|
+
|
|
120
|
+
windows:
|
|
121
|
+
name: Windows CPython ${{ matrix.python-version }}
|
|
122
|
+
needs: validate
|
|
123
|
+
runs-on: windows-latest
|
|
124
|
+
strategy:
|
|
125
|
+
fail-fast: false
|
|
126
|
+
matrix:
|
|
127
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
128
|
+
steps:
|
|
129
|
+
- uses: actions/checkout@v7
|
|
130
|
+
|
|
131
|
+
- uses: actions/setup-python@v6
|
|
132
|
+
with:
|
|
133
|
+
python-version: ${{ matrix.python-version }}
|
|
134
|
+
architecture: x64
|
|
135
|
+
|
|
136
|
+
- name: Build wheel
|
|
137
|
+
uses: PyO3/maturin-action@v1
|
|
138
|
+
with:
|
|
139
|
+
command: build
|
|
140
|
+
maturin-version: v1.14.1
|
|
141
|
+
target: x64
|
|
142
|
+
args: >-
|
|
143
|
+
--release --locked --compatibility pypi --interpreter python --out dist
|
|
144
|
+
|
|
145
|
+
- name: Test wheel
|
|
146
|
+
run: |
|
|
147
|
+
python -m pip install pytest
|
|
148
|
+
python -m pip install --no-index --no-deps --force-reinstall --find-links dist fasttime-rs
|
|
149
|
+
python -m pytest python/tests
|
|
150
|
+
|
|
151
|
+
- name: Upload wheel
|
|
152
|
+
uses: actions/upload-artifact@v6
|
|
153
|
+
with:
|
|
154
|
+
name: python-dist-windows-${{ matrix.python-version }}
|
|
155
|
+
path: dist/*
|
|
156
|
+
if-no-files-found: error
|
|
157
|
+
|
|
158
|
+
macos:
|
|
159
|
+
name: macOS ${{ matrix.platform.target }} CPython ${{ matrix.python-version }}
|
|
160
|
+
needs: validate
|
|
161
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
162
|
+
strategy:
|
|
163
|
+
fail-fast: false
|
|
164
|
+
matrix:
|
|
165
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
166
|
+
platform:
|
|
167
|
+
- runner: macos-15-intel
|
|
168
|
+
target: x86_64
|
|
169
|
+
- runner: macos-latest
|
|
170
|
+
target: aarch64
|
|
171
|
+
steps:
|
|
172
|
+
- uses: actions/checkout@v7
|
|
173
|
+
|
|
174
|
+
- uses: actions/setup-python@v6
|
|
175
|
+
with:
|
|
176
|
+
python-version: ${{ matrix.python-version }}
|
|
177
|
+
|
|
178
|
+
- name: Build wheel
|
|
179
|
+
uses: PyO3/maturin-action@v1
|
|
180
|
+
with:
|
|
181
|
+
command: build
|
|
182
|
+
maturin-version: v1.14.1
|
|
183
|
+
target: ${{ matrix.platform.target }}
|
|
184
|
+
args: >-
|
|
185
|
+
--release --locked --compatibility pypi --interpreter python --out dist
|
|
186
|
+
|
|
187
|
+
- name: Test wheel
|
|
188
|
+
run: |
|
|
189
|
+
python -m pip install pytest
|
|
190
|
+
python -m pip install --no-index --no-deps --force-reinstall --find-links dist fasttime-rs
|
|
191
|
+
python -m pytest python/tests
|
|
192
|
+
|
|
193
|
+
- name: Upload wheel
|
|
194
|
+
uses: actions/upload-artifact@v6
|
|
195
|
+
with:
|
|
196
|
+
name: python-dist-macos-${{ matrix.platform.target }}-${{ matrix.python-version }}
|
|
197
|
+
path: dist/*
|
|
198
|
+
if-no-files-found: error
|
|
199
|
+
|
|
200
|
+
sdist:
|
|
201
|
+
name: Source distribution
|
|
202
|
+
needs: validate
|
|
203
|
+
runs-on: ubuntu-latest
|
|
204
|
+
steps:
|
|
205
|
+
- uses: actions/checkout@v7
|
|
206
|
+
|
|
207
|
+
- name: Build source distribution
|
|
208
|
+
uses: PyO3/maturin-action@v1
|
|
209
|
+
with:
|
|
210
|
+
command: sdist
|
|
211
|
+
maturin-version: v1.14.1
|
|
212
|
+
args: --out dist
|
|
213
|
+
|
|
214
|
+
- name: Upload source distribution
|
|
215
|
+
uses: actions/upload-artifact@v6
|
|
216
|
+
with:
|
|
217
|
+
name: python-dist-sdist
|
|
218
|
+
path: dist/*
|
|
219
|
+
if-no-files-found: error
|
|
220
|
+
|
|
221
|
+
publish:
|
|
222
|
+
name: Publish to PyPI
|
|
223
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
224
|
+
needs: [manylinux, musllinux, windows, macos, sdist]
|
|
225
|
+
runs-on: ubuntu-latest
|
|
226
|
+
environment:
|
|
227
|
+
name: pypi
|
|
228
|
+
url: https://pypi.org/project/fasttime-rs/
|
|
229
|
+
permissions:
|
|
230
|
+
contents: read
|
|
231
|
+
id-token: write
|
|
232
|
+
steps:
|
|
233
|
+
- name: Download distributions
|
|
234
|
+
uses: actions/download-artifact@v7
|
|
235
|
+
with:
|
|
236
|
+
pattern: python-dist-*
|
|
237
|
+
path: dist
|
|
238
|
+
merge-multiple: true
|
|
239
|
+
|
|
240
|
+
- name: Publish distributions
|
|
241
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
242
|
+
with:
|
|
243
|
+
packages-dir: dist
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
CARGO_TERM_COLOR: always
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
test:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v7
|
|
21
|
+
|
|
22
|
+
- name: Install Rust
|
|
23
|
+
uses: dtolnay/rust-toolchain@stable
|
|
24
|
+
|
|
25
|
+
- name: Check formatting
|
|
26
|
+
run: cargo fmt --check
|
|
27
|
+
|
|
28
|
+
- name: Run clippy
|
|
29
|
+
run: cargo clippy -- -D warnings
|
|
30
|
+
|
|
31
|
+
- name: Run tests
|
|
32
|
+
run: cargo test
|
|
33
|
+
|
|
34
|
+
- name: Run tests (no default features)
|
|
35
|
+
run: cargo test --no-default-features
|
|
36
|
+
|
|
37
|
+
python:
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
strategy:
|
|
40
|
+
fail-fast: false
|
|
41
|
+
matrix:
|
|
42
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
43
|
+
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/checkout@v7
|
|
46
|
+
|
|
47
|
+
- name: Install Rust
|
|
48
|
+
uses: dtolnay/rust-toolchain@stable
|
|
49
|
+
|
|
50
|
+
- name: Install Python ${{ matrix.python-version }}
|
|
51
|
+
uses: actions/setup-python@v6
|
|
52
|
+
with:
|
|
53
|
+
python-version: ${{ matrix.python-version }}
|
|
54
|
+
|
|
55
|
+
- name: Install Python build and test tools
|
|
56
|
+
run: python -m pip install maturin pytest
|
|
57
|
+
|
|
58
|
+
- name: Build Python wheel
|
|
59
|
+
run: maturin build --interpreter python
|
|
60
|
+
|
|
61
|
+
- name: Install Python wheel
|
|
62
|
+
run: python -m pip install --force-reinstall target/wheels/*.whl
|
|
63
|
+
|
|
64
|
+
- name: Run Python tests
|
|
65
|
+
run: python -m pytest python/tests
|