Skip to content

Commit e1f8b34

Browse files
DylanBartelsdylan bartelsgadomski
authored
Relax pystac-pydantic python version to 3.11 (#73)
## What I'm changing - <!-- a list of changes, including any issues this might close or reference --> ## How I did it - <!-- more detail on decisions and choices --> ## Checklist - [x] Tests pass: `uv run pytest` - [x] Checks pass: `uv run pre-commit --all-files` - [x] CHANGELOG is updated (if necessary) --------- Co-authored-by: dylan bartels <[email protected]> Co-authored-by: Pete Gadomski <[email protected]>
1 parent 2af8099 commit e1f8b34

File tree

20 files changed

+274
-36
lines changed

20 files changed

+274
-36
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
strategy:
1818
matrix:
1919
python-version:
20+
- "3.11"
2021
- "3.12"
2122
- "3.13"
2223
steps:

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.12
1+
3.11

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "pystapi"
33
version = "0.0.0" # This package should never be released, only the workspace members should be
44
description = "Monorepo for Satellite Tasking API (STAPI) Specification Python packages"
55
readme = "README.md"
6-
requires-python = ">=3.10"
6+
requires-python = ">=3.11"
77
dependencies = [
88
"pystapi-client",
99
"pystapi-validator",

pystapi-client/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ authors = [
1010
maintainers = [{ name = "Pete Gadomski", email = "[email protected]" }]
1111
keywords = ["stapi"]
1212
license = { text = "MIT" }
13-
requires-python = ">=3.10"
13+
requires-python = ">=3.11"
1414
dependencies = [
1515
"httpx>=0.28.1",
1616
"stapi-pydantic",

pystapi-validator/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ authors = [
77
]
88
license = "MIT"
99
readme = "README.md"
10-
requires-python = ">=3.10"
10+
requires-python = ">=3.11"
1111
dependencies = [
1212
"schemathesis>=3.37.0",
1313
"pytest>=8.3.3",

stapi-fastapi/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ authors = [
99
readme = "README.md"
1010
license = "MIT"
1111

12-
requires-python = ">=3.12"
12+
requires-python = ">=3.11"
1313

1414
dependencies = [
1515
"httpx>=0.27.0",

stapi-fastapi/src/stapi_fastapi/routers/product_router.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
OrderStatus,
2929
Prefer,
3030
)
31+
from stapi_pydantic import (
32+
Product as ProductPydantic,
33+
)
3134

3235
from stapi_fastapi.constants import TYPE_JSON
3336
from stapi_fastapi.exceptions import ConstraintsException, NotFoundException
@@ -52,7 +55,7 @@ def get_prefer(prefer: str | None = Header(None)) -> str | None:
5255
if prefer is None:
5356
return None
5457

55-
if prefer not in Prefer:
58+
if prefer not in Prefer._value2member_map_:
5659
raise HTTPException(
5760
status_code=status.HTTP_400_BAD_REQUEST,
5861
detail=f"Invalid Prefer header value: {prefer}",
@@ -168,7 +171,7 @@ async def _create_order(
168171
tags=["Products"],
169172
)
170173

171-
def get_product(self, request: Request) -> Product:
174+
def get_product(self, request: Request) -> ProductPydantic:
172175
links = [
173176
Link(
174177
href=str(

stapi-fastapi/tests/backends.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from datetime import datetime, timezone
1+
from datetime import UTC, datetime
22
from uuid import uuid4
33

44
from fastapi import Request
@@ -81,15 +81,15 @@ async def mock_create_order(product_router: ProductRouter, payload: OrderPayload
8181
"""
8282
try:
8383
status = OrderStatus(
84-
timestamp=datetime.now(timezone.utc),
84+
timestamp=datetime.now(UTC),
8585
status_code=OrderStatusCode.received,
8686
)
8787
order = Order(
8888
id=str(uuid4()),
8989
geometry=payload.geometry,
9090
properties=OrderProperties(
9191
product_id=product_router.product.id,
92-
created=datetime.now(timezone.utc),
92+
created=datetime.now(UTC),
9393
status=status,
9494
search_parameters=OrderSearchParameters(
9595
geometry=payload.geometry,
@@ -140,7 +140,7 @@ async def mock_search_opportunities_async(
140140
) -> ResultE[OpportunitySearchRecord]:
141141
try:
142142
received_status = OpportunitySearchStatus(
143-
timestamp=datetime.now(timezone.utc),
143+
timestamp=datetime.now(UTC),
144144
status_code=OpportunitySearchStatusCode.received,
145145
)
146146
search_record = OpportunitySearchRecord(

stapi-fastapi/tests/shared.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from collections import defaultdict
22
from copy import deepcopy
3-
from datetime import datetime, timedelta, timezone
4-
from typing import Any, Literal, Self
3+
from datetime import UTC, datetime, timedelta
4+
from typing import Any, Literal, Self, TypeAlias
55
from urllib.parse import parse_qs, urlparse
66
from uuid import uuid4
77

@@ -32,7 +32,7 @@
3232
mock_search_opportunities_async,
3333
)
3434

35-
type link_dict = dict[str, Any]
35+
link_dict: TypeAlias = dict[str, Any]
3636

3737

3838
def find_link(links: list[link_dict], rel: str) -> link_dict | None:
@@ -203,7 +203,7 @@ class MyOrderParameters(OrderParameters):
203203

204204

205205
def create_mock_opportunity() -> Opportunity:
206-
now = datetime.now(timezone.utc) # Use timezone-aware datetime
206+
now = datetime.now(UTC) # Use timezone-aware datetime
207207
start = now
208208
end = start + timedelta(days=5)
209209

stapi-fastapi/tests/test_opportunity_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from collections.abc import Callable
2-
from datetime import UTC, datetime, timedelta, timezone
2+
from datetime import UTC, datetime, timedelta
33
from typing import Any
44
from uuid import uuid4
55

@@ -217,7 +217,7 @@ def test_async_opportunity_search_to_completion(
217217
)
218218
)
219219
search_record.status = OpportunitySearchStatus(
220-
timestamp=datetime.now(timezone.utc),
220+
timestamp=datetime.now(UTC),
221221
status_code=OpportunitySearchStatusCode.completed,
222222
)
223223

0 commit comments

Comments
 (0)