pystac-core 1.15.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 (58) hide show
  1. pystac_core-1.15.0/.gitignore +163 -0
  2. pystac_core-1.15.0/PKG-INFO +24 -0
  3. pystac_core-1.15.0/README.md +0 -0
  4. pystac_core-1.15.0/pyproject.toml +39 -0
  5. pystac_core-1.15.0/pystac/__init__.py +260 -0
  6. pystac_core-1.15.0/pystac/asset.py +395 -0
  7. pystac_core-1.15.0/pystac/cache.py +349 -0
  8. pystac_core-1.15.0/pystac/catalog.py +1307 -0
  9. pystac_core-1.15.0/pystac/client.py +23 -0
  10. pystac_core-1.15.0/pystac/collection.py +899 -0
  11. pystac_core-1.15.0/pystac/common_metadata.py +251 -0
  12. pystac_core-1.15.0/pystac/errors.py +119 -0
  13. pystac_core-1.15.0/pystac/extensions/__init__.py +3 -0
  14. pystac_core-1.15.0/pystac/extensions/base.py +270 -0
  15. pystac_core-1.15.0/pystac/extensions/ext.py +458 -0
  16. pystac_core-1.15.0/pystac/extensions/hooks.py +111 -0
  17. pystac_core-1.15.0/pystac/html/JSON.jinja2 +57 -0
  18. pystac_core-1.15.0/pystac/html/Macros.jinja2 +34 -0
  19. pystac_core-1.15.0/pystac/html/__init__.py +3 -0
  20. pystac_core-1.15.0/pystac/html/jinja_env.py +15 -0
  21. pystac_core-1.15.0/pystac/item.py +539 -0
  22. pystac_core-1.15.0/pystac/item_assets.py +247 -0
  23. pystac_core-1.15.0/pystac/item_collection.py +257 -0
  24. pystac_core-1.15.0/pystac/layout.py +699 -0
  25. pystac_core-1.15.0/pystac/link.py +530 -0
  26. pystac_core-1.15.0/pystac/media_type.py +54 -0
  27. pystac_core-1.15.0/pystac/provider.py +122 -0
  28. pystac_core-1.15.0/pystac/py.typed +0 -0
  29. pystac_core-1.15.0/pystac/rel_type.py +29 -0
  30. pystac_core-1.15.0/pystac/serialization/__init__.py +14 -0
  31. pystac_core-1.15.0/pystac/serialization/common_properties.py +110 -0
  32. pystac_core-1.15.0/pystac/serialization/identify.py +300 -0
  33. pystac_core-1.15.0/pystac/serialization/migrate.py +193 -0
  34. pystac_core-1.15.0/pystac/stac_io.py +486 -0
  35. pystac_core-1.15.0/pystac/stac_object.py +701 -0
  36. pystac_core-1.15.0/pystac/static/__init__.py +0 -0
  37. pystac_core-1.15.0/pystac/static/fields-normalized.json +1 -0
  38. pystac_core-1.15.0/pystac/summaries.py +334 -0
  39. pystac_core-1.15.0/pystac/utils.py +627 -0
  40. pystac_core-1.15.0/pystac/validation/__init__.py +276 -0
  41. pystac_core-1.15.0/pystac/validation/jsonschemas/__init__.py +0 -0
  42. pystac_core-1.15.0/pystac/validation/jsonschemas/geojson/Feature.json +505 -0
  43. pystac_core-1.15.0/pystac/validation/jsonschemas/geojson/Geometry.json +218 -0
  44. pystac_core-1.15.0/pystac/validation/jsonschemas/stac-spec/v1.1.0/bands.json +24 -0
  45. pystac_core-1.15.0/pystac/validation/jsonschemas/stac-spec/v1.1.0/basics.json +34 -0
  46. pystac_core-1.15.0/pystac/validation/jsonschemas/stac-spec/v1.1.0/catalog.json +57 -0
  47. pystac_core-1.15.0/pystac/validation/jsonschemas/stac-spec/v1.1.0/collection.json +230 -0
  48. pystac_core-1.15.0/pystac/validation/jsonschemas/stac-spec/v1.1.0/common.json +30 -0
  49. pystac_core-1.15.0/pystac/validation/jsonschemas/stac-spec/v1.1.0/data-values.json +84 -0
  50. pystac_core-1.15.0/pystac/validation/jsonschemas/stac-spec/v1.1.0/datetime.json +53 -0
  51. pystac_core-1.15.0/pystac/validation/jsonschemas/stac-spec/v1.1.0/instrument.json +32 -0
  52. pystac_core-1.15.0/pystac/validation/jsonschemas/stac-spec/v1.1.0/item.json +347 -0
  53. pystac_core-1.15.0/pystac/validation/jsonschemas/stac-spec/v1.1.0/licensing.json +12 -0
  54. pystac_core-1.15.0/pystac/validation/jsonschemas/stac-spec/v1.1.0/provider.json +47 -0
  55. pystac_core-1.15.0/pystac/validation/local_validator.py +126 -0
  56. pystac_core-1.15.0/pystac/validation/schema_uri_map.py +351 -0
  57. pystac_core-1.15.0/pystac/validation/stac_validator.py +304 -0
  58. pystac_core-1.15.0/pystac/version.py +72 -0
@@ -0,0 +1,163 @@
1
+ *.pyc
2
+ *.egg-info
3
+ *.eggs
4
+ .DS_Store
5
+ data
6
+ config.json
7
+ stdout*
8
+ /integration*
9
+ .idea
10
+ .vscode
11
+ .actrc
12
+
13
+
14
+ # Sphinx documentation
15
+ .ipynb_checkpoints/
16
+
17
+ docs/tutorials/pystac-example*
18
+ docs/tutorials/spacenet-stac/
19
+ docs/tutorials/spacenet-cog-stac/
20
+ docs/tutorials/data/
21
+ docs/quickstart_stac/
22
+
23
+ # Byte-compiled / optimized / DLL files
24
+ __pycache__/
25
+ *.py[cod]
26
+ *$py.class
27
+
28
+ # C extensions
29
+ *.so
30
+
31
+ # Distribution / packaging
32
+ .Python
33
+ build/
34
+ develop-eggs/
35
+ dist/
36
+ downloads/
37
+ eggs/
38
+ .eggs/
39
+ lib/
40
+ lib64/
41
+ parts/
42
+ sdist/
43
+ var/
44
+ wheels/
45
+ share/python-wheels/
46
+ *.egg-info/
47
+ .installed.cfg
48
+ *.egg
49
+ MANIFEST
50
+
51
+ # PyInstaller
52
+ # Usually these files are written by a python script from a template
53
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
54
+ *.manifest
55
+ *.spec
56
+
57
+ # Installer logs
58
+ pip-log.txt
59
+ pip-delete-this-directory.txt
60
+
61
+ # Unit test / coverage reports
62
+ htmlcov/
63
+ .tox/
64
+ .nox/
65
+ .coverage
66
+ .coverage.*
67
+ .cache
68
+ nosetests.xml
69
+ coverage.xml
70
+ *.cover
71
+ *.py,cover
72
+ .hypothesis/
73
+ .pytest_cache/
74
+ cover/
75
+
76
+ # Translations
77
+ *.mo
78
+ *.pot
79
+
80
+ # Django stuff:
81
+ *.log
82
+ local_settings.py
83
+ db.sqlite3
84
+ db.sqlite3-journal
85
+
86
+ # Flask stuff:
87
+ instance/
88
+ .webassets-cache
89
+
90
+ # Scrapy stuff:
91
+ .scrapy
92
+
93
+ # Sphinx documentation
94
+ docs/_build/
95
+
96
+ # PyBuilder
97
+ .pybuilder/
98
+ target/
99
+
100
+ # Jupyter Notebook
101
+ .ipynb_checkpoints
102
+
103
+ # IPython
104
+ profile_default/
105
+ ipython_config.py
106
+
107
+ # pyenv
108
+ # For a library or package, you might want to ignore these files since the code is
109
+ # intended to run in multiple environments; otherwise, check them in:
110
+ # .python-version
111
+
112
+ # pipenv
113
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
114
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
115
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
116
+ # install all needed dependencies.
117
+ # Pipfile.lock
118
+
119
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
120
+ __pypackages__/
121
+
122
+ # Celery stuff
123
+ celerybeat-schedule
124
+ celerybeat.pid
125
+
126
+ # SageMath parsed files
127
+ *.sage.py
128
+
129
+ # Environments
130
+ .env
131
+ .venv
132
+ env/
133
+ venv/
134
+ ENV/
135
+ env.bak/
136
+ venv.bak/
137
+
138
+ # Spyder project settings
139
+ .spyderproject
140
+ .spyproject
141
+
142
+ # Rope project settings
143
+ .ropeproject
144
+
145
+ # mkdocs documentation
146
+ /site
147
+
148
+ # mypy
149
+ .mypy_cache/
150
+ .dmypy.json
151
+ dmypy.json
152
+
153
+ # Pyre type checker
154
+ .pyre/
155
+
156
+ # pytype static type analyzer
157
+ .pytype/
158
+
159
+ # Cython debug symbols
160
+ cython_debug/
161
+
162
+ # asv environments
163
+ .asv
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.4
2
+ Name: pystac-core
3
+ Version: 1.15.0
4
+ Summary: Core functionality for PySTAC without extensions. Most users will want to use pystac, not this package
5
+ Project-URL: Documentation, https://pystac.readthedocs.io
6
+ Project-URL: Repository, https://github.com/stac-utils/pystac
7
+ Project-URL: Issues, https://github.com/stac-utils/pystac/issues
8
+ Project-URL: Changelog, https://github.com/stac-utils/pystac/blob/main/CHANGELOG.md
9
+ Project-URL: Discussions, https://github.com/radiantearth/stac-spec/discussions/categories/stac-software
10
+ Author-email: Rob Emanuele <rdemanuele@gmail.com>, Jon Duckworth <duckontheweb@gmail.com>
11
+ Maintainer-email: Pete Gadomski <pete.gadomski@gmail.com>
12
+ License: Apache-2.0
13
+ Keywords: STAC,catalog,imagery,pystac,raster
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Natural Language :: English
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: python-dateutil>=2.7.0
File without changes
@@ -0,0 +1,39 @@
1
+ [project]
2
+ name = "pystac-core"
3
+ description = "Core functionality for PySTAC without extensions. Most users will want to use pystac, not this package"
4
+ readme = "README.md"
5
+ version = "1.15.0"
6
+ authors = [
7
+ { name = "Rob Emanuele", email = "rdemanuele@gmail.com" },
8
+ { name = "Jon Duckworth", email = "duckontheweb@gmail.com" },
9
+ ]
10
+ maintainers = [{ name = "Pete Gadomski", email = "pete.gadomski@gmail.com" }]
11
+ keywords = ["pystac", "imagery", "raster", "catalog", "STAC"]
12
+ license = { text = "Apache-2.0" }
13
+ classifiers = [
14
+ "Development Status :: 5 - Production/Stable",
15
+ "Intended Audience :: Developers",
16
+ "License :: OSI Approved :: Apache Software License",
17
+ "Natural Language :: English",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ ]
24
+ requires-python = ">=3.10"
25
+ dependencies = ["python-dateutil>=2.7.0"]
26
+
27
+ [project.urls]
28
+ Documentation = "https://pystac.readthedocs.io"
29
+ Repository = "https://github.com/stac-utils/pystac"
30
+ Issues = "https://github.com/stac-utils/pystac/issues"
31
+ Changelog = "https://github.com/stac-utils/pystac/blob/main/CHANGELOG.md"
32
+ Discussions = "https://github.com/radiantearth/stac-spec/discussions/categories/stac-software"
33
+
34
+ [build-system]
35
+ requires = ["hatchling"]
36
+ build-backend = "hatchling.build"
37
+
38
+ [tool.hatch.build.targets.wheel]
39
+ packages = ["pystac"]
@@ -0,0 +1,260 @@
1
+ # isort: skip_file
2
+ """
3
+ PySTAC is a library for working with SpatioTemporal Asset Catalogs (STACs)
4
+ """
5
+
6
+ from pkgutil import extend_path
7
+
8
+ __path__ = extend_path(__path__, __name__)
9
+
10
+ __all__ = [
11
+ "__version__",
12
+ "TemplateError",
13
+ "STACError",
14
+ "STACTypeError",
15
+ "DuplicateObjectKeyError",
16
+ "ExtensionAlreadyExistsError",
17
+ "ExtensionNotImplemented",
18
+ "ExtensionTypeError",
19
+ "RequiredPropertyMissing",
20
+ "STACValidationError",
21
+ "DeprecatedWarning",
22
+ "MediaType",
23
+ "RelType",
24
+ "StacIO",
25
+ "STACObject",
26
+ "STACObjectType",
27
+ "Link",
28
+ "HIERARCHICAL_LINKS",
29
+ "Catalog",
30
+ "CatalogType",
31
+ "Collection",
32
+ "Extent",
33
+ "SpatialExtent",
34
+ "TemporalExtent",
35
+ "Summaries",
36
+ "CommonMetadata",
37
+ "RangeSummary",
38
+ "Item",
39
+ "Asset",
40
+ "ItemAssetDefinition",
41
+ "ItemCollection",
42
+ "Provider",
43
+ "ProviderRole",
44
+ "read_file",
45
+ "read_dict",
46
+ "write_file",
47
+ "get_stac_version",
48
+ "set_stac_version",
49
+ ]
50
+
51
+ import warnings
52
+ from typing import Any
53
+
54
+ from pystac.errors import (
55
+ TemplateError,
56
+ STACError,
57
+ STACTypeError,
58
+ DuplicateObjectKeyError,
59
+ ExtensionAlreadyExistsError,
60
+ ExtensionNotImplemented,
61
+ ExtensionTypeError,
62
+ RequiredPropertyMissing,
63
+ STACValidationError,
64
+ DeprecatedWarning,
65
+ )
66
+
67
+ from pystac.version import (
68
+ __version__,
69
+ get_stac_version,
70
+ set_stac_version,
71
+ )
72
+ from pystac.media_type import MediaType
73
+ from pystac.rel_type import RelType
74
+ from pystac.stac_io import StacIO
75
+ from pystac.stac_object import STACObject, STACObjectType
76
+ from pystac.link import Link, HIERARCHICAL_LINKS
77
+ from pystac.catalog import Catalog, CatalogType
78
+ from pystac.collection import (
79
+ Collection,
80
+ Extent,
81
+ SpatialExtent,
82
+ TemporalExtent,
83
+ )
84
+ from pystac.common_metadata import CommonMetadata
85
+ from pystac.summaries import RangeSummary, Summaries
86
+ from pystac.asset import Asset
87
+ from pystac.item import Item
88
+ from pystac.item_assets import ItemAssetDefinition
89
+ from pystac.item_collection import ItemCollection
90
+ from pystac.provider import ProviderRole, Provider
91
+ from pystac.utils import HREF
92
+
93
+ import pystac.extensions.hooks
94
+ import pystac.extensions.classification
95
+ import pystac.extensions.datacube
96
+ import pystac.extensions.eo
97
+ import pystac.extensions.file
98
+ import pystac.extensions.grid
99
+ import pystac.extensions.item_assets
100
+
101
+ with warnings.catch_warnings():
102
+ warnings.filterwarnings("ignore", category=DeprecationWarning)
103
+ import pystac.extensions.label
104
+ import pystac.extensions.mgrs
105
+ import pystac.extensions.mlm
106
+ import pystac.extensions.pointcloud
107
+ import pystac.extensions.projection
108
+ import pystac.extensions.raster
109
+ import pystac.extensions.sar
110
+ import pystac.extensions.sat
111
+ import pystac.extensions.scientific
112
+ import pystac.extensions.storage
113
+ import pystac.extensions.table
114
+ import pystac.extensions.timestamps
115
+ import pystac.extensions.version
116
+ import pystac.extensions.view
117
+ import pystac.extensions.xarray_assets
118
+
119
+ EXTENSION_HOOKS = pystac.extensions.hooks.RegisteredExtensionHooks(
120
+ [
121
+ pystac.extensions.classification.CLASSIFICATION_EXTENSION_HOOKS,
122
+ pystac.extensions.datacube.DATACUBE_EXTENSION_HOOKS,
123
+ pystac.extensions.eo.EO_EXTENSION_HOOKS,
124
+ pystac.extensions.file.FILE_EXTENSION_HOOKS,
125
+ pystac.extensions.grid.GRID_EXTENSION_HOOKS,
126
+ pystac.extensions.item_assets.ITEM_ASSETS_EXTENSION_HOOKS,
127
+ pystac.extensions.label.LABEL_EXTENSION_HOOKS,
128
+ pystac.extensions.mgrs.MGRS_EXTENSION_HOOKS,
129
+ pystac.extensions.mlm.MLM_EXTENSION_HOOKS,
130
+ pystac.extensions.pointcloud.POINTCLOUD_EXTENSION_HOOKS,
131
+ pystac.extensions.projection.PROJECTION_EXTENSION_HOOKS,
132
+ pystac.extensions.raster.RASTER_EXTENSION_HOOKS,
133
+ pystac.extensions.sar.SAR_EXTENSION_HOOKS,
134
+ pystac.extensions.sat.SAT_EXTENSION_HOOKS,
135
+ pystac.extensions.scientific.SCIENTIFIC_EXTENSION_HOOKS,
136
+ pystac.extensions.storage.STORAGE_EXTENSION_HOOKS,
137
+ pystac.extensions.table.TABLE_EXTENSION_HOOKS,
138
+ pystac.extensions.timestamps.TIMESTAMPS_EXTENSION_HOOKS,
139
+ pystac.extensions.version.VERSION_EXTENSION_HOOKS,
140
+ pystac.extensions.view.VIEW_EXTENSION_HOOKS,
141
+ pystac.extensions.xarray_assets.XARRAY_ASSETS_EXTENSION_HOOKS,
142
+ ]
143
+ )
144
+
145
+
146
+ def read_file(href: HREF, stac_io: StacIO | None = None) -> STACObject:
147
+ """Reads a STAC object from a file.
148
+
149
+ This method will return either a Catalog, a Collection, or an Item based on what
150
+ the file contains.
151
+
152
+ This is a convenience method for :meth:`StacIO.read_stac_object
153
+ <pystac.StacIO.read_stac_object>`
154
+
155
+ Args:
156
+ href : The HREF to read the object from.
157
+ stac_io: Optional :class:`~StacIO` instance to use for I/O operations. If not
158
+ provided, will use :meth:`StacIO.default` to create an instance.
159
+
160
+ Returns:
161
+ The specific STACObject implementation class that is represented
162
+ by the JSON read from the file located at HREF.
163
+
164
+ Raises:
165
+ STACTypeError : If the file at ``href`` does not represent a valid
166
+ :class:`~pystac.STACObject`. Note that an :class:`~pystac.ItemCollection`
167
+ is not a :class:`~pystac.STACObject` and must be read using
168
+ :meth:`ItemCollection.from_file <pystac.ItemCollection.from_file>`
169
+ """
170
+ if stac_io is None:
171
+ stac_io = StacIO.default()
172
+ return stac_io.read_stac_object(href)
173
+
174
+
175
+ def write_file(
176
+ obj: STACObject,
177
+ include_self_link: bool = True,
178
+ dest_href: HREF | None = None,
179
+ stac_io: StacIO | None = None,
180
+ ) -> None:
181
+ """Writes a STACObject to a file.
182
+
183
+ This will write only the Catalog, Collection or Item ``obj``. It will not attempt
184
+ to write any other objects that are linked to ``obj``; if you'd like functionality
185
+ to save off catalogs recursively see :meth:`Catalog.save <pystac.Catalog.save>`.
186
+
187
+ This method will write the JSON of the object to the object's assigned "self" link
188
+ or to the dest_href if provided. To set the self link, see
189
+ :meth:`STACObject.set_self_href <pystac.STACObject.set_self_href>`.
190
+
191
+ Convenience method for :meth:`STACObject.from_file <pystac.STACObject.from_file>`
192
+
193
+ Args:
194
+ obj : The STACObject to save.
195
+ include_self_link : If ``True``, include the ``"self"`` link with this object.
196
+ Otherwise, leave out the self link.
197
+ dest_href : Optional HREF to save the file to. If ``None``, the object will be
198
+ saved to the object's ``"self"`` href.
199
+ stac_io: Optional :class:`~StacIO` instance to use for I/O operations. If not
200
+ provided, will use :meth:`StacIO.default` to create an instance.
201
+ """
202
+ if stac_io is None:
203
+ stac_io = StacIO.default()
204
+ import os
205
+
206
+ dest_href = None if dest_href is None else str(os.fspath(dest_href))
207
+ obj.save_object(
208
+ include_self_link=include_self_link, dest_href=dest_href, stac_io=stac_io
209
+ )
210
+
211
+
212
+ def read_dict(
213
+ d: dict[str, Any],
214
+ href: str | None = None,
215
+ root: Catalog | None = None,
216
+ stac_io: StacIO | None = None,
217
+ ) -> STACObject:
218
+ """Reads a :class:`~STACObject` or :class:`~ItemCollection` from a JSON-like dict
219
+ representing a serialized STAC object.
220
+
221
+ This method will return either a :class:`~Catalog`, :class:`~Collection`,
222
+ or :class`~Item` based on the contents of the dict.
223
+
224
+ This is a convenience method for either
225
+ :meth:`StacIO.stac_object_from_dict <pystac.StacIO.stac_object_from_dict>`.
226
+
227
+ Args:
228
+ d : The dict to parse.
229
+ href : Optional href that is the file location of the object being
230
+ parsed.
231
+ root : Optional root of the catalog for this object.
232
+ If provided, the root's resolved object cache can be used to search for
233
+ previously resolved instances of the STAC object.
234
+ stac_io: Optional :class:`~StacIO` instance to use for reading. If ``None``,
235
+ the default instance will be used.
236
+
237
+ Raises:
238
+ STACTypeError : If the ``d`` dictionary does not represent a valid
239
+ :class:`~pystac.STACObject`. Note that an :class:`~pystac.ItemCollection`
240
+ is not a :class:`~pystac.STACObject` and must be read using
241
+ :meth:`ItemCollection.from_dict <pystac.ItemCollection.from_dict>`
242
+ """
243
+ if stac_io is None:
244
+ stac_io = StacIO.default()
245
+ return stac_io.stac_object_from_dict(d, href, root)
246
+
247
+
248
+ def __getattr__(name: str) -> Any:
249
+ if name == "validation":
250
+ import warnings
251
+ import pystac.validation
252
+
253
+ warnings.warn(
254
+ "pystac.validation will not be automatically imported to the package in "
255
+ "pystac v2.0. Instead, import it directly: `import pystac.validation`",
256
+ DeprecationWarning,
257
+ stacklevel=2,
258
+ )
259
+ return pystac.validation
260
+ raise AttributeError(f"module '{__name__}' has no attribute '{name}'")