Skip to content

Commit 2e5b2ea

Browse files
authored
ci: test Python 3.11 through 3.15 (#145)
## Summary Tests the package on every Python it supports, and declares that set. - A `test` job runs the suite on 3.11, 3.12, 3.13, 3.14 and 3.15 (3.15 is a release candidate until its October release). The existing job keeps lint, format, type, dead-code and coverage checks on 3.12. - The classifiers name 3.11 through 3.15. - Ruff targets py311, matching `requires-python = ">=3.11"`. 3.10, which reaches end of life in October, was already outside the supported range. - The new target's UP017 rule moves two `timezone.utc` uses to `datetime.UTC`, the same object. ## Type of change - [ ] Bug fix (no breaking change) - [ ] New feature (no breaking change) - [ ] Breaking change (existing callers must update) - [x] Docs, tests, or internal maintenance only ## Public API None. ## Test plan The suite was run locally on each interpreter with a separate environment per version: 1886 passed and 4 skipped on 3.11, 3.12, 3.13 and 3.14. On macOS, 3.15.0rc2 cannot import pydantic-core's published 3.15 wheel (the dynamic loader rejects the binary), which is outside this package; the Linux job in this PR's CI is the evidence for 3.15. ruff, format, ty (package and examples), vulture and the full suite on 3.12 pass locally. ## Checklist - [x] Tests cover the new behavior, and the suite passes locally - [x] Lint, format, and type checks pass - [x] Docs and README examples updated if the public surface changed (no public surface changed) - [x] No secrets, credentials, or personal data in the diff or the tests
1 parent cf8571c commit 2e5b2ea

5 files changed

Lines changed: 34 additions & 5 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,27 @@ jobs:
5757

5858
- name: Tests
5959
run: uv run pytest tests/ -v --cov=agentscore_commerce --cov-report=term-missing
60+
61+
test:
62+
runs-on: blacksmith-2vcpu-ubuntu-2404-arm
63+
timeout-minutes: 10
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
python: ["3.11", "3.12", "3.13", "3.14", "3.15"]
68+
steps:
69+
- uses: useblacksmith/checkout@v1
70+
71+
- name: Install uv
72+
uses: astral-sh/setup-uv@v10.2.0
73+
with:
74+
version: "0.12.20"
75+
76+
- name: Set up Python
77+
run: uv python install ${{ matrix.python }}
78+
79+
- name: Install dependencies
80+
run: uv sync --frozen --all-extras --python ${{ matrix.python }}
81+
82+
- name: Tests
83+
run: uv run --python ${{ matrix.python }} pytest tests/ -q

‎agentscore_commerce/checkout_compute_first.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import logging
3434
import uuid
3535
from dataclasses import dataclass, field
36-
from datetime import UTC, datetime, timezone
36+
from datetime import UTC, datetime
3737
from decimal import Decimal
3838
from typing import TYPE_CHECKING, Any
3939

@@ -207,7 +207,7 @@ def _decimals_for_unit(unit_price_cents: float) -> int:
207207

208208

209209
def _iso_now() -> str:
210-
return datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
210+
return datetime.now(UTC).isoformat().replace("+00:00", "Z")
211211

212212

213213
def _default_success_body(app_url: str) -> Callable[[SuccessBodyArgs], dict[str, Any]]:

‎examples/multi_rail_merchant.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
import os
4242
from dataclasses import asdict
43-
from datetime import datetime, timezone
43+
from datetime import UTC, datetime
4444
from typing import Any
4545

4646
from fastapi import FastAPI, Request
@@ -154,7 +154,7 @@ async def _on_settled(ctx: Any, outcome: SettleOutcome) -> dict[str, Any]:
154154
success = build_success_next_steps(order_status_url=f"{APP_URL}/orders/{ctx.reference_id}")
155155
receipt = Receipt(
156156
id=ctx.reference_id,
157-
created_at=datetime.now(timezone.utc).isoformat(),
157+
created_at=datetime.now(UTC).isoformat(),
158158
pricing=ctx.pricing.block,
159159
product=ProductInfo(name="Regulated Goods Cart"),
160160
payment_status="completed",

‎pyproject.toml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ classifiers = [
1919
"Intended Audience :: Developers",
2020
"License :: OSI Approved :: MIT License",
2121
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.11",
23+
"Programming Language :: Python :: 3.12",
24+
"Programming Language :: Python :: 3.13",
25+
"Programming Language :: Python :: 3.14",
26+
"Programming Language :: Python :: 3.15",
2227
"Framework :: FastAPI",
2328
"Framework :: Flask",
2429
"Framework :: Django",

‎ruff.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
target-version = "py310"
1+
target-version = "py311"
22
line-length = 120
33

44
[lint]

0 commit comments

Comments
 (0)