pystac-ext-application 0.1.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.
- pystac/extensions/__about__.py +17 -0
- pystac/extensions/application.py +489 -0
- pystac/extensions/py.typed +1 -0
- pystac_ext_application-0.1.0.dist-info/METADATA +99 -0
- pystac_ext_application-0.1.0.dist-info/RECORD +7 -0
- pystac_ext_application-0.1.0.dist-info/WHEEL +4 -0
- pystac_ext_application-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Copyright 2026 Terradue
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""Package metadata for Application pystac extension."""
|
|
16
|
+
|
|
17
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
# Copyright 2026 Terradue
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""Generated PySTAC extension. Edit the source schema and regenerate to update."""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
from dataclasses import dataclass
|
|
20
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Generic, TypeVar, cast
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from collections.abc import Mapping
|
|
24
|
+
|
|
25
|
+
from pystac.extensions.base import (
|
|
26
|
+
ExtensionManagementMixin,
|
|
27
|
+
PropertiesExtension,
|
|
28
|
+
SummariesExtension,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
import pystac
|
|
32
|
+
|
|
33
|
+
SCHEMA_URI = "https://stac-extensions.github.io/application/v0.1.0/schema.json"
|
|
34
|
+
FIELD_TARGETS = {
|
|
35
|
+
"application:container": [
|
|
36
|
+
"asset",
|
|
37
|
+
"catalog",
|
|
38
|
+
"collection",
|
|
39
|
+
"item",
|
|
40
|
+
"item_asset",
|
|
41
|
+
"link",
|
|
42
|
+
"summary",
|
|
43
|
+
],
|
|
44
|
+
"application:entrypoint": [
|
|
45
|
+
"asset",
|
|
46
|
+
"catalog",
|
|
47
|
+
"collection",
|
|
48
|
+
"item",
|
|
49
|
+
"item_asset",
|
|
50
|
+
"link",
|
|
51
|
+
"summary",
|
|
52
|
+
],
|
|
53
|
+
"application:languages": [
|
|
54
|
+
"asset",
|
|
55
|
+
"catalog",
|
|
56
|
+
"collection",
|
|
57
|
+
"item",
|
|
58
|
+
"item_asset",
|
|
59
|
+
"link",
|
|
60
|
+
"summary",
|
|
61
|
+
],
|
|
62
|
+
"assetTemplates": ["catalog", "collection"],
|
|
63
|
+
"linkTemplates": ["catalog", "collection"],
|
|
64
|
+
}
|
|
65
|
+
FIELD_NAMES = {
|
|
66
|
+
"container": "application:container",
|
|
67
|
+
"entrypoint": "application:entrypoint",
|
|
68
|
+
"languages": "application:languages",
|
|
69
|
+
"assetTemplates": "assetTemplates",
|
|
70
|
+
"linkTemplates": "linkTemplates",
|
|
71
|
+
}
|
|
72
|
+
TARGETS = ["asset", "catalog", "collection", "item", "item_asset", "link", "summary"]
|
|
73
|
+
T = TypeVar(
|
|
74
|
+
"T",
|
|
75
|
+
bound="pystac.Collection | pystac.Catalog | pystac.Item | pystac.Asset | pystac.ItemAssetDefinition | pystac.Link",
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _target_for(obj: object) -> str:
|
|
80
|
+
"""Identify supported STAC targets, checking Collection before its Catalog base."""
|
|
81
|
+
target_types = (
|
|
82
|
+
(pystac.Collection, "collection"),
|
|
83
|
+
(pystac.Catalog, "catalog"),
|
|
84
|
+
(pystac.Item, "item"),
|
|
85
|
+
(pystac.Asset, "asset"),
|
|
86
|
+
(pystac.ItemAssetDefinition, "item_asset"),
|
|
87
|
+
(pystac.Link, "link"),
|
|
88
|
+
)
|
|
89
|
+
for object_type, target in target_types:
|
|
90
|
+
if isinstance(obj, object_type):
|
|
91
|
+
if target not in TARGETS:
|
|
92
|
+
break
|
|
93
|
+
return target
|
|
94
|
+
raise pystac.ExtensionTypeError(f"Unsupported extension target: {type(obj).__name__}")
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class _Unset:
|
|
98
|
+
"""Distinguish omitted arguments from explicit JSON null."""
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
_UNSET = _Unset()
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def _encode(value: Any) -> Any:
|
|
105
|
+
"""Convert generated objects at any depth into plain JSON containers."""
|
|
106
|
+
if isinstance(value, _Object):
|
|
107
|
+
value = value.properties
|
|
108
|
+
if isinstance(value, dict):
|
|
109
|
+
return {key: _encode(child) for key, child in value.items()}
|
|
110
|
+
if isinstance(value, (list, tuple)):
|
|
111
|
+
return [_encode(child) for child in value]
|
|
112
|
+
return value
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _decode(value: Any, codec: Any) -> Any:
|
|
116
|
+
"""Wrap schema-declared objects while retaining live backing dictionaries."""
|
|
117
|
+
if value is None or codec is None:
|
|
118
|
+
return value
|
|
119
|
+
kind, detail = codec
|
|
120
|
+
if kind == "object":
|
|
121
|
+
return _MODELS[detail].from_dict(value)
|
|
122
|
+
if kind == "list":
|
|
123
|
+
return _decode_list(value, detail)
|
|
124
|
+
if kind == "map":
|
|
125
|
+
return _decode_map(value, detail)
|
|
126
|
+
raise ValueError(f"Unknown conversion: {kind}")
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _decode_list(value: Any, codec: Any) -> list[Any]:
|
|
130
|
+
"""Decode the elements of a schema-declared array."""
|
|
131
|
+
if not isinstance(value, list):
|
|
132
|
+
raise TypeError("Expected a JSON array")
|
|
133
|
+
return [_decode(child, codec) for child in value]
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def _decode_map(value: Any, codec: Any) -> dict[str, Any]:
|
|
137
|
+
"""Decode the values of a schema-declared object map."""
|
|
138
|
+
if not isinstance(value, dict):
|
|
139
|
+
raise TypeError("Expected a JSON object map")
|
|
140
|
+
return {key: _decode(child, codec) for key, child in value.items()}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
_O = TypeVar("_O", bound="_Object")
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
@dataclass
|
|
147
|
+
class _Object:
|
|
148
|
+
"""Live wrapper around JSON, following PySTAC value-object conventions."""
|
|
149
|
+
|
|
150
|
+
_members: ClassVar[dict[str, str]] = {}
|
|
151
|
+
properties: dict[str, Any]
|
|
152
|
+
|
|
153
|
+
def __post_init__(self) -> None:
|
|
154
|
+
"""Require a JSON object as the live backing value."""
|
|
155
|
+
if not isinstance(self.properties, dict):
|
|
156
|
+
raise TypeError(f"{type(self).__name__} requires a dictionary")
|
|
157
|
+
|
|
158
|
+
@classmethod
|
|
159
|
+
def from_dict(cls: type[_O], properties: dict[str, Any], *, copy: bool = False) -> _O:
|
|
160
|
+
"""Wrap by reference, or request an independent copy."""
|
|
161
|
+
from copy import deepcopy
|
|
162
|
+
|
|
163
|
+
return cls(deepcopy(properties) if copy else properties)
|
|
164
|
+
|
|
165
|
+
def to_dict(self) -> dict[str, Any]:
|
|
166
|
+
"""Return the live backing JSON dictionary, as PySTAC Render does."""
|
|
167
|
+
return self.properties
|
|
168
|
+
|
|
169
|
+
def _apply(self, values: Mapping[str, object]) -> None:
|
|
170
|
+
"""Check update names before changing the backing dictionary."""
|
|
171
|
+
unknown = values.keys() - self._members.keys()
|
|
172
|
+
if unknown:
|
|
173
|
+
raise TypeError(f"Unknown fields: {sorted(unknown)}")
|
|
174
|
+
for name, value in values.items():
|
|
175
|
+
if not isinstance(value, _Unset):
|
|
176
|
+
setattr(self, name, value)
|
|
177
|
+
|
|
178
|
+
def clear(self, name: str) -> None:
|
|
179
|
+
"""Remove a member using its Python attribute name."""
|
|
180
|
+
self.properties.pop(self._members[name], None)
|
|
181
|
+
|
|
182
|
+
def set_null(self, name: str) -> None:
|
|
183
|
+
"""Store explicit JSON null using a Python member name."""
|
|
184
|
+
self.properties[self._members[name]] = None
|
|
185
|
+
|
|
186
|
+
def __repr__(self) -> str:
|
|
187
|
+
return f"<{type(self).__name__} {self.properties!r}>"
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class AssetTemplate(_Object):
|
|
191
|
+
"""Generated nested value object; unknown JSON members are preserved."""
|
|
192
|
+
|
|
193
|
+
_members: ClassVar[dict[str, str]] = {
|
|
194
|
+
"container": "application:container",
|
|
195
|
+
"entrypoint": "application:entrypoint",
|
|
196
|
+
"languages": "application:languages",
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@classmethod
|
|
200
|
+
def create(
|
|
201
|
+
cls,
|
|
202
|
+
*,
|
|
203
|
+
container: str | _Unset = _UNSET,
|
|
204
|
+
entrypoint: str | _Unset = _UNSET,
|
|
205
|
+
languages: list[str] | _Unset = _UNSET,
|
|
206
|
+
) -> AssetTemplate:
|
|
207
|
+
"""Create with typed members; omitted optionals are not written.
|
|
208
|
+
|
|
209
|
+
Explicit None writes null. Validate the STAC object to check value constraints.
|
|
210
|
+
"""
|
|
211
|
+
_values = {
|
|
212
|
+
"application:container": container,
|
|
213
|
+
"application:entrypoint": entrypoint,
|
|
214
|
+
"application:languages": languages,
|
|
215
|
+
}
|
|
216
|
+
return cls(
|
|
217
|
+
{key: _encode(value) for key, value in _values.items() if not isinstance(value, _Unset)}
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
def apply(
|
|
221
|
+
self,
|
|
222
|
+
*,
|
|
223
|
+
container: str | _Unset | None = _UNSET,
|
|
224
|
+
entrypoint: str | _Unset | None = _UNSET,
|
|
225
|
+
languages: list[str] | _Unset | None = _UNSET,
|
|
226
|
+
) -> None:
|
|
227
|
+
"""Update supplied members; omitted values are preserved and None removes."""
|
|
228
|
+
self._apply(
|
|
229
|
+
{
|
|
230
|
+
"container": container,
|
|
231
|
+
"entrypoint": entrypoint,
|
|
232
|
+
"languages": languages,
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
@property
|
|
237
|
+
def container(self) -> str | None:
|
|
238
|
+
"application:container"
|
|
239
|
+
# Schema-derived typing at the unvalidated PySTAC JSON boundary.
|
|
240
|
+
return cast("str | None", self.properties.get("application:container"))
|
|
241
|
+
|
|
242
|
+
@container.setter
|
|
243
|
+
def container(self, value: str | None) -> None:
|
|
244
|
+
if value is None:
|
|
245
|
+
self.properties.pop("application:container", None)
|
|
246
|
+
else:
|
|
247
|
+
self.properties["application:container"] = _encode(value)
|
|
248
|
+
|
|
249
|
+
@property
|
|
250
|
+
def entrypoint(self) -> str | None:
|
|
251
|
+
"application:entrypoint"
|
|
252
|
+
# Schema-derived typing at the unvalidated PySTAC JSON boundary.
|
|
253
|
+
return cast("str | None", self.properties.get("application:entrypoint"))
|
|
254
|
+
|
|
255
|
+
@entrypoint.setter
|
|
256
|
+
def entrypoint(self, value: str | None) -> None:
|
|
257
|
+
if value is None:
|
|
258
|
+
self.properties.pop("application:entrypoint", None)
|
|
259
|
+
else:
|
|
260
|
+
self.properties["application:entrypoint"] = _encode(value)
|
|
261
|
+
|
|
262
|
+
@property
|
|
263
|
+
def languages(self) -> list[str] | None:
|
|
264
|
+
"application:languages"
|
|
265
|
+
# Schema-derived typing at the unvalidated PySTAC JSON boundary.
|
|
266
|
+
return cast("list[str] | None", self.properties.get("application:languages"))
|
|
267
|
+
|
|
268
|
+
@languages.setter
|
|
269
|
+
def languages(self, value: list[str] | None) -> None:
|
|
270
|
+
if value is None:
|
|
271
|
+
self.properties.pop("application:languages", None)
|
|
272
|
+
else:
|
|
273
|
+
self.properties["application:languages"] = _encode(value)
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
_MODELS: dict[str, type[_Object]] = {
|
|
277
|
+
"AssetTemplate": AssetTemplate,
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
class ApplicationExtension(
|
|
282
|
+
PropertiesExtension,
|
|
283
|
+
ExtensionManagementMixin[pystac.Item | pystac.Collection | pystac.Catalog],
|
|
284
|
+
Generic[T],
|
|
285
|
+
):
|
|
286
|
+
"""Typed property wrapper; use ext() to check/register the extension.
|
|
287
|
+
|
|
288
|
+
Setters preserve JSON representations, including date/time strings and nested
|
|
289
|
+
dictionaries. None removes a property; set_null() explicitly writes JSON null.
|
|
290
|
+
Validate the owning STAC object to enforce full schema constraints.
|
|
291
|
+
"""
|
|
292
|
+
|
|
293
|
+
def __init__(self, obj: T, target: str) -> None:
|
|
294
|
+
"""Bind a schema-supported STAC object's metadata for live updates."""
|
|
295
|
+
self.obj: T = obj
|
|
296
|
+
self._target = target
|
|
297
|
+
self.additional_read_properties: list[dict[str, Any]] | None = None
|
|
298
|
+
if isinstance(obj, (pystac.Item, pystac.ItemAssetDefinition)):
|
|
299
|
+
self.properties = obj.properties
|
|
300
|
+
else:
|
|
301
|
+
self.properties = obj.extra_fields
|
|
302
|
+
if isinstance(obj, pystac.Asset) and isinstance(obj.owner, pystac.Item):
|
|
303
|
+
self.additional_read_properties = [obj.owner.properties]
|
|
304
|
+
|
|
305
|
+
@classmethod
|
|
306
|
+
def get_schema_uri(cls) -> str:
|
|
307
|
+
"""The canonical schema identifier used for extension registration."""
|
|
308
|
+
return SCHEMA_URI
|
|
309
|
+
|
|
310
|
+
@classmethod
|
|
311
|
+
def has_extension(cls, obj: pystac.STACObject) -> bool:
|
|
312
|
+
"""Check this exact schema version; migrations are not generated."""
|
|
313
|
+
return SCHEMA_URI in (obj.stac_extensions or [])
|
|
314
|
+
|
|
315
|
+
@classmethod
|
|
316
|
+
def ext(cls, obj: T, add_if_missing: bool = False) -> ApplicationExtension[T]:
|
|
317
|
+
"""Wrap a schema-supported object and optionally register its extension."""
|
|
318
|
+
target = _target_for(obj)
|
|
319
|
+
if isinstance(obj, (pystac.Asset, pystac.ItemAssetDefinition, pystac.Link)):
|
|
320
|
+
cls.ensure_owner_has_extension(obj, add_if_missing)
|
|
321
|
+
else:
|
|
322
|
+
cls.ensure_has_extension(obj, add_if_missing)
|
|
323
|
+
return cls(obj, target)
|
|
324
|
+
|
|
325
|
+
def _check_field(self, key: str) -> None:
|
|
326
|
+
if self._target not in FIELD_TARGETS[key]:
|
|
327
|
+
raise pystac.ExtensionTypeError(f"{key} does not apply to {self._target}")
|
|
328
|
+
|
|
329
|
+
def clear(self, name: str) -> None:
|
|
330
|
+
"""Remove a field using its generated Python attribute name."""
|
|
331
|
+
key = FIELD_NAMES[name]
|
|
332
|
+
self._check_field(key)
|
|
333
|
+
self.properties.pop(key, None)
|
|
334
|
+
|
|
335
|
+
def set_null(self, name: str) -> None:
|
|
336
|
+
"""Write explicit JSON null; schema validation checks whether it is permitted."""
|
|
337
|
+
key = FIELD_NAMES[name]
|
|
338
|
+
self._check_field(key)
|
|
339
|
+
self._set_property(key, None, pop_if_none=False)
|
|
340
|
+
|
|
341
|
+
def apply(self, **values: Any) -> None:
|
|
342
|
+
"""Update only supplied fields; omitted fields are preserved.
|
|
343
|
+
|
|
344
|
+
Keys are generated Python attribute names. Unknown or inapplicable fields
|
|
345
|
+
are rejected before mutation. Validate the STAC object to check values afterwards.
|
|
346
|
+
"""
|
|
347
|
+
for name in values:
|
|
348
|
+
if name not in FIELD_NAMES:
|
|
349
|
+
raise TypeError(f"Unknown extension field: {name}")
|
|
350
|
+
self._check_field(FIELD_NAMES[name])
|
|
351
|
+
for name, value in values.items():
|
|
352
|
+
setattr(self, name, value)
|
|
353
|
+
|
|
354
|
+
@property
|
|
355
|
+
def container(self) -> str | None:
|
|
356
|
+
"application:container"
|
|
357
|
+
self._check_field("application:container")
|
|
358
|
+
if "application:container" in self.properties:
|
|
359
|
+
return cast("str | None", self.properties["application:container"])
|
|
360
|
+
return cast("str | None", self._get_property("application:container", object))
|
|
361
|
+
|
|
362
|
+
@container.setter
|
|
363
|
+
def container(self, value: str | None) -> None:
|
|
364
|
+
self._check_field("application:container")
|
|
365
|
+
self._set_property("application:container", _encode(value))
|
|
366
|
+
|
|
367
|
+
@property
|
|
368
|
+
def entrypoint(self) -> str | None:
|
|
369
|
+
"application:entrypoint"
|
|
370
|
+
self._check_field("application:entrypoint")
|
|
371
|
+
if "application:entrypoint" in self.properties:
|
|
372
|
+
return cast("str | None", self.properties["application:entrypoint"])
|
|
373
|
+
return cast("str | None", self._get_property("application:entrypoint", object))
|
|
374
|
+
|
|
375
|
+
@entrypoint.setter
|
|
376
|
+
def entrypoint(self, value: str | None) -> None:
|
|
377
|
+
self._check_field("application:entrypoint")
|
|
378
|
+
self._set_property("application:entrypoint", _encode(value))
|
|
379
|
+
|
|
380
|
+
@property
|
|
381
|
+
def languages(self) -> list[str] | None:
|
|
382
|
+
"application:languages"
|
|
383
|
+
self._check_field("application:languages")
|
|
384
|
+
if "application:languages" in self.properties:
|
|
385
|
+
return cast("list[str] | None", self.properties["application:languages"])
|
|
386
|
+
return cast("list[str] | None", self._get_property("application:languages", object))
|
|
387
|
+
|
|
388
|
+
@languages.setter
|
|
389
|
+
def languages(self, value: list[str] | None) -> None:
|
|
390
|
+
self._check_field("application:languages")
|
|
391
|
+
self._set_property("application:languages", _encode(value))
|
|
392
|
+
|
|
393
|
+
@property
|
|
394
|
+
def assetTemplates(self) -> dict[str, AssetTemplate] | None:
|
|
395
|
+
"assetTemplates"
|
|
396
|
+
self._check_field("assetTemplates")
|
|
397
|
+
if "assetTemplates" in self.properties:
|
|
398
|
+
return cast(
|
|
399
|
+
"dict[str, AssetTemplate] | None",
|
|
400
|
+
_decode(self.properties["assetTemplates"], ["map", ["object", "AssetTemplate"]]),
|
|
401
|
+
)
|
|
402
|
+
return cast(
|
|
403
|
+
"dict[str, AssetTemplate] | None",
|
|
404
|
+
_decode(
|
|
405
|
+
self._get_property("assetTemplates", object), ["map", ["object", "AssetTemplate"]]
|
|
406
|
+
),
|
|
407
|
+
)
|
|
408
|
+
|
|
409
|
+
@assetTemplates.setter
|
|
410
|
+
def assetTemplates(self, value: dict[str, AssetTemplate] | None) -> None:
|
|
411
|
+
self._check_field("assetTemplates")
|
|
412
|
+
self._set_property("assetTemplates", _encode(value))
|
|
413
|
+
|
|
414
|
+
@property
|
|
415
|
+
def linkTemplates(self) -> list[AssetTemplate] | None:
|
|
416
|
+
"linkTemplates"
|
|
417
|
+
self._check_field("linkTemplates")
|
|
418
|
+
if "linkTemplates" in self.properties:
|
|
419
|
+
return cast(
|
|
420
|
+
"list[AssetTemplate] | None",
|
|
421
|
+
_decode(self.properties["linkTemplates"], ["list", ["object", "AssetTemplate"]]),
|
|
422
|
+
)
|
|
423
|
+
return cast(
|
|
424
|
+
"list[AssetTemplate] | None",
|
|
425
|
+
_decode(
|
|
426
|
+
self._get_property("linkTemplates", object), ["list", ["object", "AssetTemplate"]]
|
|
427
|
+
),
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
@linkTemplates.setter
|
|
431
|
+
def linkTemplates(self, value: list[AssetTemplate] | None) -> None:
|
|
432
|
+
self._check_field("linkTemplates")
|
|
433
|
+
self._set_property("linkTemplates", _encode(value))
|
|
434
|
+
|
|
435
|
+
@classmethod
|
|
436
|
+
def summaries(
|
|
437
|
+
cls, obj: pystac.Collection, add_if_missing: bool = False
|
|
438
|
+
) -> SummariesApplicationExtension:
|
|
439
|
+
"""Wrap schema-declared Collection summaries and optionally register the extension."""
|
|
440
|
+
if not isinstance(obj, pystac.Collection):
|
|
441
|
+
raise pystac.ExtensionTypeError("Summaries require a Collection")
|
|
442
|
+
cls.ensure_has_extension(obj, add_if_missing)
|
|
443
|
+
return SummariesApplicationExtension(obj)
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
class SummariesApplicationExtension(SummariesExtension):
|
|
447
|
+
"""Collection summaries; ranges, lists and JSON Schema objects are preserved."""
|
|
448
|
+
|
|
449
|
+
@property
|
|
450
|
+
def container(self) -> list[Any] | pystac.RangeSummary[Any] | dict[str, Any] | None:
|
|
451
|
+
value = self.summaries.to_dict().get("application:container")
|
|
452
|
+
if isinstance(value, dict) and "minimum" in value and "maximum" in value:
|
|
453
|
+
return self.summaries.get_range("application:container")
|
|
454
|
+
return value
|
|
455
|
+
|
|
456
|
+
@container.setter
|
|
457
|
+
def container(
|
|
458
|
+
self, value: list[Any] | pystac.RangeSummary[Any] | dict[str, Any] | None
|
|
459
|
+
) -> None:
|
|
460
|
+
self.summaries.remove("application:container")
|
|
461
|
+
self._set_summary("application:container", value)
|
|
462
|
+
|
|
463
|
+
@property
|
|
464
|
+
def entrypoint(self) -> list[Any] | pystac.RangeSummary[Any] | dict[str, Any] | None:
|
|
465
|
+
value = self.summaries.to_dict().get("application:entrypoint")
|
|
466
|
+
if isinstance(value, dict) and "minimum" in value and "maximum" in value:
|
|
467
|
+
return self.summaries.get_range("application:entrypoint")
|
|
468
|
+
return value
|
|
469
|
+
|
|
470
|
+
@entrypoint.setter
|
|
471
|
+
def entrypoint(
|
|
472
|
+
self, value: list[Any] | pystac.RangeSummary[Any] | dict[str, Any] | None
|
|
473
|
+
) -> None:
|
|
474
|
+
self.summaries.remove("application:entrypoint")
|
|
475
|
+
self._set_summary("application:entrypoint", value)
|
|
476
|
+
|
|
477
|
+
@property
|
|
478
|
+
def languages(self) -> list[Any] | pystac.RangeSummary[Any] | dict[str, Any] | None:
|
|
479
|
+
value = self.summaries.to_dict().get("application:languages")
|
|
480
|
+
if isinstance(value, dict) and "minimum" in value and "maximum" in value:
|
|
481
|
+
return self.summaries.get_range("application:languages")
|
|
482
|
+
return value
|
|
483
|
+
|
|
484
|
+
@languages.setter
|
|
485
|
+
def languages(
|
|
486
|
+
self, value: list[Any] | pystac.RangeSummary[Any] | dict[str, Any] | None
|
|
487
|
+
) -> None:
|
|
488
|
+
self.summaries.remove("application:languages")
|
|
489
|
+
self._set_summary("application:languages", value)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pystac-ext-application
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: STAC Application Extension Specification PySTAC implementation.
|
|
5
|
+
Project-URL: Documentation, https://terradue.github.io/pystac-ext-application/
|
|
6
|
+
Project-URL: Issues, https://github.com/Terradue/pystac-ext-application/issues
|
|
7
|
+
Project-URL: Source, https://github.com/Terradue/pystac-ext-application
|
|
8
|
+
Project-URL: Changelog, https://github.com/Terradue/pystac-ext-application/blob/main/CHANGELOG.md
|
|
9
|
+
Author-email: Terradue <info@terradue.com>, Simone Tripodi <simone.tripodi@terradue.com>, Fabrice Brito <fabrice.brito@terradue.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
21
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: pystac<2,>=1
|
|
24
|
+
Provides-Extra: test
|
|
25
|
+
Requires-Dist: pytest-cov<8,>=7.1.0; extra == 'test'
|
|
26
|
+
Requires-Dist: pytest<10,>=9.1.1; extra == 'test'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
<!--
|
|
30
|
+
Copyright 2026 Terradue
|
|
31
|
+
|
|
32
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
33
|
+
you may not use this file except in compliance with the License.
|
|
34
|
+
You may obtain a copy of the License at
|
|
35
|
+
|
|
36
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
37
|
+
|
|
38
|
+
Unless required by applicable law or agreed to in writing, software
|
|
39
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
40
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
41
|
+
See the License for the specific language governing permissions and
|
|
42
|
+
limitations under the License.
|
|
43
|
+
-->
|
|
44
|
+
|
|
45
|
+
# Application PySTAC extension
|
|
46
|
+
|
|
47
|
+
[](https://pypi.org/project/pystac-ext-application)
|
|
48
|
+
[](https://pypi.org/project/pystac-ext-application)
|
|
49
|
+
[](https://github.com/terradue/pystac-ext-application/actions/workflows/package.yaml?query=branch%3Adevelop)
|
|
50
|
+
[](https://app.codecov.io/gh/terradue/pystac-ext-application/tree/develop)
|
|
51
|
+
|
|
52
|
+
PySTAC implementation of the Application STAC Extension.
|
|
53
|
+
|
|
54
|
+
## Project conventions
|
|
55
|
+
|
|
56
|
+
This project is templated a Hatch-based Python package with:
|
|
57
|
+
|
|
58
|
+
- Apache-2.0 license
|
|
59
|
+
- Keep a Changelog-compatible `CHANGELOG.md`
|
|
60
|
+
- Diátaxis documentation under `docs/`
|
|
61
|
+
- top-level `mkdocs.yaml`
|
|
62
|
+
- Taskfile integration with `Terradue/taskfile-utils`
|
|
63
|
+
- GitHub Actions CI
|
|
64
|
+
|
|
65
|
+
## Documentation
|
|
66
|
+
|
|
67
|
+
Read the [project documentation](https://terradue.github.io/pystac-ext-application/) for Python examples, the field reference, and API documentation.
|
|
68
|
+
|
|
69
|
+
To preview it locally:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
python -m pip install -e . "mkdocs<2" mkdocs-material "mkdocstrings[python]" "pymdown-extensions<12"
|
|
73
|
+
mkdocs serve
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Contribute
|
|
77
|
+
|
|
78
|
+
Submit a [Github issue](/issues) if you have comments or suggestions.
|
|
79
|
+
|
|
80
|
+
### Local quality checks
|
|
81
|
+
|
|
82
|
+
Install [Hatch](https://hatch.pypa.io/) and [Taskfiles](https://taskfile.dev/docs/guide) then install the Git hook:
|
|
83
|
+
|
|
84
|
+
```console
|
|
85
|
+
task quality:pre-commit:install
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Every commit runs Ruff (including the configured McCabe complexity limit),
|
|
89
|
+
Ruff formatting, strict mypy checks, and the pytest suite.
|
|
90
|
+
|
|
91
|
+
Run the complete hook explicitly with:
|
|
92
|
+
|
|
93
|
+
```console
|
|
94
|
+
task quality:pre-commit:run
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
[](https://www.apache.org/licenses/LICENSE-2.0)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
pystac/extensions/__about__.py,sha256=vR0L8geiLeuW398Abl6xTPFEss0PRQTjmbMHyt5IOKU,653
|
|
2
|
+
pystac/extensions/application.py,sha256=LaH3EvipFVGFfUAeGAC_3aQWleZTtdIFjLVUhvTw1qA,17854
|
|
3
|
+
pystac/extensions/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
4
|
+
pystac_ext_application-0.1.0.dist-info/METADATA,sha256=ayV4hrrCft7Kw5oGLoqwjAvHXrpnW4j8drfptjOp_Iw,4065
|
|
5
|
+
pystac_ext_application-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
6
|
+
pystac_ext_application-0.1.0.dist-info/licenses/LICENSE,sha256=ncoZH9Riydi4edtpNYeB7IymLIEpnL1SQB0fM4A8NHA,11343
|
|
7
|
+
pystac_ext_application-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Terradue
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|