eodag 2.12.1__py3-none-any.whl → 3.0.0__py3-none-any.whl

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 (93) hide show
  1. eodag/__init__.py +6 -8
  2. eodag/api/core.py +654 -538
  3. eodag/api/product/__init__.py +12 -2
  4. eodag/api/product/_assets.py +59 -16
  5. eodag/api/product/_product.py +100 -93
  6. eodag/api/product/drivers/__init__.py +7 -2
  7. eodag/api/product/drivers/base.py +0 -3
  8. eodag/api/product/metadata_mapping.py +192 -96
  9. eodag/api/search_result.py +69 -10
  10. eodag/cli.py +55 -25
  11. eodag/config.py +391 -116
  12. eodag/plugins/apis/base.py +11 -168
  13. eodag/plugins/apis/ecmwf.py +36 -25
  14. eodag/plugins/apis/usgs.py +80 -35
  15. eodag/plugins/authentication/aws_auth.py +13 -4
  16. eodag/plugins/authentication/base.py +10 -1
  17. eodag/plugins/authentication/generic.py +2 -2
  18. eodag/plugins/authentication/header.py +31 -6
  19. eodag/plugins/authentication/keycloak.py +17 -84
  20. eodag/plugins/authentication/oauth.py +3 -3
  21. eodag/plugins/authentication/openid_connect.py +268 -49
  22. eodag/plugins/authentication/qsauth.py +4 -1
  23. eodag/plugins/authentication/sas_auth.py +9 -2
  24. eodag/plugins/authentication/token.py +98 -47
  25. eodag/plugins/authentication/token_exchange.py +122 -0
  26. eodag/plugins/crunch/base.py +3 -1
  27. eodag/plugins/crunch/filter_date.py +3 -9
  28. eodag/plugins/crunch/filter_latest_intersect.py +0 -3
  29. eodag/plugins/crunch/filter_latest_tpl_name.py +1 -4
  30. eodag/plugins/crunch/filter_overlap.py +4 -8
  31. eodag/plugins/crunch/filter_property.py +5 -11
  32. eodag/plugins/download/aws.py +149 -185
  33. eodag/plugins/download/base.py +88 -97
  34. eodag/plugins/download/creodias_s3.py +1 -1
  35. eodag/plugins/download/http.py +638 -310
  36. eodag/plugins/download/s3rest.py +47 -45
  37. eodag/plugins/manager.py +228 -88
  38. eodag/plugins/search/__init__.py +36 -0
  39. eodag/plugins/search/base.py +239 -30
  40. eodag/plugins/search/build_search_result.py +382 -37
  41. eodag/plugins/search/cop_marine.py +441 -0
  42. eodag/plugins/search/creodias_s3.py +25 -20
  43. eodag/plugins/search/csw.py +5 -7
  44. eodag/plugins/search/data_request_search.py +61 -30
  45. eodag/plugins/search/qssearch.py +713 -255
  46. eodag/plugins/search/static_stac_search.py +106 -40
  47. eodag/resources/ext_product_types.json +1 -1
  48. eodag/resources/product_types.yml +1921 -34
  49. eodag/resources/providers.yml +4091 -3655
  50. eodag/resources/stac.yml +50 -216
  51. eodag/resources/stac_api.yml +71 -25
  52. eodag/resources/stac_provider.yml +5 -0
  53. eodag/resources/user_conf_template.yml +89 -32
  54. eodag/rest/__init__.py +6 -0
  55. eodag/rest/cache.py +70 -0
  56. eodag/rest/config.py +68 -0
  57. eodag/rest/constants.py +26 -0
  58. eodag/rest/core.py +735 -0
  59. eodag/rest/errors.py +178 -0
  60. eodag/rest/server.py +264 -431
  61. eodag/rest/stac.py +442 -836
  62. eodag/rest/types/collections_search.py +44 -0
  63. eodag/rest/types/eodag_search.py +238 -47
  64. eodag/rest/types/queryables.py +164 -0
  65. eodag/rest/types/stac_search.py +273 -0
  66. eodag/rest/utils/__init__.py +216 -0
  67. eodag/rest/utils/cql_evaluate.py +119 -0
  68. eodag/rest/utils/rfc3339.py +64 -0
  69. eodag/types/__init__.py +106 -10
  70. eodag/types/bbox.py +15 -14
  71. eodag/types/download_args.py +40 -0
  72. eodag/types/search_args.py +57 -7
  73. eodag/types/whoosh.py +79 -0
  74. eodag/utils/__init__.py +110 -91
  75. eodag/utils/constraints.py +37 -45
  76. eodag/utils/exceptions.py +39 -22
  77. eodag/utils/import_system.py +0 -4
  78. eodag/utils/logging.py +37 -80
  79. eodag/utils/notebook.py +4 -4
  80. eodag/utils/repr.py +113 -0
  81. eodag/utils/requests.py +128 -0
  82. eodag/utils/rest.py +100 -0
  83. eodag/utils/stac_reader.py +93 -21
  84. {eodag-2.12.1.dist-info → eodag-3.0.0.dist-info}/METADATA +88 -53
  85. eodag-3.0.0.dist-info/RECORD +109 -0
  86. {eodag-2.12.1.dist-info → eodag-3.0.0.dist-info}/WHEEL +1 -1
  87. {eodag-2.12.1.dist-info → eodag-3.0.0.dist-info}/entry_points.txt +7 -5
  88. eodag/plugins/apis/cds.py +0 -540
  89. eodag/rest/types/stac_queryables.py +0 -134
  90. eodag/rest/utils.py +0 -1133
  91. eodag-2.12.1.dist-info/RECORD +0 -94
  92. {eodag-2.12.1.dist-info → eodag-3.0.0.dist-info}/LICENSE +0 -0
  93. {eodag-2.12.1.dist-info → eodag-3.0.0.dist-info}/top_level.txt +0 -0
@@ -20,7 +20,7 @@ peps:
20
20
  search: # Search parameters configuration
21
21
  download:
22
22
  extract: # whether to extract the downloaded products, only applies to archived products (true or false, Default: true).
23
- outputs_prefix: # where to store downloaded products, as an absolute file path (Default: local temporary directory)
23
+ output_dir: # where to store downloaded products, as an absolute file path (Default: local temporary directory)
24
24
  dl_url_params: # additional parameters to pass over to the download url as an url parameter
25
25
  delete_archive: # whether to delete the downloaded archives (true or false, Default: true).
26
26
  auth:
@@ -32,7 +32,7 @@ theia:
32
32
  search: # Search parameters configuration
33
33
  download:
34
34
  extract:
35
- outputs_prefix:
35
+ output_dir:
36
36
  dl_url_params:
37
37
  auth:
38
38
  credentials:
@@ -42,7 +42,7 @@ usgs:
42
42
  priority: # Lower value means lower priority (Default: 0)
43
43
  api:
44
44
  extract:
45
- outputs_prefix:
45
+ output_dir:
46
46
  dl_url_params:
47
47
  product_location_scheme:
48
48
  credentials:
@@ -51,20 +51,22 @@ usgs:
51
51
  aws_eos:
52
52
  priority: # Lower value means lower priority (Default: 0)
53
53
  search: # Search parameters configuration
54
- auth:
54
+ search_auth:
55
+ credentials:
56
+ api_key:
57
+ download_auth:
55
58
  credentials:
56
- apikey:
57
59
  aws_access_key_id:
58
60
  aws_secret_access_key:
59
61
  aws_profile:
60
62
  download:
61
- outputs_prefix:
63
+ output_dir:
62
64
  creodias:
63
65
  priority: # Lower value means lower priority (Default: 0)
64
66
  search: # Search parameters configuration
65
67
  download:
66
68
  extract:
67
- outputs_prefix:
69
+ output_dir:
68
70
  auth:
69
71
  credentials:
70
72
  username:
@@ -75,7 +77,7 @@ onda:
75
77
  search: # Search parameters configuration
76
78
  download:
77
79
  extract:
78
- outputs_prefix:
80
+ output_dir:
79
81
  auth:
80
82
  credentials:
81
83
  username:
@@ -89,7 +91,7 @@ astraea_eod:
89
91
  aws_secret_access_key:
90
92
  aws_profile:
91
93
  download:
92
- outputs_prefix:
94
+ output_dir:
93
95
  usgs_satapi_aws:
94
96
  priority: # Lower value means lower priority (Default: 0)
95
97
  search: # Search parameters configuration
@@ -99,7 +101,7 @@ usgs_satapi_aws:
99
101
  aws_secret_access_key:
100
102
  aws_profile:
101
103
  download:
102
- outputs_prefix:
104
+ output_dir:
103
105
  earth_search:
104
106
  priority: # Lower value means lower priority (Default: 0)
105
107
  search: # Search parameters configuration
@@ -109,12 +111,12 @@ earth_search:
109
111
  aws_secret_access_key:
110
112
  aws_profile:
111
113
  download:
112
- outputs_prefix:
114
+ output_dir:
113
115
  earth_search_cog:
114
116
  priority: # Lower value means lower priority (Default: 0)
115
117
  search: # Search parameters configuration
116
118
  download:
117
- outputs_prefix:
119
+ output_dir:
118
120
  earth_search_gcs:
119
121
  priority: # Lower value means lower priority (Default: 0)
120
122
  search: # Search parameters configuration
@@ -123,34 +125,38 @@ earth_search_gcs:
123
125
  aws_access_key_id:
124
126
  aws_secret_access_key:
125
127
  download:
126
- outputs_prefix:
128
+ output_dir:
127
129
  ecmwf:
128
130
  priority: # Lower value means lower priority (Default: 0)
129
131
  api:
130
- outputs_prefix:
132
+ output_dir:
131
133
  credentials:
132
134
  username:
133
135
  password:
134
136
  cop_ads:
135
137
  priority: # Lower value means lower priority (Default: 0)
136
- api:
137
- outputs_prefix:
138
- credentials:
139
- username:
140
- password:
138
+ search: # Search parameters configuration
139
+ download:
140
+ extract:
141
+ output_dir:
142
+ auth:
143
+ credentials:
144
+ apikey:
141
145
  cop_cds:
142
146
  priority: # Lower value means lower priority (Default: 0)
143
- api:
144
- outputs_prefix:
147
+ search: # Search parameters configuration
148
+ download:
149
+ extract:
150
+ output_dir:
151
+ auth:
145
152
  credentials:
146
- username:
147
- password:
153
+ apikey:
148
154
  sara:
149
155
  priority: # Lower value means lower priority (Default: 0)
150
156
  search: # Search parameters configuration
151
157
  download:
152
158
  extract:
153
- outputs_prefix:
159
+ output_dir:
154
160
  delete_archive:
155
161
  auth:
156
162
  credentials:
@@ -163,13 +169,13 @@ meteoblue:
163
169
  credentials:
164
170
  apikey:
165
171
  download:
166
- outputs_prefix:
172
+ output_dir:
167
173
  cop_dataspace:
168
174
  priority: # Lower value means lower priority (Default: 0)
169
175
  search: # Search parameters configuration
170
176
  download:
171
177
  extract:
172
- outputs_prefix:
178
+ output_dir:
173
179
  auth:
174
180
  credentials:
175
181
  username:
@@ -181,7 +187,7 @@ planetary_computer:
181
187
  credentials:
182
188
  apikey:
183
189
  download:
184
- outputs_prefix:
190
+ output_dir:
185
191
  hydroweb_next:
186
192
  priority: # Lower value means lower priority (Default: 0)
187
193
  search: # Search parameters configuration
@@ -189,23 +195,74 @@ hydroweb_next:
189
195
  credentials:
190
196
  apikey:
191
197
  download:
192
- outputs_prefix:
193
- wekeo:
198
+ output_dir:
199
+ wekeo_main:
200
+ priority: # Lower value means lower priority (Default: 0)
201
+ search: # Search parameters configuration
202
+ download:
203
+ output_dir:
204
+ auth:
205
+ credentials:
206
+ username:
207
+ password:
208
+ wekeo_ecmwf:
209
+ priority: # Lower value means lower priority (Default: 0)
210
+ search: # Search parameters configuration
211
+ download:
212
+ output_dir:
213
+ auth:
214
+ credentials:
215
+ username:
216
+ password:
217
+ wekeo_cmems:
194
218
  priority: # Lower value means lower priority (Default: 0)
195
219
  search:
196
220
  download:
197
- outputs_prefix:
221
+ output_dir:
198
222
  auth:
199
223
  credentials:
200
224
  username:
201
225
  password:
202
-
203
226
  creodias_s3:
204
227
  priority: # Lower value means lower priority (Default: 0)
205
228
  search: # Search parameters configuration
206
229
  download:
207
- outputs_prefix:
230
+ output_dir:
208
231
  auth:
209
232
  credentials:
210
233
  aws_access_key_id:
211
234
  aws_secret_access_key:
235
+ dedt_lumi:
236
+ priority: # Lower value means lower priority (Default: 0)
237
+ search:
238
+ download:
239
+ output_dir:
240
+ auth:
241
+ credentials:
242
+ username:
243
+ password:
244
+ dedl:
245
+ priority: # Lower value means lower priority (Default: 0)
246
+ search: # Search parameters configuration
247
+ download:
248
+ output_dir:
249
+ auth:
250
+ credentials:
251
+ username:
252
+ password:
253
+ eumetsat_ds:
254
+ priority: # Lower value means lower priority (Default: 0)
255
+ search: # Search parameters configuration
256
+ output_dir:
257
+ auth:
258
+ credentials:
259
+ username:
260
+ password:
261
+ download:
262
+ output_dir:
263
+ cop_marine:
264
+ priority: # Lower value means lower priority (Default: 0)
265
+ search: # Search parameters configuration
266
+ download:
267
+ extract:
268
+ output_dir:
eodag/rest/__init__.py CHANGED
@@ -16,3 +16,9 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
  """EODAG REST API"""
19
+ try:
20
+ from fastapi import __version__ # noqa: F401
21
+ except ImportError:
22
+ raise ImportError(
23
+ f"{__name__} not available, please install eodag[server] or eodag[all]"
24
+ )
eodag/rest/cache.py ADDED
@@ -0,0 +1,70 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2024, CS GROUP - France, https://www.csgroup.eu/
3
+ #
4
+ # This file is part of EODAG project
5
+ # https://www.github.com/CS-SI/EODAG
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ import logging
19
+ from typing import Any, Callable, Coroutine, Dict, TypeVar, cast
20
+
21
+ import orjson
22
+ from cachetools import LRUCache
23
+ from fastapi import FastAPI, Request
24
+
25
+ from eodag.rest.config import Settings
26
+ from eodag.utils import urlsplit
27
+
28
+ logger = logging.getLogger("eodag.rest.utils")
29
+
30
+ T = TypeVar("T")
31
+
32
+
33
+ def init_cache(app: FastAPI) -> None:
34
+ """Connect to local cache"""
35
+ settings = Settings.from_environment()
36
+
37
+ app.state.cache = LRUCache(maxsize=settings.cache_maxsize)
38
+
39
+
40
+ async def cached(
41
+ fn: Callable[[], Coroutine[Any, Any, T]], cache_key: str, request: Request
42
+ ) -> T:
43
+ """Either get the result from local cache or run the function and cache the result."""
44
+ settings = Settings.from_environment()
45
+
46
+ host = urlsplit(cast(str, request.state.url_root)).netloc
47
+
48
+ host_cache_key = f"{cache_key}:{host}"
49
+
50
+ try:
51
+ c: Dict[str, Any] = request.app.state.cache
52
+
53
+ if cached := c.get(host_cache_key):
54
+ logger.debug("Cache result hit")
55
+ return orjson.loads(cached) # type: ignore
56
+ except Exception as e:
57
+ logger.error(f"Error in cache: {e}")
58
+ if settings.debug:
59
+ raise
60
+
61
+ result = await fn()
62
+
63
+ try:
64
+ c[host_cache_key] = orjson.dumps(result) # type: ignore
65
+ except Exception as e:
66
+ logger.error(f"Error in cache: {e}")
67
+ if settings.debug:
68
+ raise
69
+
70
+ return result
eodag/rest/config.py ADDED
@@ -0,0 +1,68 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2024, CS GROUP - France, https://www.csgroup.eu/
3
+ #
4
+ # This file is part of EODAG project
5
+ # https://www.github.com/CS-SI/EODAG
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ from __future__ import annotations
19
+
20
+ from functools import lru_cache
21
+ from typing import List, Union
22
+
23
+ from pydantic import Field
24
+ from pydantic.functional_validators import BeforeValidator
25
+ from pydantic_settings import BaseSettings, SettingsConfigDict
26
+ from typing_extensions import Doc
27
+
28
+ from eodag.rest.constants import DEFAULT_MAXSIZE, DEFAULT_TTL
29
+ from eodag.utils import Annotated
30
+
31
+
32
+ def str2liststr(raw: Union[str, List[str]]) -> List[str]:
33
+ """Convert str to list[str]"""
34
+ if isinstance(raw, list):
35
+ return raw
36
+ return raw.split(",")
37
+
38
+
39
+ class Settings(BaseSettings):
40
+ """EODAG Server config"""
41
+
42
+ # local cache config
43
+ cache_ttl: int = Field(default=DEFAULT_TTL)
44
+ cache_maxsize: int = Field(default=DEFAULT_MAXSIZE)
45
+
46
+ debug: bool = False
47
+
48
+ stac_api_title: str = "eodag-stac-api"
49
+ stac_api_description: str = "STAC API provided by EODAG"
50
+ stac_api_landing_id: str = "eodag-stac-api"
51
+
52
+ origin_url_blacklist: Annotated[
53
+ Union[str, List[str]],
54
+ BeforeValidator(str2liststr),
55
+ Doc(
56
+ "Hide from clients items assets' alternative URLs starting with URLs from the list"
57
+ ),
58
+ ] = Field(default=[])
59
+
60
+ model_config = SettingsConfigDict(
61
+ env_prefix="EODAG_", extra="ignore", env_nested_delimiter="__"
62
+ )
63
+
64
+ @classmethod
65
+ @lru_cache(maxsize=1)
66
+ def from_environment(cls) -> Settings:
67
+ """Get settings"""
68
+ return Settings()
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2024, CS GROUP - France, https://www.csgroup.eu/
3
+ #
4
+ # This file is part of EODAG project
5
+ # https://www.github.com/CS-SI/EODAG
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ # default cache ttl
19
+ DEFAULT_TTL = 600 # 10 min
20
+
21
+ DEFAULT_MAXSIZE = 2048 # local cache maxsize
22
+
23
+ CACHE_KEY_COLLECTIONS = "collections"
24
+ CACHE_KEY_COLLECTION = "collection"
25
+ CACHE_KEY_SEARCH = "search"
26
+ CACHE_KEY_QUERYABLES = "queryables"