stac-fastapi.api 5.2.1__tar.gz → 6.0.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.
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/PKG-INFO +2 -2
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/setup.py +1 -1
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi/api/app.py +1 -1
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi/api/models.py +3 -2
- stac_fastapi_api-6.0.0/stac_fastapi/api/py.typed +0 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi/api/routes.py +14 -18
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi/api/version.py +1 -1
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi.api.egg-info/PKG-INFO +2 -2
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi.api.egg-info/SOURCES.txt +1 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi.api.egg-info/requires.txt +1 -1
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/tests/test_api.py +9 -5
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/README.md +0 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/setup.cfg +0 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi/api/__init__.py +0 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi/api/config.py +0 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi/api/errors.py +0 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi/api/middleware.py +0 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi/api/openapi.py +0 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi.api.egg-info/dependency_links.txt +0 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi.api.egg-info/not-zip-safe +0 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi.api.egg-info/top_level.txt +0 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/tests/test_app.py +0 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/tests/test_app_prefix.py +0 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/tests/test_middleware.py +0 -0
- {stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/tests/test_models.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stac-fastapi.api
|
|
3
|
-
Version:
|
|
3
|
+
Version: 6.0.0
|
|
4
4
|
Summary: An implementation of STAC API based on the FastAPI framework.
|
|
5
5
|
Home-page: https://github.com/stac-utils/stac-fastapi
|
|
6
6
|
Author: Arturo Engineering
|
|
@@ -19,7 +19,7 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
19
19
|
Requires-Python: >=3.9
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
Requires-Dist: brotli_asgi
|
|
22
|
-
Requires-Dist: stac-fastapi.types~=
|
|
22
|
+
Requires-Dist: stac-fastapi.types~=6.0
|
|
23
23
|
Provides-Extra: dev
|
|
24
24
|
Requires-Dist: httpx; extra == "dev"
|
|
25
25
|
Requires-Dist: pytest; extra == "dev"
|
|
@@ -110,7 +110,7 @@ class StacApi:
|
|
|
110
110
|
),
|
|
111
111
|
takes_self=True,
|
|
112
112
|
),
|
|
113
|
-
converter=update_openapi,
|
|
113
|
+
converter=update_openapi, # type: ignore
|
|
114
114
|
)
|
|
115
115
|
router: APIRouter = attr.ib(default=attr.Factory(APIRouter))
|
|
116
116
|
search_get_request_model: Type[BaseSearchGetRequest] = attr.ib(
|
|
@@ -56,7 +56,8 @@ def create_request_model(
|
|
|
56
56
|
for model in models:
|
|
57
57
|
for k, field_info in model.model_fields.items():
|
|
58
58
|
fields[k] = (field_info.annotation, field_info)
|
|
59
|
-
|
|
59
|
+
|
|
60
|
+
return create_model(model_name, **fields, __base__=base_model) # type: ignore
|
|
60
61
|
|
|
61
62
|
raise TypeError("Mixed Request Model types. Check extension request types.")
|
|
62
63
|
|
|
@@ -121,7 +122,7 @@ class ItemCollectionUri(APIRequest, DatetimeMixin):
|
|
|
121
122
|
description="Limits the number of results that are included in each page of the response (capped to 10_000)." # noqa: E501
|
|
122
123
|
),
|
|
123
124
|
] = attr.ib(default=10)
|
|
124
|
-
bbox: Optional[BBox] = attr.ib(default=None, converter=_bbox_converter)
|
|
125
|
+
bbox: Optional[BBox] = attr.ib(default=None, converter=_bbox_converter) # type: ignore
|
|
125
126
|
datetime: DateTimeQueryType = attr.ib(default=None, validator=_validate_datetime)
|
|
126
127
|
|
|
127
128
|
|
|
File without changes
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import copy
|
|
4
4
|
import functools
|
|
5
5
|
import inspect
|
|
6
|
-
from typing import Any, Callable, Dict, List, Optional, Type, TypedDict, Union
|
|
6
|
+
from typing import Any, Awaitable, Callable, Dict, List, Optional, Type, TypedDict, Union
|
|
7
7
|
|
|
8
8
|
from fastapi import Depends, FastAPI, params
|
|
9
9
|
from fastapi.datastructures import DefaultPlaceholder
|
|
@@ -39,7 +39,7 @@ def sync_to_async(func):
|
|
|
39
39
|
def create_async_endpoint(
|
|
40
40
|
func: Callable,
|
|
41
41
|
request_model: Union[Type[APIRequest], Type[BaseModel], Dict],
|
|
42
|
-
):
|
|
42
|
+
) -> Callable[[Any, Any], Awaitable[Any]]:
|
|
43
43
|
"""Wrap a function in a coroutine which may be used to create a FastAPI endpoint.
|
|
44
44
|
|
|
45
45
|
Synchronous functions are executed asynchronously using a background thread.
|
|
@@ -48,32 +48,28 @@ def create_async_endpoint(
|
|
|
48
48
|
if not inspect.iscoroutinefunction(func):
|
|
49
49
|
func = sync_to_async(func)
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
_endpoint: Callable[[Any, Any], Awaitable[Any]]
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
if isinstance(request_model, dict):
|
|
54
|
+
|
|
55
|
+
async def _endpoint(request: Request, request_data: Dict[str, Any]):
|
|
56
|
+
"""Endpoint."""
|
|
57
|
+
return _wrap_response(await func(request_data, request=request))
|
|
58
|
+
|
|
59
|
+
elif issubclass(request_model, APIRequest):
|
|
60
|
+
|
|
61
|
+
async def _endpoint(request: Request, request_data=Depends(request_model)):
|
|
57
62
|
"""Endpoint."""
|
|
58
63
|
return _wrap_response(await func(request=request, **request_data.kwargs()))
|
|
59
64
|
|
|
60
65
|
elif issubclass(request_model, BaseModel):
|
|
61
66
|
|
|
62
|
-
async def _endpoint(
|
|
63
|
-
request: Request,
|
|
64
|
-
request_data: request_model, # type:ignore
|
|
65
|
-
):
|
|
67
|
+
async def _endpoint(request: Request, request_data: request_model): # type: ignore
|
|
66
68
|
"""Endpoint."""
|
|
67
69
|
return _wrap_response(await func(request_data, request=request))
|
|
68
70
|
|
|
69
71
|
else:
|
|
70
|
-
|
|
71
|
-
async def _endpoint(
|
|
72
|
-
request: Request,
|
|
73
|
-
request_data: Dict[str, Any], # type:ignore
|
|
74
|
-
):
|
|
75
|
-
"""Endpoint."""
|
|
76
|
-
return _wrap_response(await func(request_data, request=request))
|
|
72
|
+
raise ValueError(f"Unsupported type for request model {type(request_model)}")
|
|
77
73
|
|
|
78
74
|
return _endpoint
|
|
79
75
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stac-fastapi.api
|
|
3
|
-
Version:
|
|
3
|
+
Version: 6.0.0
|
|
4
4
|
Summary: An implementation of STAC API based on the FastAPI framework.
|
|
5
5
|
Home-page: https://github.com/stac-utils/stac-fastapi
|
|
6
6
|
Author: Arturo Engineering
|
|
@@ -19,7 +19,7 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
19
19
|
Requires-Python: >=3.9
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
Requires-Dist: brotli_asgi
|
|
22
|
-
Requires-Dist: stac-fastapi.types~=
|
|
22
|
+
Requires-Dist: stac-fastapi.types~=6.0
|
|
23
23
|
Provides-Extra: dev
|
|
24
24
|
Requires-Dist: httpx; extra == "dev"
|
|
25
25
|
Requires-Dist: pytest; extra == "dev"
|
|
@@ -3,10 +3,8 @@ from starlette.testclient import TestClient
|
|
|
3
3
|
|
|
4
4
|
from stac_fastapi.api.app import StacApi
|
|
5
5
|
from stac_fastapi.api.models import ItemCollectionUri, create_request_model
|
|
6
|
-
from stac_fastapi.extensions.core import
|
|
7
|
-
|
|
8
|
-
TransactionExtension,
|
|
9
|
-
)
|
|
6
|
+
from stac_fastapi.extensions.core import TokenPaginationExtension, TransactionExtension
|
|
7
|
+
from stac_fastapi.extensions.core.transaction import BaseTransactionsClient
|
|
10
8
|
from stac_fastapi.types import config, core
|
|
11
9
|
|
|
12
10
|
|
|
@@ -421,7 +419,7 @@ class DummyCoreClient(core.BaseCoreClient):
|
|
|
421
419
|
...
|
|
422
420
|
|
|
423
421
|
|
|
424
|
-
class DummyTransactionsClient(
|
|
422
|
+
class DummyTransactionsClient(BaseTransactionsClient):
|
|
425
423
|
"""Defines a pattern for implementing the STAC transaction extension."""
|
|
426
424
|
|
|
427
425
|
def create_item(self, *args, **kwargs):
|
|
@@ -430,6 +428,9 @@ class DummyTransactionsClient(core.BaseTransactionsClient):
|
|
|
430
428
|
def update_item(self, *args, **kwargs):
|
|
431
429
|
return "dummy response"
|
|
432
430
|
|
|
431
|
+
def patch_item(self, *args, **kwargs):
|
|
432
|
+
return "dummy response"
|
|
433
|
+
|
|
433
434
|
def delete_item(self, *args, **kwargs):
|
|
434
435
|
return "dummy response"
|
|
435
436
|
|
|
@@ -439,6 +440,9 @@ class DummyTransactionsClient(core.BaseTransactionsClient):
|
|
|
439
440
|
def update_collection(self, *args, **kwargs):
|
|
440
441
|
return "dummy response"
|
|
441
442
|
|
|
443
|
+
def patch_collection(self, *args, **kwargs):
|
|
444
|
+
return "dummy response"
|
|
445
|
+
|
|
442
446
|
def delete_collection(self, *args, **kwargs):
|
|
443
447
|
return "dummy response"
|
|
444
448
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stac_fastapi_api-5.2.1 → stac_fastapi_api-6.0.0}/stac_fastapi.api.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|