fasti-dates 0.2.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.
- fasti_dates-0.2.0/.github/CODEOWNERS +3 -0
- fasti_dates-0.2.0/.github/ISSUE_TEMPLATE/bug_report.yml +56 -0
- fasti_dates-0.2.0/.github/ISSUE_TEMPLATE/calendar_data.yml +45 -0
- fasti_dates-0.2.0/.github/ISSUE_TEMPLATE/config.yml +8 -0
- fasti_dates-0.2.0/.github/ISSUE_TEMPLATE/feature_request.yml +33 -0
- fasti_dates-0.2.0/.github/dependabot.yml +23 -0
- fasti_dates-0.2.0/.github/pull_request_template.md +27 -0
- fasti_dates-0.2.0/.github/workflows/ci.yml +292 -0
- fasti_dates-0.2.0/.github/workflows/release-python.yml +191 -0
- fasti_dates-0.2.0/.github/workflows/release.yml +94 -0
- fasti_dates-0.2.0/.gitignore +14 -0
- fasti_dates-0.2.0/ARCHITECTURE.md +160 -0
- fasti_dates-0.2.0/CHANGELOG.md +90 -0
- fasti_dates-0.2.0/CODE_OF_CONDUCT.md +19 -0
- fasti_dates-0.2.0/CONTRIBUTING.md +164 -0
- fasti_dates-0.2.0/Cargo.lock +528 -0
- fasti_dates-0.2.0/Cargo.toml +68 -0
- fasti_dates-0.2.0/LICENSE-APACHE +201 -0
- fasti_dates-0.2.0/LICENSE-MIT +21 -0
- fasti_dates-0.2.0/PKG-INFO +250 -0
- fasti_dates-0.2.0/README-py.md +216 -0
- fasti_dates-0.2.0/README.md +202 -0
- fasti_dates-0.2.0/RELEASING.md +152 -0
- fasti_dates-0.2.0/SECURITY.md +27 -0
- fasti_dates-0.2.0/THIRD-PARTY-NOTICES +248 -0
- fasti_dates-0.2.0/benches/calendar.rs +158 -0
- fasti_dates-0.2.0/bindings/python/.gitignore +10 -0
- fasti_dates-0.2.0/bindings/python/Cargo.lock +171 -0
- fasti_dates-0.2.0/bindings/python/Cargo.toml +22 -0
- fasti_dates-0.2.0/bindings/python/README-py.md +216 -0
- fasti_dates-0.2.0/bindings/python/benches/compare.py +164 -0
- fasti_dates-0.2.0/bindings/python/licenses/LICENSE-APACHE +201 -0
- fasti_dates-0.2.0/bindings/python/licenses/LICENSE-MIT +21 -0
- fasti_dates-0.2.0/bindings/python/licenses/THIRD-PARTY-NOTICES +248 -0
- fasti_dates-0.2.0/bindings/python/src/calendar.rs +542 -0
- fasti_dates-0.2.0/bindings/python/src/convert.rs +172 -0
- fasti_dates-0.2.0/bindings/python/src/daycount.rs +270 -0
- fasti_dates-0.2.0/bindings/python/src/lib.rs +95 -0
- fasti_dates-0.2.0/bindings/python/src/period.rs +213 -0
- fasti_dates-0.2.0/bindings/python/src/rule.rs +376 -0
- fasti_dates-0.2.0/bindings/python/src/schedule.rs +533 -0
- fasti_dates-0.2.0/bindings/python/src/vocab.rs +331 -0
- fasti_dates-0.2.0/bindings/python/tests/test_api.py +130 -0
- fasti_dates-0.2.0/bindings/python/tests/test_boundary.py +118 -0
- fasti_dates-0.2.0/bindings/python/tests/test_calendars.py +262 -0
- fasti_dates-0.2.0/bindings/python/tests/test_daycount.py +133 -0
- fasti_dates-0.2.0/bindings/python/tests/test_docs.py +86 -0
- fasti_dates-0.2.0/bindings/python/tests/test_period.py +77 -0
- fasti_dates-0.2.0/bindings/python/tests/test_schedule.py +196 -0
- fasti_dates-0.2.0/bindings/python/tests/test_threads.py +114 -0
- fasti_dates-0.2.0/bindings/python/tests/test_values.py +171 -0
- fasti_dates-0.2.0/bindings/python/tests/test_vocabularies.py +215 -0
- fasti_dates-0.2.0/clippy.toml +7 -0
- fasti_dates-0.2.0/deny.toml +47 -0
- fasti_dates-0.2.0/examples/treasury_schedule.rs +87 -0
- fasti_dates-0.2.0/licenses/LICENSE-APACHE +201 -0
- fasti_dates-0.2.0/licenses/LICENSE-MIT +21 -0
- fasti_dates-0.2.0/licenses/THIRD-PARTY-NOTICES +248 -0
- fasti_dates-0.2.0/pyproject.toml +74 -0
- fasti_dates-0.2.0/python/fasti/__init__.py +49 -0
- fasti_dates-0.2.0/python/fasti/_fasti.pyi +297 -0
- fasti_dates-0.2.0/python/fasti/calendars/__init__.py +18 -0
- fasti_dates-0.2.0/python/fasti/calendars/france.py +10 -0
- fasti_dates-0.2.0/python/fasti/calendars/uk.py +8 -0
- fasti_dates-0.2.0/python/fasti/calendars/us.py +18 -0
- fasti_dates-0.2.0/python/fasti/py.typed +0 -0
- fasti_dates-0.2.0/rustfmt.toml +5 -0
- fasti_dates-0.2.0/src/business_day.rs +52 -0
- fasti_dates-0.2.0/src/calendar.rs +1638 -0
- fasti_dates-0.2.0/src/calendars/france/exchange.rs +80 -0
- fasti_dates-0.2.0/src/calendars/france/mod.rs +11 -0
- fasti_dates-0.2.0/src/calendars/france/settlement.rs +108 -0
- fasti_dates-0.2.0/src/calendars/mod.rs +87 -0
- fasti_dates-0.2.0/src/calendars/target.rs +137 -0
- fasti_dates-0.2.0/src/calendars/uk.rs +333 -0
- fasti_dates-0.2.0/src/calendars/us/federal_reserve.rs +165 -0
- fasti_dates-0.2.0/src/calendars/us/government_bond.rs +195 -0
- fasti_dates-0.2.0/src/calendars/us/mod.rs +26 -0
- fasti_dates-0.2.0/src/calendars/us/nerc.rs +90 -0
- fasti_dates-0.2.0/src/calendars/us/nyse.rs +285 -0
- fasti_dates-0.2.0/src/calendars/us/settlement.rs +242 -0
- fasti_dates-0.2.0/src/calendars/us/sofr.rs +162 -0
- fasti_dates-0.2.0/src/chrono_interop.rs +176 -0
- fasti_dates-0.2.0/src/date.rs +1769 -0
- fasti_dates-0.2.0/src/daycount.rs +1708 -0
- fasti_dates-0.2.0/src/easter.rs +347 -0
- fasti_dates-0.2.0/src/error.rs +80 -0
- fasti_dates-0.2.0/src/fraction.rs +555 -0
- fasti_dates-0.2.0/src/lib.rs +65 -0
- fasti_dates-0.2.0/src/period.rs +558 -0
- fasti_dates-0.2.0/src/rules/easter_offset.rs +249 -0
- fasti_dates-0.2.0/src/rules/fixed.rs +250 -0
- fasti_dates-0.2.0/src/rules/last_weekday.rs +152 -0
- fasti_dates-0.2.0/src/rules/mod.rs +192 -0
- fasti_dates-0.2.0/src/rules/nth_weekday.rs +176 -0
- fasti_dates-0.2.0/src/rules/one_off.rs +63 -0
- fasti_dates-0.2.0/src/schedule.rs +1833 -0
- fasti_dates-0.2.0/src/weekend.rs +124 -0
- fasti_dates-0.2.0/src/year_range.rs +185 -0
- fasti_dates-0.2.0/tests/public_api.rs +401 -0
- fasti_dates-0.2.0/tests/substitute_model.rs +266 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: A panic, a wrong result, a compile failure, or an API that misbehaves
|
|
3
|
+
labels: ["bug"]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
For a wrong holiday date or day-count fraction, use the
|
|
9
|
+
"Calendar or day-count data" template instead — it asks for the
|
|
10
|
+
source citation those fixes need.
|
|
11
|
+
|
|
12
|
+
For anything that looks like a soundness or availability problem,
|
|
13
|
+
read [SECURITY.md](../blob/main/SECURITY.md) first.
|
|
14
|
+
- type: textarea
|
|
15
|
+
id: what
|
|
16
|
+
attributes:
|
|
17
|
+
label: What happened
|
|
18
|
+
validations:
|
|
19
|
+
required: true
|
|
20
|
+
- type: textarea
|
|
21
|
+
id: expected
|
|
22
|
+
attributes:
|
|
23
|
+
label: What you expected instead
|
|
24
|
+
validations:
|
|
25
|
+
required: true
|
|
26
|
+
- type: textarea
|
|
27
|
+
id: repro
|
|
28
|
+
attributes:
|
|
29
|
+
label: Reproducer
|
|
30
|
+
description: The smallest program that shows it. Rendered as Rust.
|
|
31
|
+
render: rust
|
|
32
|
+
validations:
|
|
33
|
+
required: true
|
|
34
|
+
- type: input
|
|
35
|
+
id: version
|
|
36
|
+
attributes:
|
|
37
|
+
label: fasti version
|
|
38
|
+
placeholder: 0.1.0 (or a git SHA)
|
|
39
|
+
validations:
|
|
40
|
+
required: true
|
|
41
|
+
- type: input
|
|
42
|
+
id: rustc
|
|
43
|
+
attributes:
|
|
44
|
+
label: rustc version
|
|
45
|
+
description: Output of `rustc --version`
|
|
46
|
+
placeholder: rustc 1.90.0 (1159e78c4 2025-09-14)
|
|
47
|
+
validations:
|
|
48
|
+
required: true
|
|
49
|
+
- type: checkboxes
|
|
50
|
+
id: features
|
|
51
|
+
attributes:
|
|
52
|
+
label: Features enabled
|
|
53
|
+
options:
|
|
54
|
+
- label: "`serde`"
|
|
55
|
+
- label: "`chrono`"
|
|
56
|
+
- label: "built as `no_std` (no default features on a bare-metal target)"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Calendar or day-count data
|
|
2
|
+
description: A holiday date, business-day adjustment, or day-count fraction that fasti gets wrong
|
|
3
|
+
labels: ["bug", "calendar-data"]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Data bugs need an independently checkable source — a published
|
|
9
|
+
exchange holiday list, a central bank calendar, an ISDA paper. A
|
|
10
|
+
report anchored to a source can be fixed and regression-tested in
|
|
11
|
+
one pass; one without a source cannot.
|
|
12
|
+
- type: input
|
|
13
|
+
id: calendar
|
|
14
|
+
attributes:
|
|
15
|
+
label: Calendar or convention
|
|
16
|
+
description: e.g. `calendars::us::NYSE`, `ActActICMA`, `Thirty360US`
|
|
17
|
+
placeholder: calendars::uk::SETTLEMENT
|
|
18
|
+
validations:
|
|
19
|
+
required: true
|
|
20
|
+
- type: textarea
|
|
21
|
+
id: expected
|
|
22
|
+
attributes:
|
|
23
|
+
label: What fasti returns, and what it should return
|
|
24
|
+
description: Give the dates involved. Exact values, not a description of them.
|
|
25
|
+
placeholder: |
|
|
26
|
+
Date::from_ymd(2027, Month::Dec, 28) is reported as a business day;
|
|
27
|
+
it is the substitute Boxing Day bank holiday and should be a holiday.
|
|
28
|
+
validations:
|
|
29
|
+
required: true
|
|
30
|
+
- type: textarea
|
|
31
|
+
id: source
|
|
32
|
+
attributes:
|
|
33
|
+
label: Source
|
|
34
|
+
description: Link to or cite the published list this is checked against.
|
|
35
|
+
placeholder: https://www.gov.uk/bank-holidays
|
|
36
|
+
validations:
|
|
37
|
+
required: true
|
|
38
|
+
- type: textarea
|
|
39
|
+
id: repro
|
|
40
|
+
attributes:
|
|
41
|
+
label: Reproducer
|
|
42
|
+
description: A short snippet, if you have one. Rendered as Rust, no backticks needed.
|
|
43
|
+
render: rust
|
|
44
|
+
validations:
|
|
45
|
+
required: false
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
blank_issues_enabled: true
|
|
2
|
+
contact_links:
|
|
3
|
+
- name: Security vulnerability
|
|
4
|
+
url: https://github.com/hugof38/fasti/security/advisories/new
|
|
5
|
+
about: Report privately instead of opening an issue. See SECURITY.md for what is in scope.
|
|
6
|
+
- name: Question about usage
|
|
7
|
+
url: https://github.com/hugof38/fasti/issues
|
|
8
|
+
about: Open a blank issue. There is no separate forum yet.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: A convention, calendar, or API that fasti should cover and does not
|
|
3
|
+
labels: ["enhancement"]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Read [ARCHITECTURE.md](../blob/main/ARCHITECTURE.md) first. Several
|
|
9
|
+
things are ruled out by design rather than by omission: floating-point
|
|
10
|
+
arithmetic, external date crates in the core, a `HolidayRule` trait,
|
|
11
|
+
and widening the 1901..=2199 date range.
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: what
|
|
14
|
+
attributes:
|
|
15
|
+
label: What is missing
|
|
16
|
+
description: The convention, calendar, or operation, named precisely.
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
- type: textarea
|
|
20
|
+
id: why
|
|
21
|
+
attributes:
|
|
22
|
+
label: What you are trying to do
|
|
23
|
+
description: The calculation this blocks. Concrete beats general.
|
|
24
|
+
validations:
|
|
25
|
+
required: true
|
|
26
|
+
- type: input
|
|
27
|
+
id: reference
|
|
28
|
+
attributes:
|
|
29
|
+
label: Reference definition
|
|
30
|
+
description: Where the semantics are specified — an ISDA definition, a QuantLib class, an exchange rulebook.
|
|
31
|
+
placeholder: QuantLib ql/time/daycounters/business252.hpp
|
|
32
|
+
validations:
|
|
33
|
+
required: false
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
# The runtime dependency set is deliberately tiny (thiserror, plus the
|
|
4
|
+
# two optional feature deps), so this is mostly about dev-dependencies
|
|
5
|
+
# and security advisories rather than churn.
|
|
6
|
+
- package-ecosystem: cargo
|
|
7
|
+
directory: "/"
|
|
8
|
+
schedule:
|
|
9
|
+
interval: monthly
|
|
10
|
+
open-pull-requests-limit: 5
|
|
11
|
+
groups:
|
|
12
|
+
dev-dependencies:
|
|
13
|
+
dependency-type: development
|
|
14
|
+
commit-message:
|
|
15
|
+
prefix: "deps"
|
|
16
|
+
|
|
17
|
+
- package-ecosystem: github-actions
|
|
18
|
+
directory: "/"
|
|
19
|
+
schedule:
|
|
20
|
+
interval: monthly
|
|
21
|
+
open-pull-requests-limit: 5
|
|
22
|
+
commit-message:
|
|
23
|
+
prefix: "ci"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
## What this changes
|
|
2
|
+
|
|
3
|
+
<!-- The behavior difference, in a sentence or two. Link the issue if there is one. -->
|
|
4
|
+
|
|
5
|
+
## Why
|
|
6
|
+
|
|
7
|
+
<!-- Commit messages here explain *why*, not *what* — same for the PR. -->
|
|
8
|
+
|
|
9
|
+
## Checks
|
|
10
|
+
|
|
11
|
+
- [ ] `cargo test --all-features --all-targets` and `cargo test --all-features --doc`
|
|
12
|
+
- [ ] `cargo clippy --all-features --all-targets -- -D warnings`
|
|
13
|
+
- [ ] `cargo fmt --all --check`
|
|
14
|
+
- [ ] `RUSTDOCFLAGS="-D warnings" cargo doc --all-features --no-deps`
|
|
15
|
+
|
|
16
|
+
## If this touches calendar or day-count data
|
|
17
|
+
|
|
18
|
+
- [ ] Anchored to a published source, cited in a comment
|
|
19
|
+
- [ ] At least one full recent year verified against that source
|
|
20
|
+
- [ ] Historical rule transitions covered
|
|
21
|
+
- [ ] Upstream file attributed if ported from QuantLib, with any deliberate deviation documented
|
|
22
|
+
|
|
23
|
+
## If this changes the public API
|
|
24
|
+
|
|
25
|
+
- [ ] Every new `pub` item has a doc comment, with a runnable example where one is informative
|
|
26
|
+
- [ ] CHANGELOG.md updated under `## [Unreleased]`
|
|
27
|
+
- [ ] Nothing added to the required dependency set (see ARCHITECTURE.md)
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
CARGO_TERM_COLOR: always
|
|
14
|
+
CARGO_INCREMENTAL: 0
|
|
15
|
+
RUST_BACKTRACE: 1
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
fmt:
|
|
19
|
+
name: rustfmt
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v7
|
|
23
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
24
|
+
with:
|
|
25
|
+
components: rustfmt
|
|
26
|
+
- run: cargo fmt --all --check
|
|
27
|
+
|
|
28
|
+
clippy:
|
|
29
|
+
name: clippy
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v7
|
|
33
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
34
|
+
with:
|
|
35
|
+
components: clippy
|
|
36
|
+
- uses: Swatinem/rust-cache@v2
|
|
37
|
+
- run: cargo clippy --locked --all-features --all-targets -- -D warnings
|
|
38
|
+
|
|
39
|
+
test:
|
|
40
|
+
name: test (${{ matrix.toolchain }})
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
strategy:
|
|
43
|
+
fail-fast: false
|
|
44
|
+
matrix:
|
|
45
|
+
# Stable plus the MSRV declared in Cargo.toml.
|
|
46
|
+
toolchain: [stable, "1.90"]
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v7
|
|
49
|
+
- uses: dtolnay/rust-toolchain@master
|
|
50
|
+
with:
|
|
51
|
+
toolchain: ${{ matrix.toolchain }}
|
|
52
|
+
- uses: Swatinem/rust-cache@v2
|
|
53
|
+
# --locked throughout: Cargo.lock is committed so that the MSRV job
|
|
54
|
+
# tests a resolution that is known to build on 1.90. Without it a
|
|
55
|
+
# dependency raising its own MSRV turns this job red for reasons
|
|
56
|
+
# unrelated to the change under test.
|
|
57
|
+
- run: cargo test --locked --all-features --all-targets
|
|
58
|
+
# Doctests are not covered by --all-targets.
|
|
59
|
+
- run: cargo test --locked --all-features --doc
|
|
60
|
+
|
|
61
|
+
# The committed lockfile pins one resolution; this proves the declared
|
|
62
|
+
# version requirements still work when dependencies float, so the lock
|
|
63
|
+
# is never quietly load-bearing.
|
|
64
|
+
test-unlocked:
|
|
65
|
+
name: test (updated dependencies)
|
|
66
|
+
runs-on: ubuntu-latest
|
|
67
|
+
steps:
|
|
68
|
+
- uses: actions/checkout@v7
|
|
69
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
70
|
+
- uses: Swatinem/rust-cache@v2
|
|
71
|
+
- run: cargo update
|
|
72
|
+
- run: cargo test --all-features --all-targets
|
|
73
|
+
|
|
74
|
+
test-non-utc:
|
|
75
|
+
name: test (non-UTC timezone)
|
|
76
|
+
runs-on: ubuntu-latest
|
|
77
|
+
env:
|
|
78
|
+
# The library has no clock and no timezone handling, so results
|
|
79
|
+
# must be identical in any environment timezone. Keep it honest
|
|
80
|
+
# with a timezone that is ahead of UTC and observes DST.
|
|
81
|
+
TZ: Pacific/Auckland
|
|
82
|
+
steps:
|
|
83
|
+
- uses: actions/checkout@v7
|
|
84
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
85
|
+
- uses: Swatinem/rust-cache@v2
|
|
86
|
+
- run: cargo test --locked --all-features --all-targets
|
|
87
|
+
|
|
88
|
+
no-std:
|
|
89
|
+
name: no_std build
|
|
90
|
+
runs-on: ubuntu-latest
|
|
91
|
+
steps:
|
|
92
|
+
- uses: actions/checkout@v7
|
|
93
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
94
|
+
with:
|
|
95
|
+
targets: thumbv7em-none-eabihf
|
|
96
|
+
- uses: Swatinem/rust-cache@v2
|
|
97
|
+
# A bare-metal target has no std at all, so this proves the
|
|
98
|
+
# #![no_std] claim for both feature sets.
|
|
99
|
+
- run: cargo check --locked --target thumbv7em-none-eabihf --no-default-features
|
|
100
|
+
- run: cargo check --locked --target thumbv7em-none-eabihf --all-features
|
|
101
|
+
|
|
102
|
+
doc:
|
|
103
|
+
name: doc
|
|
104
|
+
runs-on: ubuntu-latest
|
|
105
|
+
env:
|
|
106
|
+
RUSTDOCFLAGS: -D warnings
|
|
107
|
+
steps:
|
|
108
|
+
- uses: actions/checkout@v7
|
|
109
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
110
|
+
- uses: Swatinem/rust-cache@v2
|
|
111
|
+
- run: cargo doc --locked --all-features --no-deps
|
|
112
|
+
|
|
113
|
+
deny:
|
|
114
|
+
name: cargo-deny
|
|
115
|
+
runs-on: ubuntu-latest
|
|
116
|
+
steps:
|
|
117
|
+
- uses: actions/checkout@v7
|
|
118
|
+
- uses: taiki-e/install-action@cargo-deny
|
|
119
|
+
- run: cargo deny check
|
|
120
|
+
|
|
121
|
+
# Proves the crate is publishable from a clean checkout: that the
|
|
122
|
+
# packaged file list compiles on its own, and that LICENSE-APACHE,
|
|
123
|
+
# LICENSE-MIT and THIRD-PARTY-NOTICES are actually inside the .crate
|
|
124
|
+
# rather than only in the repository.
|
|
125
|
+
package:
|
|
126
|
+
name: package
|
|
127
|
+
runs-on: ubuntu-latest
|
|
128
|
+
steps:
|
|
129
|
+
- uses: actions/checkout@v7
|
|
130
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
131
|
+
- uses: Swatinem/rust-cache@v2
|
|
132
|
+
- run: cargo package --locked
|
|
133
|
+
- name: License and notice files are in the package
|
|
134
|
+
run: |
|
|
135
|
+
set -euo pipefail
|
|
136
|
+
list=$(cargo package --locked --list)
|
|
137
|
+
for f in LICENSE-APACHE LICENSE-MIT THIRD-PARTY-NOTICES; do
|
|
138
|
+
echo "$list" | grep -qx "$f" || { echo "::error::$f missing from packaged crate"; exit 1; }
|
|
139
|
+
done
|
|
140
|
+
|
|
141
|
+
# ---- Python bindings -------------------------------------------------
|
|
142
|
+
#
|
|
143
|
+
# bindings/python is its own cargo workspace with its own lockfile, so
|
|
144
|
+
# pyo3 never reaches the jobs above: not their MSRV, not their lockfile,
|
|
145
|
+
# not cargo-deny.
|
|
146
|
+
|
|
147
|
+
py-lint:
|
|
148
|
+
name: python bindings (rustfmt + clippy)
|
|
149
|
+
runs-on: ubuntu-latest
|
|
150
|
+
defaults:
|
|
151
|
+
run:
|
|
152
|
+
working-directory: bindings/python
|
|
153
|
+
steps:
|
|
154
|
+
- uses: actions/checkout@v7
|
|
155
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
156
|
+
with:
|
|
157
|
+
components: clippy, rustfmt
|
|
158
|
+
- uses: Swatinem/rust-cache@v2
|
|
159
|
+
with:
|
|
160
|
+
workspaces: bindings/python
|
|
161
|
+
- run: cargo fmt --all --check
|
|
162
|
+
- run: cargo clippy --locked --all-targets -- -D warnings
|
|
163
|
+
|
|
164
|
+
py-test:
|
|
165
|
+
name: python (${{ matrix.os }})
|
|
166
|
+
runs-on: ${{ matrix.os }}
|
|
167
|
+
strategy:
|
|
168
|
+
fail-fast: false
|
|
169
|
+
matrix:
|
|
170
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
171
|
+
defaults:
|
|
172
|
+
run:
|
|
173
|
+
working-directory: bindings/python
|
|
174
|
+
steps:
|
|
175
|
+
- uses: actions/checkout@v7
|
|
176
|
+
- uses: actions/setup-python@v6
|
|
177
|
+
with:
|
|
178
|
+
# The abi3 floor. Doctest compares exception messages
|
|
179
|
+
# differently before 3.11, so this is the version that has to
|
|
180
|
+
# be honest about them.
|
|
181
|
+
python-version: "3.10"
|
|
182
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
183
|
+
- uses: Swatinem/rust-cache@v2
|
|
184
|
+
with:
|
|
185
|
+
workspaces: bindings/python
|
|
186
|
+
- run: python -m pip install --upgrade pip
|
|
187
|
+
- run: pip install . pytest mypy
|
|
188
|
+
- run: pytest
|
|
189
|
+
- run: mypy
|
|
190
|
+
|
|
191
|
+
py-wheel:
|
|
192
|
+
name: abi3 wheel
|
|
193
|
+
runs-on: ubuntu-latest
|
|
194
|
+
defaults:
|
|
195
|
+
run:
|
|
196
|
+
working-directory: bindings/python
|
|
197
|
+
steps:
|
|
198
|
+
- uses: actions/checkout@v7
|
|
199
|
+
- uses: actions/setup-python@v6
|
|
200
|
+
with:
|
|
201
|
+
python-version: "3.10"
|
|
202
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
203
|
+
- uses: Swatinem/rust-cache@v2
|
|
204
|
+
with:
|
|
205
|
+
workspaces: bindings/python
|
|
206
|
+
- run: pip install maturin abi3audit twine
|
|
207
|
+
- run: maturin build --release --locked --out dist
|
|
208
|
+
# One wheel has to cover every supported version, so the tag it
|
|
209
|
+
# carries is part of the contract.
|
|
210
|
+
- name: The wheel is abi3, from the declared floor
|
|
211
|
+
run: |
|
|
212
|
+
python - <<'PY'
|
|
213
|
+
import pathlib, re, sys
|
|
214
|
+
built = [p.name for p in pathlib.Path("dist").glob("*.whl")]
|
|
215
|
+
if len(built) != 1 or not re.search(r"-cp310-abi3-", built[0]):
|
|
216
|
+
sys.exit(f"::error::expected one cp310-abi3 wheel, got {built}")
|
|
217
|
+
PY
|
|
218
|
+
- run: abi3audit --strict dist/*.whl
|
|
219
|
+
- run: twine check --strict dist/*
|
|
220
|
+
- uses: actions/upload-artifact@v4
|
|
221
|
+
with:
|
|
222
|
+
name: abi3-wheel
|
|
223
|
+
path: bindings/python/dist/*.whl
|
|
224
|
+
|
|
225
|
+
py-abi3:
|
|
226
|
+
name: abi3 wheel on ${{ matrix.python }}
|
|
227
|
+
needs: py-wheel
|
|
228
|
+
runs-on: ubuntu-latest
|
|
229
|
+
strategy:
|
|
230
|
+
fail-fast: false
|
|
231
|
+
matrix:
|
|
232
|
+
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
233
|
+
steps:
|
|
234
|
+
- uses: actions/checkout@v7
|
|
235
|
+
- uses: actions/setup-python@v6
|
|
236
|
+
with:
|
|
237
|
+
python-version: ${{ matrix.python }}
|
|
238
|
+
- uses: actions/download-artifact@v4
|
|
239
|
+
with:
|
|
240
|
+
name: abi3-wheel
|
|
241
|
+
path: wheel
|
|
242
|
+
# The same wheel, unbuilt, on every version it claims to support.
|
|
243
|
+
- run: pip install pytest wheel/*.whl
|
|
244
|
+
- run: pytest
|
|
245
|
+
working-directory: bindings/python
|
|
246
|
+
|
|
247
|
+
py-free-threaded:
|
|
248
|
+
name: python 3.14 free-threaded
|
|
249
|
+
runs-on: ubuntu-latest
|
|
250
|
+
defaults:
|
|
251
|
+
run:
|
|
252
|
+
working-directory: bindings/python
|
|
253
|
+
steps:
|
|
254
|
+
- uses: actions/checkout@v7
|
|
255
|
+
- uses: actions/setup-python@v6
|
|
256
|
+
with:
|
|
257
|
+
python-version: "3.14t"
|
|
258
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
259
|
+
- uses: Swatinem/rust-cache@v2
|
|
260
|
+
with:
|
|
261
|
+
workspaces: bindings/python
|
|
262
|
+
# abi3 is a no-op on a free-threaded interpreter, so this builds a
|
|
263
|
+
# version-specific 3.14t extension. The module declares
|
|
264
|
+
# gil_used = false; every value it hands out is frozen.
|
|
265
|
+
- run: pip install . pytest
|
|
266
|
+
- run: pytest
|
|
267
|
+
|
|
268
|
+
py-sdist:
|
|
269
|
+
name: install from sdist
|
|
270
|
+
runs-on: ubuntu-latest
|
|
271
|
+
steps:
|
|
272
|
+
- uses: actions/checkout@v7
|
|
273
|
+
- uses: actions/setup-python@v6
|
|
274
|
+
with:
|
|
275
|
+
python-version: "3.12"
|
|
276
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
277
|
+
- run: pip install maturin pytest twine
|
|
278
|
+
- run: maturin sdist --out dist
|
|
279
|
+
working-directory: bindings/python
|
|
280
|
+
- run: twine check --strict bindings/python/dist/*
|
|
281
|
+
# The sdist has to carry the core crate: this compiles it from
|
|
282
|
+
# nothing but the tarball, in a directory that is not the checkout.
|
|
283
|
+
- name: Build and test from the sdist alone
|
|
284
|
+
run: |
|
|
285
|
+
set -euo pipefail
|
|
286
|
+
mkdir -p "$RUNNER_TEMP/from-sdist"
|
|
287
|
+
tar xzf bindings/python/dist/*.tar.gz -C "$RUNNER_TEMP/from-sdist"
|
|
288
|
+
python -m venv "$RUNNER_TEMP/venv"
|
|
289
|
+
"$RUNNER_TEMP/venv/bin/pip" install pytest
|
|
290
|
+
"$RUNNER_TEMP/venv/bin/pip" install --no-binary fasti-dates bindings/python/dist/*.tar.gz
|
|
291
|
+
cd "$RUNNER_TEMP/from-sdist"/fasti_dates-*
|
|
292
|
+
"$RUNNER_TEMP/venv/bin/pytest" bindings/python/tests
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
name: Release (Python)
|
|
2
|
+
|
|
3
|
+
# Publishes fasti-dates to PyPI when a py-v* tag is pushed. The crate's own
|
|
4
|
+
# release train is v*, and the two patterns do not overlap: py-v0.2.0 is
|
|
5
|
+
# not matched by v*. The tag is the trigger, but the version of record is
|
|
6
|
+
# the one in bindings/python/Cargo.toml.
|
|
7
|
+
# workflow_dispatch runs everything except the upload, so the fifteen
|
|
8
|
+
# artifacts can be proven to build before a tag commits to a version
|
|
9
|
+
# number that PyPI will never release back.
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
tags: ["py-v*"]
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
|
|
15
|
+
env:
|
|
16
|
+
CARGO_TERM_COLOR: always
|
|
17
|
+
CARGO_INCREMENTAL: 0
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
verify:
|
|
21
|
+
name: verify tag
|
|
22
|
+
# Nothing to verify on a manual run: there is no tag to disagree
|
|
23
|
+
# with the manifest, and skipping this skips publish with it.
|
|
24
|
+
if: startsWith(github.ref, 'refs/tags/py-v')
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
outputs:
|
|
27
|
+
version: ${{ steps.check.outputs.version }}
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v7
|
|
30
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
31
|
+
- id: check
|
|
32
|
+
working-directory: bindings/python
|
|
33
|
+
run: |
|
|
34
|
+
set -euo pipefail
|
|
35
|
+
tag="${GITHUB_REF_NAME#py-v}"
|
|
36
|
+
manifest=$(cargo metadata --no-deps --format-version 1 \
|
|
37
|
+
| python3 -c 'import json,sys; print(json.load(sys.stdin)["packages"][0]["version"])')
|
|
38
|
+
if [ "$tag" != "$manifest" ]; then
|
|
39
|
+
echo "::error::tag py-v$tag does not match Cargo.toml version $manifest"
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
echo "version=$manifest" >> "$GITHUB_OUTPUT"
|
|
43
|
+
|
|
44
|
+
gates:
|
|
45
|
+
name: gates
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
defaults:
|
|
48
|
+
run:
|
|
49
|
+
working-directory: bindings/python
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v7
|
|
52
|
+
- uses: actions/setup-python@v6
|
|
53
|
+
with:
|
|
54
|
+
python-version: "3.10"
|
|
55
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
56
|
+
with:
|
|
57
|
+
components: clippy, rustfmt
|
|
58
|
+
- run: cargo fmt --all --check
|
|
59
|
+
- run: cargo clippy --locked --all-targets -- -D warnings
|
|
60
|
+
- run: pip install . pytest mypy
|
|
61
|
+
- run: pytest
|
|
62
|
+
- run: mypy
|
|
63
|
+
|
|
64
|
+
sdist:
|
|
65
|
+
name: sdist
|
|
66
|
+
runs-on: ubuntu-latest
|
|
67
|
+
steps:
|
|
68
|
+
- uses: actions/checkout@v7
|
|
69
|
+
- uses: PyO3/maturin-action@v1
|
|
70
|
+
with:
|
|
71
|
+
command: sdist
|
|
72
|
+
args: --out dist
|
|
73
|
+
working-directory: bindings/python
|
|
74
|
+
- uses: actions/upload-artifact@v4
|
|
75
|
+
with:
|
|
76
|
+
name: dist-sdist
|
|
77
|
+
path: bindings/python/dist/*.tar.gz
|
|
78
|
+
|
|
79
|
+
# One abi3 wheel per platform covers CPython 3.10 and up.
|
|
80
|
+
wheels:
|
|
81
|
+
name: wheel (${{ matrix.target }} ${{ matrix.manylinux || matrix.runner }})
|
|
82
|
+
runs-on: ${{ matrix.runner }}
|
|
83
|
+
strategy:
|
|
84
|
+
fail-fast: false
|
|
85
|
+
matrix:
|
|
86
|
+
include:
|
|
87
|
+
- { runner: ubuntu-latest, target: x86_64, manylinux: auto }
|
|
88
|
+
- { runner: ubuntu-latest, target: aarch64, manylinux: auto }
|
|
89
|
+
- { runner: ubuntu-latest, target: x86_64, manylinux: musllinux_1_2 }
|
|
90
|
+
- { runner: ubuntu-latest, target: aarch64, manylinux: musllinux_1_2 }
|
|
91
|
+
# macOS x86_64 is cross-compiled from the Arm runner: macos-13
|
|
92
|
+
# was retired, and pinning the current Intel label would put the
|
|
93
|
+
# release back on a runner class that keeps being replaced.
|
|
94
|
+
- { runner: macos-15, target: x86_64 }
|
|
95
|
+
- { runner: macos-15, target: aarch64 }
|
|
96
|
+
- { runner: windows-latest, target: x64 }
|
|
97
|
+
steps:
|
|
98
|
+
- uses: actions/checkout@v7
|
|
99
|
+
- uses: PyO3/maturin-action@v1
|
|
100
|
+
with:
|
|
101
|
+
command: build
|
|
102
|
+
args: --release --locked --out dist
|
|
103
|
+
target: ${{ matrix.target }}
|
|
104
|
+
manylinux: ${{ matrix.manylinux }}
|
|
105
|
+
working-directory: bindings/python
|
|
106
|
+
- uses: actions/upload-artifact@v4
|
|
107
|
+
with:
|
|
108
|
+
name: dist-abi3-${{ matrix.target }}-${{ matrix.manylinux || matrix.runner }}
|
|
109
|
+
path: bindings/python/dist/*.whl
|
|
110
|
+
|
|
111
|
+
# abi3 is a no-op on a free-threaded interpreter, so 3.14t needs a
|
|
112
|
+
# wheel of its own on every platform.
|
|
113
|
+
wheels-free-threaded:
|
|
114
|
+
name: wheel 3.14t (${{ matrix.target }} ${{ matrix.manylinux || matrix.runner }})
|
|
115
|
+
runs-on: ${{ matrix.runner }}
|
|
116
|
+
strategy:
|
|
117
|
+
fail-fast: false
|
|
118
|
+
matrix:
|
|
119
|
+
include:
|
|
120
|
+
- { runner: ubuntu-latest, target: x86_64, manylinux: auto }
|
|
121
|
+
- { runner: ubuntu-latest, target: aarch64, manylinux: auto }
|
|
122
|
+
- { runner: ubuntu-latest, target: x86_64, manylinux: musllinux_1_2 }
|
|
123
|
+
- { runner: ubuntu-latest, target: aarch64, manylinux: musllinux_1_2 }
|
|
124
|
+
# macOS x86_64 is cross-compiled from the Arm runner: macos-13
|
|
125
|
+
# was retired, and pinning the current Intel label would put the
|
|
126
|
+
# release back on a runner class that keeps being replaced.
|
|
127
|
+
- { runner: macos-15, target: x86_64 }
|
|
128
|
+
- { runner: macos-15, target: aarch64 }
|
|
129
|
+
- { runner: windows-latest, target: x64 }
|
|
130
|
+
steps:
|
|
131
|
+
- uses: actions/checkout@v7
|
|
132
|
+
- uses: actions/setup-python@v6
|
|
133
|
+
with:
|
|
134
|
+
python-version: "3.14t"
|
|
135
|
+
- uses: PyO3/maturin-action@v1
|
|
136
|
+
with:
|
|
137
|
+
command: build
|
|
138
|
+
args: --release --locked --out dist --interpreter 3.14t
|
|
139
|
+
target: ${{ matrix.target }}
|
|
140
|
+
manylinux: ${{ matrix.manylinux }}
|
|
141
|
+
working-directory: bindings/python
|
|
142
|
+
- uses: actions/upload-artifact@v4
|
|
143
|
+
with:
|
|
144
|
+
name: dist-ft-${{ matrix.target }}-${{ matrix.manylinux || matrix.runner }}
|
|
145
|
+
path: bindings/python/dist/*.whl
|
|
146
|
+
|
|
147
|
+
audit:
|
|
148
|
+
name: audit artifacts
|
|
149
|
+
needs: [sdist, wheels, wheels-free-threaded]
|
|
150
|
+
runs-on: ubuntu-latest
|
|
151
|
+
steps:
|
|
152
|
+
- uses: actions/setup-python@v6
|
|
153
|
+
with:
|
|
154
|
+
python-version: "3.12"
|
|
155
|
+
- uses: actions/download-artifact@v4
|
|
156
|
+
with:
|
|
157
|
+
pattern: dist-*
|
|
158
|
+
merge-multiple: true
|
|
159
|
+
path: dist
|
|
160
|
+
- run: pip install abi3audit twine
|
|
161
|
+
- run: twine check --strict dist/*
|
|
162
|
+
# Only the abi3 wheels claim the stable ABI; the 3.14t ones are
|
|
163
|
+
# version-specific and abi3audit is not asked about them.
|
|
164
|
+
- name: Every abi3 wheel keeps to the stable ABI
|
|
165
|
+
run: |
|
|
166
|
+
set -euo pipefail
|
|
167
|
+
ls dist/
|
|
168
|
+
for wheel in dist/*abi3*.whl; do
|
|
169
|
+
abi3audit --strict "$wheel"
|
|
170
|
+
done
|
|
171
|
+
|
|
172
|
+
publish:
|
|
173
|
+
name: publish to PyPI
|
|
174
|
+
needs: [verify, gates, audit]
|
|
175
|
+
# Belt and braces: verify is already tag-gated, and a skipped
|
|
176
|
+
# dependency skips this job, but an upload is worth saying twice.
|
|
177
|
+
if: startsWith(github.ref, 'refs/tags/py-v')
|
|
178
|
+
runs-on: ubuntu-latest
|
|
179
|
+
# Trusted publishing: PyPI mints a short-lived token from this
|
|
180
|
+
# workflow's OIDC identity, so there is no stored secret. The
|
|
181
|
+
# environment carries the protection rules.
|
|
182
|
+
environment: pypi
|
|
183
|
+
permissions:
|
|
184
|
+
id-token: write
|
|
185
|
+
steps:
|
|
186
|
+
- uses: actions/download-artifact@v4
|
|
187
|
+
with:
|
|
188
|
+
pattern: dist-*
|
|
189
|
+
merge-multiple: true
|
|
190
|
+
path: dist
|
|
191
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|