Skip to content

Commit 94e26b0

Browse files
committed
update from maint-6.1.x
2 parents 6a0ec5e + fd9ce5d commit 94e26b0

File tree

15 files changed

+910
-119
lines changed

15 files changed

+910
-119
lines changed

.github/workflows/cicd.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: stac-fastapi
22
on:
33
push:
4-
branches: [main]
4+
branches: [main, maint-6.1.x]
55
pull_request:
6-
branches: [main]
6+
branches: [main, maint-6.1.x]
77

88
env:
99
LATEST_PY_VERSION: '3.14'

CHANGES.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66

77
- support for python 3.9 and 3.10
88

9+
## [6.1.4] - 2025-12-12
10+
11+
### Fixed
12+
13+
- improve type hints
14+
- `api.app.StacAPI.search_get_request_model` now defined as `Type[APIRequest]`
15+
- `api.app.StacAPI.search_post_request_model` now defined as `Type[BaseModel]`
16+
917
## [6.1.3] - 2025-12-09
1018

1119
### Fixed
@@ -688,7 +696,8 @@ Full changelog: https://stac-utils.github.io/stac-fastapi/migrations/v3.0.0/#cha
688696

689697
* First PyPi release!
690698

691-
[Unreleased]: <https://github.com/stac-utils/stac-fastapi/compare/6.1.3..main>
699+
[Unreleased]: <https://github.com/stac-utils/stac-fastapi/compare/6.1.4..main>
700+
[6.1.4]: <https://github.com/stac-utils/stac-fastapi/compare/6.1.3..6.1.4>
692701
[6.1.3]: <https://github.com/stac-utils/stac-fastapi/compare/6.1.2..6.1.3>
693702
[6.1.2]: <https://github.com/stac-utils/stac-fastapi/compare/6.1.1..6.1.2>
694703
[6.1.1]: <https://github.com/stac-utils/stac-fastapi/compare/6.1.0..6.1.1>

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.1.3
1+
6.1.4

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "stac-fastapi"
3-
version = "6.1.3"
3+
version = "6.1.4"
44
description = "Python library for building a STAC-compliant FastAPI application."
55
requires-python = ">=3.11"
66
readme = "README.md"
@@ -81,7 +81,7 @@ explicit_package_bases = true
8181
exclude = ["tests", ".venv"]
8282

8383
[tool.bumpversion]
84-
current_version = "6.1.3"
84+
current_version = "6.1.4"
8585
parse = """(?x)
8686
(?P<major>\\d+)\\.
8787
(?P<minor>\\d+)\\.

stac_fastapi/api/stac_fastapi/api/app.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from brotli_asgi import BrotliMiddleware
99
from fastapi import APIRouter, FastAPI
1010
from fastapi.params import Depends
11+
from pydantic import BaseModel
1112
from stac_pydantic import api
1213
from stac_pydantic.shared import MimeTypes
1314
from stac_pydantic.version import STAC_VERSION
@@ -114,12 +115,8 @@ class StacApi:
114115
converter=update_openapi, # type: ignore
115116
)
116117
router: APIRouter = attr.ib(default=attr.Factory(APIRouter))
117-
search_get_request_model: Type[BaseSearchGetRequest] = attr.ib(
118-
default=BaseSearchGetRequest
119-
)
120-
search_post_request_model: Type[BaseSearchPostRequest] = attr.ib(
121-
default=BaseSearchPostRequest
122-
)
118+
search_get_request_model: Type[APIRequest] = attr.ib(default=BaseSearchGetRequest)
119+
search_post_request_model: Type[BaseModel] = attr.ib(default=BaseSearchPostRequest)
123120
collections_get_request_model: Type[APIRequest] = attr.ib(default=EmptyRequest)
124121
collection_get_request_model: Type[APIRequest] = attr.ib(default=CollectionUri)
125122
items_get_request_model: Type[APIRequest] = attr.ib(default=ItemCollectionUri)

stac_fastapi/api/stac_fastapi/api/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,5 @@ def request_validation_exception_handler(
9696
# TODO: Argument 2 to "add_exception_handler" of "Starlette" has incompatible type
9797
app.add_exception_handler(
9898
RequestValidationError,
99-
request_validation_exception_handler, # type: ignore
99+
request_validation_exception_handler, # type: ignore [arg-type]
100100
)

stac_fastapi/api/stac_fastapi/api/models.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Api request/response models."""
22

3-
from typing import List, Literal, Optional, Type, Union
3+
from typing import List, Literal, Optional, Type, Union, cast
44

55
import attr
66
from fastapi import Path, Query
@@ -24,7 +24,7 @@
2424
import orjson # noqa
2525
from fastapi.responses import ORJSONResponse as JSONResponse
2626
except ImportError: # pragma: nocover
27-
from starlette.responses import JSONResponse # type: ignore
27+
from starlette.responses import JSONResponse # type: ignore [assignment]
2828

2929

3030
def create_request_model(
@@ -49,43 +49,47 @@ def create_request_model(
4949

5050
# Handle GET requests
5151
if all([issubclass(m, APIRequest) for m in models]):
52-
return attr.make_class(model_name, attrs={}, bases=tuple(models))
52+
get_model = attr.make_class(model_name, attrs={}, bases=tuple(models))
53+
return cast(Type[APIRequest], get_model)
5354

5455
# Handle POST requests
5556
elif all([issubclass(m, BaseModel) for m in models]):
5657
for model in models:
5758
for k, field_info in model.model_fields.items(): # type: ignore
5859
fields[k] = (field_info.annotation, field_info)
5960

60-
return create_model(model_name, **fields, __base__=base_model) # type: ignore
61+
post_model = create_model(model_name, **fields, __base__=base_model) # type: ignore
62+
return cast(Type[BaseModel], post_model)
6163

6264
raise TypeError("Mixed Request Model types. Check extension request types.")
6365

6466

6567
def create_get_request_model(
6668
extensions: Optional[List[ApiExtension]],
67-
base_model: Type[BaseSearchGetRequest] = BaseSearchGetRequest,
69+
base_model: Type[APIRequest] = BaseSearchGetRequest,
6870
) -> Type[APIRequest]:
6971
"""Wrap create_request_model to create the GET request model."""
70-
return create_request_model( # type: ignore
72+
model = create_request_model(
7173
"SearchGetRequest",
7274
base_model=base_model,
7375
extensions=extensions,
7476
request_type="GET",
7577
)
78+
return cast(Type[APIRequest], model)
7679

7780

7881
def create_post_request_model(
7982
extensions: Optional[List[ApiExtension]],
80-
base_model: Type[BaseSearchPostRequest] = BaseSearchPostRequest,
83+
base_model: Type[BaseModel] = BaseSearchPostRequest,
8184
) -> Type[BaseModel]:
8285
"""Wrap create_request_model to create the POST request model."""
83-
return create_request_model( # type: ignore
86+
model = create_request_model(
8487
"SearchPostRequest",
8588
base_model=base_model,
8689
extensions=extensions,
8790
request_type="POST",
8891
)
92+
return cast(Type[BaseModel], model)
8993

9094

9195
@attr.s
@@ -121,7 +125,7 @@ class ItemCollectionUri(APIRequest, DatetimeMixin):
121125
description="Limits the number of results that are included in each page of the response (capped to 10_000)." # noqa: E501
122126
),
123127
] = attr.ib(default=10)
124-
bbox: Optional[BBox] = attr.ib(default=None, converter=_bbox_converter) # type: ignore
128+
bbox: Optional[BBox] = attr.ib(default=None, converter=_bbox_converter) # type: ignore [misc]
125129
datetime: DateTimeQueryType = attr.ib(default=None, validator=_validate_datetime)
126130

127131

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Library version."""
22

3-
__version__ = "6.1.3"
3+
__version__ = "6.1.4"

stac_fastapi/extensions/stac_fastapi/extensions/core/collection_search/collection_search.py

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Collection-Search extension."""
22

33
from enum import Enum
4-
from typing import List, Optional, Type, Union
4+
from typing import List, Optional, Type, Union, cast
55

66
import attr
77
from fastapi import APIRouter, FastAPI
@@ -87,11 +87,14 @@ def from_extensions(
8787
for ext in extensions:
8888
conformance_classes.extend(ext.conformance_classes)
8989

90-
get_request_model = create_request_model(
91-
model_name="CollectionsGetRequest",
92-
base_model=BaseCollectionSearchGetRequest,
93-
extensions=extensions,
94-
request_type="GET",
90+
get_request_model = cast(
91+
Type[APIRequest],
92+
create_request_model(
93+
model_name="CollectionsGetRequest",
94+
base_model=BaseCollectionSearchGetRequest,
95+
extensions=extensions,
96+
request_type="GET",
97+
),
9598
)
9699

97100
return cls(
@@ -164,7 +167,7 @@ def register(self, app: FastAPI) -> None:
164167
app.include_router(self.router)
165168

166169
@classmethod
167-
def from_extensions( # type: ignore
170+
def from_extensions( # type: ignore [override]
168171
cls,
169172
extensions: List[ApiExtension],
170173
*,
@@ -181,18 +184,24 @@ def from_extensions( # type: ignore
181184
for ext in extensions:
182185
conformance_classes.extend(ext.conformance_classes)
183186

184-
get_request_model = create_request_model(
185-
model_name="CollectionsGetRequest",
186-
base_model=BaseCollectionSearchGetRequest,
187-
extensions=extensions,
188-
request_type="GET",
187+
get_request_model = cast(
188+
Type[APIRequest],
189+
create_request_model(
190+
model_name="CollectionsGetRequest",
191+
base_model=BaseCollectionSearchGetRequest,
192+
extensions=extensions,
193+
request_type="GET",
194+
),
189195
)
190196

191-
post_request_model = create_request_model(
192-
model_name="CollectionsPostRequest",
193-
base_model=BaseCollectionSearchPostRequest,
194-
extensions=extensions,
195-
request_type="POST",
197+
post_request_model = cast(
198+
Type[BaseModel],
199+
create_request_model(
200+
model_name="CollectionsPostRequest",
201+
base_model=BaseCollectionSearchPostRequest,
202+
extensions=extensions,
203+
request_type="POST",
204+
),
196205
)
197206

198207
return cls(

stac_fastapi/extensions/stac_fastapi/extensions/third_party/bulk_transactions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __iter__(self):
3131
return iter(self.items.values())
3232

3333

34-
@attr.s # type: ignore
34+
@attr.s
3535
class BaseBulkTransactionsClient(abc.ABC):
3636
"""BulkTransactionsClient."""
3737

@@ -63,7 +63,7 @@ def bulk_item_insert(
6363
raise NotImplementedError
6464

6565

66-
@attr.s # type: ignore
66+
@attr.s
6767
class AsyncBaseBulkTransactionsClient(abc.ABC):
6868
"""BulkTransactionsClient."""
6969

0 commit comments

Comments
 (0)