summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-stac-pydantic.spec418
-rw-r--r--sources1
3 files changed, 420 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..0ae74f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/stac-pydantic-2.0.3.tar.gz
diff --git a/python-stac-pydantic.spec b/python-stac-pydantic.spec
new file mode 100644
index 0000000..9dfa305
--- /dev/null
+++ b/python-stac-pydantic.spec
@@ -0,0 +1,418 @@
+%global _empty_manifest_terminate_build 0
+Name: python-stac-pydantic
+Version: 2.0.3
+Release: 1
+Summary: Pydantic data models for the STAC spec
+License: MIT
+URL: https://github.com/stac-utils/stac-pydantic
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/c3/44/8bb64915e137cbfc05950bf62d2325a2c92d4a5fe983b154d880a43ceac1/stac-pydantic-2.0.3.tar.gz
+BuildArch: noarch
+
+Requires: python3-click
+Requires: python3-pydantic
+Requires: python3-geojson-pydantic
+Requires: python3-arrow
+Requires: python3-pytest
+Requires: python3-pytest-cov
+Requires: python3-requests
+Requires: python3-shapely
+Requires: python3-dictdiffer
+Requires: python3-jsonschema
+
+%description
+# stac-pydantic ![tests](https://github.com/arturo-ai/stac-pydantic/workflows/cicd/badge.svg)
+[Pydantic](https://pydantic-docs.helpmanual.io/) models for [STAC](https://github.com/radiantearth/stac-spec) Catalogs, Collections, Items, and the [STAC API](https://github.com/radiantearth/stac-api-spec) spec. Initially developed by [arturo-ai](https://github.com/arturo-ai).
+
+## Installation
+```
+pip install stac-pydantic
+```
+
+For local development:
+```
+pip install -e .["dev"]
+```
+
+| stac-pydantic | stac |
+|-------------------|--------------|
+| 1.1.x | 0.9.0 |
+| 1.2.x | 1.0.0-beta.1 |
+| 1.3.x | 1.0.0-beta.2 |
+| 2.0.x | 1.0.0 |
+
+## Testing
+Run the entire test suite:
+```
+tox
+```
+
+Run a single test case using the standard pytest convention:
+```
+pytest -v tests/test_models.py::test_item_extensions
+```
+
+## Usage
+### Loading Models
+Load data into models with standard pydantic:
+```python
+from stac_pydantic import Catalog
+
+stac_catalog = {
+ "stac_version": "0.9.0",
+ "id": "sample",
+ "description": "This is a very basic sample catalog.",
+ "links": [
+ {
+ "href": "item.json",
+ "rel": "item"
+ }
+ ]
+}
+
+catalog = Catalog(**stac_catalog)
+assert catalog.id == "sample"
+assert catalog.links[0].href == "item.json"
+```
+
+### Extensions
+STAC defines many extensions which let the user customize the data in their catalog. `stac-pydantic.extensions.validate_extensions` will validate a `dict`, `Item`, `Collection` or `Catalog` against the schema urls provided in the `stac_extensions` property:
+
+```python
+from stac_pydantic import Item
+from stac_pydantic.extensions import validate_extensions
+
+stac_item = {
+ "id": "12345",
+ "type": "Feature",
+ "stac_extensions": [
+ "https://stac-extensions.github.io/eo/v1.0.0/schema.json"
+ ],
+ "geometry": { "type": "Point", "coordinates": [0, 0] },
+ "properties": {
+ "datetime": "2020-03-09T14:53:23.262208+00:00",
+ "eo:cloud_cover": 25,
+ },
+ "links": [],
+ "assets": [],
+}
+
+model = Item(**stac_item)
+validate_extensions(model, reraise_exception=True)
+assert getattr(model.properties, "eo:cloud_cover") == 25
+```
+
+The complete list of current STAC Extensions can be found [here](https://stac-extensions.github.io/).
+
+#### Vendor Extensions
+The same procedure described above works for any STAC Extension schema as long as it can be loaded from a public url.
+
+### Exporting Models
+Most STAC extensions are namespaced with a colon (ex `eo:gsd`) to keep them distinct from other extensions. Because
+Python doesn't support the use of colons in variable names, we use [Pydantic aliasing](https://pydantic-docs.helpmanual.io/usage/model_config/#alias-generator)
+to add the namespace upon model export. This requires [exporting](https://pydantic-docs.helpmanual.io/usage/exporting_models/)
+the model with the `by_alias = True` parameter. A convenience method (``to_dict()``) is provided to export models with
+extension namespaces:
+
+```python
+item_dict = item.to_dict()
+assert item_dict['properties']['landsat:row'] == item.properties.row == 250
+```
+
+### CLI
+```
+Usage: stac-pydantic [OPTIONS] COMMAND [ARGS]...
+
+ stac-pydantic cli group
+
+Options:
+ --help Show this message and exit.
+
+Commands:
+ validate-item Validate STAC Item
+```
+
+
+
+
+%package -n python3-stac-pydantic
+Summary: Pydantic data models for the STAC spec
+Provides: python-stac-pydantic
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-stac-pydantic
+# stac-pydantic ![tests](https://github.com/arturo-ai/stac-pydantic/workflows/cicd/badge.svg)
+[Pydantic](https://pydantic-docs.helpmanual.io/) models for [STAC](https://github.com/radiantearth/stac-spec) Catalogs, Collections, Items, and the [STAC API](https://github.com/radiantearth/stac-api-spec) spec. Initially developed by [arturo-ai](https://github.com/arturo-ai).
+
+## Installation
+```
+pip install stac-pydantic
+```
+
+For local development:
+```
+pip install -e .["dev"]
+```
+
+| stac-pydantic | stac |
+|-------------------|--------------|
+| 1.1.x | 0.9.0 |
+| 1.2.x | 1.0.0-beta.1 |
+| 1.3.x | 1.0.0-beta.2 |
+| 2.0.x | 1.0.0 |
+
+## Testing
+Run the entire test suite:
+```
+tox
+```
+
+Run a single test case using the standard pytest convention:
+```
+pytest -v tests/test_models.py::test_item_extensions
+```
+
+## Usage
+### Loading Models
+Load data into models with standard pydantic:
+```python
+from stac_pydantic import Catalog
+
+stac_catalog = {
+ "stac_version": "0.9.0",
+ "id": "sample",
+ "description": "This is a very basic sample catalog.",
+ "links": [
+ {
+ "href": "item.json",
+ "rel": "item"
+ }
+ ]
+}
+
+catalog = Catalog(**stac_catalog)
+assert catalog.id == "sample"
+assert catalog.links[0].href == "item.json"
+```
+
+### Extensions
+STAC defines many extensions which let the user customize the data in their catalog. `stac-pydantic.extensions.validate_extensions` will validate a `dict`, `Item`, `Collection` or `Catalog` against the schema urls provided in the `stac_extensions` property:
+
+```python
+from stac_pydantic import Item
+from stac_pydantic.extensions import validate_extensions
+
+stac_item = {
+ "id": "12345",
+ "type": "Feature",
+ "stac_extensions": [
+ "https://stac-extensions.github.io/eo/v1.0.0/schema.json"
+ ],
+ "geometry": { "type": "Point", "coordinates": [0, 0] },
+ "properties": {
+ "datetime": "2020-03-09T14:53:23.262208+00:00",
+ "eo:cloud_cover": 25,
+ },
+ "links": [],
+ "assets": [],
+}
+
+model = Item(**stac_item)
+validate_extensions(model, reraise_exception=True)
+assert getattr(model.properties, "eo:cloud_cover") == 25
+```
+
+The complete list of current STAC Extensions can be found [here](https://stac-extensions.github.io/).
+
+#### Vendor Extensions
+The same procedure described above works for any STAC Extension schema as long as it can be loaded from a public url.
+
+### Exporting Models
+Most STAC extensions are namespaced with a colon (ex `eo:gsd`) to keep them distinct from other extensions. Because
+Python doesn't support the use of colons in variable names, we use [Pydantic aliasing](https://pydantic-docs.helpmanual.io/usage/model_config/#alias-generator)
+to add the namespace upon model export. This requires [exporting](https://pydantic-docs.helpmanual.io/usage/exporting_models/)
+the model with the `by_alias = True` parameter. A convenience method (``to_dict()``) is provided to export models with
+extension namespaces:
+
+```python
+item_dict = item.to_dict()
+assert item_dict['properties']['landsat:row'] == item.properties.row == 250
+```
+
+### CLI
+```
+Usage: stac-pydantic [OPTIONS] COMMAND [ARGS]...
+
+ stac-pydantic cli group
+
+Options:
+ --help Show this message and exit.
+
+Commands:
+ validate-item Validate STAC Item
+```
+
+
+
+
+%package help
+Summary: Development documents and examples for stac-pydantic
+Provides: python3-stac-pydantic-doc
+%description help
+# stac-pydantic ![tests](https://github.com/arturo-ai/stac-pydantic/workflows/cicd/badge.svg)
+[Pydantic](https://pydantic-docs.helpmanual.io/) models for [STAC](https://github.com/radiantearth/stac-spec) Catalogs, Collections, Items, and the [STAC API](https://github.com/radiantearth/stac-api-spec) spec. Initially developed by [arturo-ai](https://github.com/arturo-ai).
+
+## Installation
+```
+pip install stac-pydantic
+```
+
+For local development:
+```
+pip install -e .["dev"]
+```
+
+| stac-pydantic | stac |
+|-------------------|--------------|
+| 1.1.x | 0.9.0 |
+| 1.2.x | 1.0.0-beta.1 |
+| 1.3.x | 1.0.0-beta.2 |
+| 2.0.x | 1.0.0 |
+
+## Testing
+Run the entire test suite:
+```
+tox
+```
+
+Run a single test case using the standard pytest convention:
+```
+pytest -v tests/test_models.py::test_item_extensions
+```
+
+## Usage
+### Loading Models
+Load data into models with standard pydantic:
+```python
+from stac_pydantic import Catalog
+
+stac_catalog = {
+ "stac_version": "0.9.0",
+ "id": "sample",
+ "description": "This is a very basic sample catalog.",
+ "links": [
+ {
+ "href": "item.json",
+ "rel": "item"
+ }
+ ]
+}
+
+catalog = Catalog(**stac_catalog)
+assert catalog.id == "sample"
+assert catalog.links[0].href == "item.json"
+```
+
+### Extensions
+STAC defines many extensions which let the user customize the data in their catalog. `stac-pydantic.extensions.validate_extensions` will validate a `dict`, `Item`, `Collection` or `Catalog` against the schema urls provided in the `stac_extensions` property:
+
+```python
+from stac_pydantic import Item
+from stac_pydantic.extensions import validate_extensions
+
+stac_item = {
+ "id": "12345",
+ "type": "Feature",
+ "stac_extensions": [
+ "https://stac-extensions.github.io/eo/v1.0.0/schema.json"
+ ],
+ "geometry": { "type": "Point", "coordinates": [0, 0] },
+ "properties": {
+ "datetime": "2020-03-09T14:53:23.262208+00:00",
+ "eo:cloud_cover": 25,
+ },
+ "links": [],
+ "assets": [],
+}
+
+model = Item(**stac_item)
+validate_extensions(model, reraise_exception=True)
+assert getattr(model.properties, "eo:cloud_cover") == 25
+```
+
+The complete list of current STAC Extensions can be found [here](https://stac-extensions.github.io/).
+
+#### Vendor Extensions
+The same procedure described above works for any STAC Extension schema as long as it can be loaded from a public url.
+
+### Exporting Models
+Most STAC extensions are namespaced with a colon (ex `eo:gsd`) to keep them distinct from other extensions. Because
+Python doesn't support the use of colons in variable names, we use [Pydantic aliasing](https://pydantic-docs.helpmanual.io/usage/model_config/#alias-generator)
+to add the namespace upon model export. This requires [exporting](https://pydantic-docs.helpmanual.io/usage/exporting_models/)
+the model with the `by_alias = True` parameter. A convenience method (``to_dict()``) is provided to export models with
+extension namespaces:
+
+```python
+item_dict = item.to_dict()
+assert item_dict['properties']['landsat:row'] == item.properties.row == 250
+```
+
+### CLI
+```
+Usage: stac-pydantic [OPTIONS] COMMAND [ARGS]...
+
+ stac-pydantic cli group
+
+Options:
+ --help Show this message and exit.
+
+Commands:
+ validate-item Validate STAC Item
+```
+
+
+
+
+%prep
+%autosetup -n stac-pydantic-2.0.3
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-stac-pydantic -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0.3-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..f611f30
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+62089505a0402ff9f30a65c3d1e3ab9b stac-pydantic-2.0.3.tar.gz