stac-fastapi.types 5.2.0__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.
Files changed (26) hide show
  1. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/PKG-INFO +2 -2
  2. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/setup.py +1 -1
  3. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi/types/core.py +6 -237
  4. stac_fastapi_types-6.0.0/stac_fastapi/types/py.typed +0 -0
  5. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi/types/search.py +11 -3
  6. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi/types/version.py +1 -1
  7. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi.types.egg-info/PKG-INFO +2 -2
  8. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi.types.egg-info/SOURCES.txt +1 -0
  9. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi.types.egg-info/requires.txt +1 -1
  10. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/README.md +0 -0
  11. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/setup.cfg +0 -0
  12. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi/types/__init__.py +0 -0
  13. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi/types/config.py +0 -0
  14. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi/types/conformance.py +0 -0
  15. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi/types/errors.py +0 -0
  16. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi/types/extension.py +0 -0
  17. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi/types/links.py +0 -0
  18. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi/types/requests.py +0 -0
  19. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi/types/rfc3339.py +0 -0
  20. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi/types/stac.py +0 -0
  21. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi.types.egg-info/dependency_links.txt +0 -0
  22. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi.types.egg-info/not-zip-safe +0 -0
  23. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/stac_fastapi.types.egg-info/top_level.txt +0 -0
  24. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/tests/test_config.py +0 -0
  25. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/tests/test_limit.py +0 -0
  26. {stac_fastapi_types-5.2.0 → stac_fastapi_types-6.0.0}/tests/test_rfc3339.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stac-fastapi.types
3
- Version: 5.2.0
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
@@ -21,7 +21,7 @@ Description-Content-Type: text/markdown
21
21
  Requires-Dist: fastapi>=0.109.0
22
22
  Requires-Dist: attrs>=23.2.0
23
23
  Requires-Dist: pydantic-settings>=2
24
- Requires-Dist: stac_pydantic<4.0,>=3.1.3
24
+ Requires-Dist: stac_pydantic<4.0,>=3.3.0
25
25
  Requires-Dist: iso8601<2.2.0,>=1.0.2
26
26
  Provides-Extra: dev
27
27
  Requires-Dist: pytest; extra == "dev"
@@ -9,7 +9,7 @@ install_requires = [
9
9
  "fastapi>=0.109.0",
10
10
  "attrs>=23.2.0",
11
11
  "pydantic-settings>=2",
12
- "stac_pydantic>=3.1.3,<4.0",
12
+ "stac_pydantic>=3.3.0,<4.0",
13
13
  "iso8601>=1.0.2,<2.2.0",
14
14
  ]
15
15
 
@@ -7,24 +7,20 @@ from urllib.parse import urljoin
7
7
  import attr
8
8
  from fastapi import Request
9
9
  from geojson_pydantic.geometries import Geometry
10
- from stac_pydantic import Collection, Item, ItemCollection
11
10
  from stac_pydantic.links import Relations
12
11
  from stac_pydantic.shared import BBox, MimeTypes
13
12
  from stac_pydantic.version import STAC_VERSION
14
- from starlette.responses import Response
15
13
 
16
- from stac_fastapi.types import stac
17
- from stac_fastapi.types.config import ApiSettings
18
- from stac_fastapi.types.conformance import BASE_CONFORMANCE_CLASSES
19
- from stac_fastapi.types.extension import ApiExtension
20
- from stac_fastapi.types.requests import get_base_url
21
- from stac_fastapi.types.search import BaseSearchPostRequest
14
+ from . import stac
15
+ from .config import ApiSettings
16
+ from .conformance import BASE_CONFORMANCE_CLASSES
17
+ from .extension import ApiExtension
18
+ from .requests import get_base_url
19
+ from .search import BaseSearchPostRequest
22
20
 
23
21
  __all__ = [
24
22
  "NumType",
25
23
  "StacType",
26
- "BaseTransactionsClient",
27
- "AsyncBaseTransactionsClient",
28
24
  "LandingPageMixin",
29
25
  "BaseCoreClient",
30
26
  "AsyncBaseCoreClient",
@@ -36,233 +32,6 @@ StacType = Dict[str, Any]
36
32
  api_settings = ApiSettings()
37
33
 
38
34
 
39
- @attr.s # type:ignore
40
- class BaseTransactionsClient(abc.ABC):
41
- """Defines a pattern for implementing the STAC API Transaction Extension."""
42
-
43
- @abc.abstractmethod
44
- def create_item(
45
- self,
46
- collection_id: str,
47
- item: Union[Item, ItemCollection],
48
- **kwargs,
49
- ) -> Optional[Union[stac.Item, Response, None]]:
50
- """Create a new item.
51
-
52
- Called with `POST /collections/{collection_id}/items`.
53
-
54
- Args:
55
- item: the item or item collection
56
- collection_id: the id of the collection from the resource path
57
-
58
- Returns:
59
- The item that was created or None if item collection.
60
- """
61
- ...
62
-
63
- @abc.abstractmethod
64
- def update_item(
65
- self, collection_id: str, item_id: str, item: Item, **kwargs
66
- ) -> Optional[Union[stac.Item, Response]]:
67
- """Perform a complete update on an existing item.
68
-
69
- Called with `PUT /collections/{collection_id}/items`. It is expected
70
- that this item already exists. The update should do a diff against the
71
- saved item and perform any necessary updates. Partial updates are not
72
- supported by the transactions extension.
73
-
74
- Args:
75
- item: the item (must be complete)
76
- collection_id: the id of the collection from the resource path
77
-
78
- Returns:
79
- The updated item.
80
- """
81
- ...
82
-
83
- @abc.abstractmethod
84
- def delete_item(
85
- self, item_id: str, collection_id: str, **kwargs
86
- ) -> Optional[Union[stac.Item, Response]]:
87
- """Delete an item from a collection.
88
-
89
- Called with `DELETE /collections/{collection_id}/items/{item_id}`
90
-
91
- Args:
92
- item_id: id of the item.
93
- collection_id: id of the collection.
94
-
95
- Returns:
96
- The deleted item.
97
- """
98
- ...
99
-
100
- @abc.abstractmethod
101
- def create_collection(
102
- self, collection: Collection, **kwargs
103
- ) -> Optional[Union[stac.Collection, Response]]:
104
- """Create a new collection.
105
-
106
- Called with `POST /collections`.
107
-
108
- Args:
109
- collection: the collection
110
-
111
- Returns:
112
- The collection that was created.
113
- """
114
- ...
115
-
116
- @abc.abstractmethod
117
- def update_collection(
118
- self, collection_id: str, collection: Collection, **kwargs
119
- ) -> Optional[Union[stac.Collection, Response]]:
120
- """Perform a complete update on an existing collection.
121
-
122
- Called with `PUT /collections/{collection_id}`. It is expected that this
123
- collection already exists. The update should do a diff against the saved
124
- collection and perform any necessary updates. Partial updates are not
125
- supported by the transactions extension.
126
-
127
- Args:
128
- collection_id: id of the existing collection to be updated
129
- collection: the updated collection (must be complete)
130
-
131
- Returns:
132
- The updated collection.
133
- """
134
- ...
135
-
136
- @abc.abstractmethod
137
- def delete_collection(
138
- self, collection_id: str, **kwargs
139
- ) -> Optional[Union[stac.Collection, Response]]:
140
- """Delete a collection.
141
-
142
- Called with `DELETE /collections/{collection_id}`
143
-
144
- Args:
145
- collection_id: id of the collection.
146
-
147
- Returns:
148
- The deleted collection.
149
- """
150
- ...
151
-
152
-
153
- @attr.s # type:ignore
154
- class AsyncBaseTransactionsClient(abc.ABC):
155
- """Defines a pattern for implementing the STAC transaction extension."""
156
-
157
- @abc.abstractmethod
158
- async def create_item(
159
- self,
160
- collection_id: str,
161
- item: Union[Item, ItemCollection],
162
- **kwargs,
163
- ) -> Optional[Union[stac.Item, Response, None]]:
164
- """Create a new item.
165
-
166
- Called with `POST /collections/{collection_id}/items`.
167
-
168
- Args:
169
- item: the item or item collection
170
- collection_id: the id of the collection from the resource path
171
-
172
- Returns:
173
- The item that was created or None if item collection.
174
- """
175
- ...
176
-
177
- @abc.abstractmethod
178
- async def update_item(
179
- self, collection_id: str, item_id: str, item: Item, **kwargs
180
- ) -> Optional[Union[stac.Item, Response]]:
181
- """Perform a complete update on an existing item.
182
-
183
- Called with `PUT /collections/{collection_id}/items`. It is expected
184
- that this item already exists. The update should do a diff against the
185
- saved item and perform any necessary updates. Partial updates are not
186
- supported by the transactions extension.
187
-
188
- Args:
189
- item: the item (must be complete)
190
-
191
- Returns:
192
- The updated item.
193
- """
194
- ...
195
-
196
- @abc.abstractmethod
197
- async def delete_item(
198
- self, item_id: str, collection_id: str, **kwargs
199
- ) -> Optional[Union[stac.Item, Response]]:
200
- """Delete an item from a collection.
201
-
202
- Called with `DELETE /collections/{collection_id}/items/{item_id}`
203
-
204
- Args:
205
- item_id: id of the item.
206
- collection_id: id of the collection.
207
-
208
- Returns:
209
- The deleted item.
210
- """
211
- ...
212
-
213
- @abc.abstractmethod
214
- async def create_collection(
215
- self, collection: Collection, **kwargs
216
- ) -> Optional[Union[stac.Collection, Response]]:
217
- """Create a new collection.
218
-
219
- Called with `POST /collections`.
220
-
221
- Args:
222
- collection: the collection
223
-
224
- Returns:
225
- The collection that was created.
226
- """
227
- ...
228
-
229
- @abc.abstractmethod
230
- async def update_collection(
231
- self, collection_id: str, collection: Collection, **kwargs
232
- ) -> Optional[Union[stac.Collection, Response]]:
233
- """Perform a complete update on an existing collection.
234
-
235
- Called with `PUT /collections/{collection_id}`. It is expected that this item
236
- already exists. The update should do a diff against the saved collection and
237
- perform any necessary updates. Partial updates are not supported by the
238
- transactions extension.
239
-
240
- Args:
241
- collection_id: id of the existing collection to be updated
242
- collection: the updated collection (must be complete)
243
-
244
- Returns:
245
- The updated collection.
246
- """
247
- ...
248
-
249
- @abc.abstractmethod
250
- async def delete_collection(
251
- self, collection_id: str, **kwargs
252
- ) -> Optional[Union[stac.Collection, Response]]:
253
- """Delete a collection.
254
-
255
- Called with `DELETE /collections/{collection_id}`
256
-
257
- Args:
258
- collection_id: id of the collection.
259
-
260
- Returns:
261
- The deleted collection.
262
- """
263
- ...
264
-
265
-
266
35
  @attr.s
267
36
  class LandingPageMixin(abc.ABC):
268
37
  """Create a STAC landing page (GET /)."""
File without changes
@@ -5,7 +5,7 @@ from datetime import datetime as dt
5
5
  from typing import Dict, List, Optional, Union
6
6
 
7
7
  import attr
8
- from fastapi import Query
8
+ from fastapi import HTTPException, Query
9
9
  from pydantic import Field, PositiveInt
10
10
  from pydantic.functional_validators import AfterValidator
11
11
  from stac_pydantic.api import Search
@@ -34,8 +34,16 @@ def str2list(x: str) -> Optional[List[str]]:
34
34
  def str2bbox(x: str) -> Optional[BBox]:
35
35
  """Convert string to BBox based on , delimiter."""
36
36
  if x:
37
- t = tuple(float(v) for v in x.split(","))
38
- assert len(t) in [4, 6], f"BBox '{x}' must have 4 or 6 values."
37
+ try:
38
+ t = tuple(float(v) for v in x.split(","))
39
+ except ValueError:
40
+ raise HTTPException(status_code=400, detail=f"invalid bbox: {x}")
41
+
42
+ if len(t) not in (4, 6):
43
+ raise HTTPException(
44
+ status_code=400, detail=f"BBox '{x}' must have 4 or 6 values."
45
+ )
46
+
39
47
  return t
40
48
 
41
49
  return None
@@ -1,3 +1,3 @@
1
1
  """Library version."""
2
2
 
3
- __version__ = "5.2.0"
3
+ __version__ = "6.0.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stac-fastapi.types
3
- Version: 5.2.0
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
@@ -21,7 +21,7 @@ Description-Content-Type: text/markdown
21
21
  Requires-Dist: fastapi>=0.109.0
22
22
  Requires-Dist: attrs>=23.2.0
23
23
  Requires-Dist: pydantic-settings>=2
24
- Requires-Dist: stac_pydantic<4.0,>=3.1.3
24
+ Requires-Dist: stac_pydantic<4.0,>=3.3.0
25
25
  Requires-Dist: iso8601<2.2.0,>=1.0.2
26
26
  Provides-Extra: dev
27
27
  Requires-Dist: pytest; extra == "dev"
@@ -14,6 +14,7 @@ stac_fastapi/types/core.py
14
14
  stac_fastapi/types/errors.py
15
15
  stac_fastapi/types/extension.py
16
16
  stac_fastapi/types/links.py
17
+ stac_fastapi/types/py.typed
17
18
  stac_fastapi/types/requests.py
18
19
  stac_fastapi/types/rfc3339.py
19
20
  stac_fastapi/types/search.py
@@ -1,7 +1,7 @@
1
1
  fastapi>=0.109.0
2
2
  attrs>=23.2.0
3
3
  pydantic-settings>=2
4
- stac_pydantic<4.0,>=3.1.3
4
+ stac_pydantic<4.0,>=3.3.0
5
5
  iso8601<2.2.0,>=1.0.2
6
6
 
7
7
  [dev]