Skip to content

Commit 4979a89

Browse files
3.0 release (#743)
* prepare 3.0 * update changelog * add 3.0.0 link to changelog * purge pre-releases from comparisons * add changelog in migration guide * fix changelog --------- Co-authored-by: jonhealy1 <[email protected]>
1 parent e376e30 commit 4979a89

File tree

16 files changed

+102
-184
lines changed

16 files changed

+102
-184
lines changed

CHANGES.md

+37-26
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,43 @@
22

33
## [Unreleased]
44

5-
## [3.0.0b3] - 2024-07-25
5+
## [3.0.0] - 2024-07-29
6+
7+
Full changelog: https://stac-utils.github.io/stac-fastapi/migrations/v3.0.0/#changelog
8+
9+
**Changes since 3.0.0b3:**
10+
11+
### Changed
12+
13+
* Add version pinning (`~=3.0`) for stac-fastapi submodules
14+
* Moved `AsyncBaseFiltersClient` and `BaseFiltersClient` classes in `stac_fastapi.extensions.core.filter.client` submodule
15+
16+
### Removed
17+
18+
* Removed the `Context` extension
19+
* Removed deprecated `stac_fastapi.api.openapi.config_openapi` method and `stac_fastapi.api.openapi.VndOaiResponse` class
20+
* Removed `response_class` argument in `stac_fastapi.api.routes.create_async_endpoint` method
21+
* Removed `filter_fields` property in `stac_fastapi.extensions.core.fields.request.PostFieldsExtension` class
22+
23+
## 3.0.0b3 - 2024-07-25
624

725
### Changed
826

9-
* Add more openapi metadata in input models [#734](https://github.com/stac-utils/stac-fastapi/pull/734)
27+
* Add more openapi metadata in input models ([#734](https://github.com/stac-utils/stac-fastapi/pull/734))
1028
* Use same `Limit` (capped to `10_000`) for `/items` and `GET - /search` input models ([#738](https://github.com/stac-utils/stac-fastapi/pull/738))
1129

1230
### Added
1331

1432
* Add Free-text Extension ([#655](https://github.com/stac-utils/stac-fastapi/pull/655))
1533
* Add Collection-Search Extension ([#736](https://github.com/stac-utils/stac-fastapi/pull/736), [#739](https://github.com/stac-utils/stac-fastapi/pull/739))
1634

17-
## [3.0.0b2] - 2024-07-09
35+
## 3.0.0b2 - 2024-07-09
1836

1937
### Changed
2038

21-
* move back to `@attrs` (instead of dataclass) for `APIRequest` (model for GET request) class type [#729](https://github.com/stac-utils/stac-fastapi/pull/729)
39+
* move back to `@attrs` (instead of dataclass) for `APIRequest` (model for GET request) class type ([#729](https://github.com/stac-utils/stac-fastapi/pull/729))
2240

23-
## [3.0.0b1] - 2024-07-05
41+
## 3.0.0b1 - 2024-07-05
2442

2543
### Added
2644

@@ -32,33 +50,33 @@
3250

3351
### Removed
3452

35-
* Removed the Filter Extension dependency from `AggregationExtensionPostRequest` and `AggregationExtensionGetRequest` [#716](https://github.com/stac-utils/stac-fastapi/pull/716)
53+
* Removed the Filter Extension dependency from `AggregationExtensionPostRequest` and `AggregationExtensionGetRequest` ([#716](https://github.com/stac-utils/stac-fastapi/pull/716))
3654
* Removed `pagination_extension` attribute in `stac_fastapi.api.app.StacApi`
3755
* Removed use of `pagination_extension` in `register_get_item_collection` function (User now need to construct the request model and pass it using `items_get_request_model` attribute)
3856
* Removed use of `FieldsExtension` in `stac_fastapi.api.app.StacApi`. If users use `FieldsExtension`, they would have to handle overpassing the model validation step by returning a `JSONResponse` from the `post_search` and `get_search` client methods.
3957

4058
### Changed
4159

42-
* Replaced `@attrs` with python `@dataclass` for `APIRequest` (model for GET request) class type [#714](https://github.com/stac-utils/stac-fastapi/pull/714)
43-
* Moved `GETPagination`, `POSTPagination`, `GETTokenPagination` and `POSTTokenPagination` to `stac_fastapi.extensions.core.pagination.request` submodule [#717](https://github.com/stac-utils/stac-fastapi/pull/717)
60+
* Replaced `@attrs` with python `@dataclass` for `APIRequest` (model for GET request) class type ([#714](https://github.com/stac-utils/stac-fastapi/pull/714))
61+
* Moved `GETPagination`, `POSTPagination`, `GETTokenPagination` and `POSTTokenPagination` to `stac_fastapi.extensions.core.pagination.request` submodule ([#717](https://github.com/stac-utils/stac-fastapi/pull/717))
4462
* update FastAPI requirement to `>=0.111.0`
4563

46-
## [3.0.0a4] - 2024-06-27
64+
## 3.0.0a4 - 2024-06-27
4765

4866
### Fixed
4967

50-
* Updated default filter language in filter extension's POST search request model to match the extension's documentation [#711](https://github.com/stac-utils/stac-fastapi/issues/711)
68+
* Updated default filter language in filter extension's POST search request model to match the extension's documentation ([#711](https://github.com/stac-utils/stac-fastapi/issues/711))
5169

5270
### Removed
5371

54-
* Removed the Filter Extension depenency from `AggregationExtensionPostRequest` and `AggregationExtensionGetRequest` [#716](https://github.com/stac-utils/stac-fastapi/pull/716)
55-
* Removed `add_middleware` method in `StacApi` object and let starlette handle the middleware stack creation [721](https://github.com/stac-utils/stac-fastapi/pull/721)
72+
* Removed the Filter Extension depenency from `AggregationExtensionPostRequest` and `AggregationExtensionGetRequest` ([#716](https://github.com/stac-utils/stac-fastapi/pull/716))
73+
* Removed `add_middleware` method in `StacApi` object and let starlette handle the middleware stack creation ([#721](https://github.com/stac-utils/stac-fastapi/pull/721))
5674

57-
## [3.0.0a3] - 2024-06-13
75+
## 3.0.0a3 - 2024-06-13
5876

5977
### Added
6078

61-
* Add base support for the Aggregation extension [#684](https://github.com/stac-utils/stac-fastapi/pull/684)
79+
* Add base support for the Aggregation extension ([#684](https://github.com/stac-utils/stac-fastapi/pull/684))
6280

6381
### Changed
6482

@@ -67,13 +85,13 @@
6785
* Removed `default_includes` from `stac_fastapi.types.config.ApiSettings` ([#706](https://github.com/stac-utils/stac-fastapi/pull/706))
6886
* Deprecated *Fields* extension `PostFieldsExtension.filter_fields` property ([#706](https://github.com/stac-utils/stac-fastapi/pull/706))
6987

70-
## [3.0.0a2] - 2024-05-31
88+
## 3.0.0a2 - 2024-05-31
7189

7290
### Fixed
7391

7492
* Fix missing default (`None`) for optional `query` attribute in `QueryExtensionPostRequest` model ([#701](https://github.com/stac-utils/stac-fastapi/pull/701))
7593

76-
## [3.0.0a1] - 2024-05-22
94+
## 3.0.0a1 - 2024-05-22
7795

7896
### Changed
7997

@@ -89,7 +107,7 @@
89107

90108
* Make `str_to_interval` not return a tuple for single-value input (fixing `datetime` argument as passed to `get_search`). ([#692](https://github.com/stac-utils/stac-fastapi/pull/692))
91109

92-
## [3.0.0a0] - 2024-05-06
110+
## 3.0.0a0 - 2024-05-06
93111

94112
### Added
95113

@@ -450,15 +468,8 @@
450468

451469
* First PyPi release!
452470

453-
[Unreleased]: <https://github.com/stac-utils/stac-fastapi/compare/3.0.0b3..main>
454-
[3.0.0b3]: <https://github.com/stac-utils/stac-fastapi/compare/3.0.0b2..3.0.0b3>
455-
[3.0.0b2]: <https://github.com/stac-utils/stac-fastapi/compare/3.0.0b1..3.0.0b2>
456-
[3.0.0b1]: <https://github.com/stac-utils/stac-fastapi/compare/3.0.0a4..3.0.0b1>
457-
[3.0.0a4]: <https://github.com/stac-utils/stac-fastapi/compare/3.0.0a3..3.0.0a4>
458-
[3.0.0a3]: <https://github.com/stac-utils/stac-fastapi/compare/3.0.0a2..3.0.0a3>
459-
[3.0.0a2]: <https://github.com/stac-utils/stac-fastapi/compare/3.0.0a1..3.0.0a2>
460-
[3.0.0a1]: <https://github.com/stac-utils/stac-fastapi/compare/3.0.0a0..3.0.0a1>
461-
[3.0.0a0]: <https://github.com/stac-utils/stac-fastapi/compare/2.5.5.post1..3.0.0a0>
471+
[Unreleased]: <https://github.com/stac-utils/stac-fastapi/compare/3.0.0..main>
472+
[3.0.0]: <https://github.com/stac-utils/stac-fastapi/compare/2.5.5.post1..3.0.0>
462473
[2.5.5.post1]: <https://github.com/stac-utils/stac-fastapi/compare/2.5.5..2.5.5.post1>
463474
[2.5.5]: <https://github.com/stac-utils/stac-fastapi/compare/2.5.4..2.5.5>
464475
[2.5.4]: <https://github.com/stac-utils/stac-fastapi/compare/2.5.3..2.5.4>

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.0b3
1+
3.0.0

docs/src/migrations/v3.0.0.md

+54
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,60 @@
33

44
This document aims to help you update your application from **stac-fastapi** 2.5 to 3.0.0.
55

6+
## CHANGELOG
7+
8+
### Removed
9+
10+
* Removed the `Context` extension
11+
* Removed `stac_fastapi.api.openapi.config_openapi` method and `stac_fastapi.api.openapi.VndOaiResponse` class
12+
* Removed `response_class` argument in `stac_fastapi.api.routes.create_async_endpoint` method
13+
* Removed `filter_fields` property in `stac_fastapi.extensions.core.fields.request.PostFieldsExtension` class
14+
* Removed `pagination_extension` attribute in `stac_fastapi.api.app.StacApi`
15+
* Removed `default_includes` from `stac_fastapi.types.config.ApiSettings` ([#706](https://github.com/stac-utils/stac-fastapi/pull/706))
16+
* Removed use of `pagination_extension` in `register_get_item_collection` function (User now need to construct the request model and pass it using `items_get_request_model` attribute)
17+
* Removed use of `FieldsExtension` in `stac_fastapi.api.app.StacApi`. NOTE: If users use `FieldsExtension`, they HAVE TO handle skipping the model validation step by returning a `JSONResponse` from the `post_search` and `get_search` client methods
18+
* Removed `add_middleware` method in `StacApi` object and let starlette handle the middleware stack creation ([#721](https://github.com/stac-utils/stac-fastapi/pull/721))
19+
* Removed `pystac` dependecy, as it was just used for a *datetime-to-string* function ([#690](https://github.com/stac-utils/stac-fastapi/pull/690))
20+
* Removed internal Search and Operator Types in favor of stac_pydantic Types ([#625](https://github.com/stac-utils/stac-fastapi/pull/625))
21+
22+
### Changed
23+
24+
* Update to **pydantic 2.0** ([#625](https://github.com/stac-utils/stac-fastapi/pull/625))
25+
* Update stac-pydantic requirement to `~3.1` ([#697](https://github.com/stac-utils/stac-fastapi/pull/697))
26+
* Switch from `fastapi` to `fastapi-slim` to avoid installing unwanted dependencies ([#687](https://github.com/stac-utils/stac-fastapi/pull/687))
27+
* Update FastAPI requirement to `>=0.111.0`
28+
* Moved `AsyncBaseFiltersClient` and `BaseFiltersClient` classes in `stac_fastapi.extensions.core.filter.client` submodule
29+
* Add more openapi metadata in input models ([#734](https://github.com/stac-utils/stac-fastapi/pull/734))
30+
* Use same `Limit` (capped to `10_000`) for `/items` and `GET - /search` input models ([#738](https://github.com/stac-utils/stac-fastapi/pull/738))
31+
* Moved `GETPagination`, `POSTPagination`, `GETTokenPagination` and `POSTTokenPagination` to `stac_fastapi.extensions.core.pagination.request` submodule ([#717](https://github.com/stac-utils/stac-fastapi/pull/717))
32+
* Added option for default route dependencies `*` can be used for `path` or `method` to match all allowed route. ([#705](https://github.com/stac-utils/stac-fastapi/pull/705))
33+
* Moved `AsyncBaseFiltersClient` and `BaseFiltersClient` classes in `stac_fastapi.extensions.core.filter.client` submodule ([#704](https://github.com/stac-utils/stac-fastapi/pull/704))
34+
* Replace Enum with `Literal` for `FilterLang`. ([#686](https://github.com/stac-utils/stac-fastapi/pull/686))
35+
* Fix response model *validation* ([#625](https://github.com/stac-utils/stac-fastapi/pull/625))
36+
* Use status code 201 for Item/Collection creation ([#625](https://github.com/stac-utils/stac-fastapi/pull/625))
37+
* Add `response_class` attribute in `FilterExtension` class
38+
* Add version pinning (`~=3.0`) for stac-fastapi submodules
39+
40+
### Fixed
41+
42+
* Updated default `filter` language in filter extension's POST search request model to match the extension's documentation ([#711](https://github.com/stac-utils/stac-fastapi/issues/711))
43+
* Fix missing default (`None`) for optional `query` attribute in `QueryExtensionPostRequest` model ([#701](https://github.com/stac-utils/stac-fastapi/pull/701))
44+
* Make `str_to_interval` not return a tuple for single-value input (fixing `datetime` argument as passed to `get_search`). ([#692](https://github.com/stac-utils/stac-fastapi/pull/692))
45+
46+
### Added
47+
48+
* Add enhanced middleware configuration to the StacApi class, enabling specific middleware options and dynamic addition post-application initialization. ([#442](https://github.com/stac-utils/stac-fastapi/pull/442))
49+
* Add *response* pydantic models to OpenAPI, even if model validation is turned off ([#625](https://github.com/stac-utils/stac-fastapi/pull/625))
50+
* Add attributes to `stac_fastapi.api.app.StacApi` to enable customization of request model for:
51+
- `/collections`: **collections_get_request_model**, default to `EmptyRequest`
52+
- `/collections/{collection_id}`: **collection_get_request_model**, default to `CollectionUri`
53+
- `/collections/{collection_id}/items`: **items_get_request_model**, default to `ItemCollectionUri`
54+
- `/collections/{collection_id}/items/{item_id}`: **item_get_request_model**, default to `ItemUri`
55+
* Add **Aggregation** extension ([#684](https://github.com/stac-utils/stac-fastapi/pull/684))
56+
* Add **Free-text** extension ([#655](https://github.com/stac-utils/stac-fastapi/pull/655))
57+
* Add **Collection-Search** extension ([#736](https://github.com/stac-utils/stac-fastapi/pull/736), [#739](https://github.com/stac-utils/stac-fastapi/pull/739))
58+
59+
660
## Dependencies
761

862
- **pydantic~=2.0**

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ section-order = ["future", "standard-library", "third-party", "first-party", "lo
2424
quote-style = "double"
2525

2626
[tool.bumpversion]
27-
current_version = "3.0.0b3"
27+
current_version = "3.0.0"
2828
parse = """(?x)
2929
(?P<major>\\d+)\\.
3030
(?P<minor>\\d+)\\.

stac_fastapi/api/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
install_requires = [
99
"brotli_asgi",
10-
"stac-fastapi.types",
10+
"stac-fastapi.types~=3.0",
1111
]
1212

1313
extra_reqs = {

stac_fastapi/api/stac_fastapi/api/config.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class ApiExtensions(enum.Enum):
1212
Ref: https://github.com/stac-api-extensions
1313
"""
1414

15-
context = "context"
1615
fields = "fields"
1716
filter = "filter"
1817
query = "query"
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,10 @@
11
"""openapi."""
22

3-
import warnings
4-
53
from fastapi import FastAPI
6-
from fastapi.openapi.utils import get_openapi
74
from starlette.requests import Request
85
from starlette.responses import JSONResponse, Response
96
from starlette.routing import Route, request_response
107

11-
from stac_fastapi.api.config import ApiExtensions
12-
from stac_fastapi.types.config import ApiSettings
13-
14-
15-
class VndOaiResponse(JSONResponse):
16-
"""JSON with custom, vendor content-type."""
17-
18-
media_type = "application/vnd.oai.openapi+json;version=3.0"
19-
20-
def __init__(self, *args, **kwargs):
21-
"""Init function with deprecation warning."""
22-
warnings.warn(
23-
"VndOaiResponse is deprecated and will be removed in v3.0",
24-
DeprecationWarning,
25-
)
26-
super().__init__(*args, **kwargs)
27-
288

299
def update_openapi(app: FastAPI) -> FastAPI:
3010
"""Update OpenAPI response content-type.
@@ -55,33 +35,3 @@ async def patched_openapi_endpoint(req: Request) -> Response:
5535

5636
# return the patched app
5737
return app
58-
59-
60-
def config_openapi(app: FastAPI, settings: ApiSettings):
61-
"""Config openapi."""
62-
warnings.warn(
63-
"config_openapi is deprecated and will be removed in v3.0",
64-
DeprecationWarning,
65-
)
66-
67-
def custom_openapi():
68-
"""Config openapi."""
69-
if app.openapi_schema:
70-
return app.openapi_schema
71-
72-
openapi_schema = get_openapi(
73-
title="Arturo STAC API", version="0.1", routes=app.routes
74-
)
75-
76-
if settings.api_extension_is_enabled(ApiExtensions.fields):
77-
openapi_schema["paths"]["/search"]["get"]["responses"]["200"]["content"][
78-
"application/json"
79-
]["schema"] = {"$ref": "#/components/schemas/ItemCollection"}
80-
openapi_schema["paths"]["/search"]["post"]["responses"]["200"]["content"][
81-
"application/json"
82-
]["schema"] = {"$ref": "#/components/schemas/ItemCollection"}
83-
84-
app.openapi_schema = openapi_schema
85-
return app.openapi_schema
86-
87-
app.openapi = custom_openapi

stac_fastapi/api/stac_fastapi/api/routes.py

-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import copy
44
import functools
55
import inspect
6-
import warnings
76
from typing import Any, Callable, Dict, List, Optional, Type, TypedDict, Union
87

98
from fastapi import Depends, params
@@ -38,19 +37,12 @@ async def run(*args, **kwargs):
3837
def create_async_endpoint(
3938
func: Callable,
4039
request_model: Union[Type[APIRequest], Type[BaseModel], Dict],
41-
response_class: Optional[Type[Response]] = None,
4240
):
4341
"""Wrap a function in a coroutine which may be used to create a FastAPI endpoint.
4442
4543
Synchronous functions are executed asynchronously using a background thread.
4644
"""
4745

48-
if response_class:
49-
warnings.warn(
50-
"`response_class` option is deprecated, please set the Response class directly in the endpoint.", # noqa: E501
51-
DeprecationWarning,
52-
)
53-
5446
if not inspect.iscoroutinefunction(func):
5547
func = sync_to_async(func)
5648

Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""Library version."""
2-
__version__ = "3.0.0b3"
2+
3+
__version__ = "3.0.0"

stac_fastapi/extensions/setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
desc = f.read()
88

99
install_requires = [
10-
"stac-fastapi.types",
11-
"stac-fastapi.api",
10+
"stac-fastapi.types~=3.0",
11+
"stac-fastapi.api~=3.0",
1212
]
1313

1414
extra_reqs = {

stac_fastapi/extensions/stac_fastapi/extensions/core/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from .aggregation import AggregationExtension
44
from .collection_search import CollectionSearchExtension, CollectionSearchPostExtension
5-
from .context import ContextExtension
65
from .fields import FieldsExtension
76
from .filter import FilterExtension
87
from .free_text import FreeTextAdvancedExtension, FreeTextExtension
@@ -13,7 +12,6 @@
1312

1413
__all__ = (
1514
"AggregationExtension",
16-
"ContextExtension",
1715
"FieldsExtension",
1816
"FilterExtension",
1917
"FreeTextExtension",

stac_fastapi/extensions/stac_fastapi/extensions/core/context.py

-46
This file was deleted.

0 commit comments

Comments
 (0)