From ba4dba2382bc04873f0d9c2a85da552fa9324ccb Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Fri, 24 Nov 2023 06:44:10 -0800 Subject: [PATCH] release: v3.0.0 --- .pre-commit-config.yaml | 2 +- README.md | 27 +++++++++++++++++++++------ stac_pydantic/version.py | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7f1f255..c937782 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.5.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace diff --git a/README.md b/README.md index 922f5dd..2573da6 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,23 @@ -# 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). +# stac-pydantic + +[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/stac-utils/stac-pydantic/cicd.yml?style=for-the-badge)](https://github.com/stac-utils/stac-pydantic/actions/workflows/cicd.yml) + +[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). + +The main purpose of this library is to provide reusable request/response models for tools such as [fastapi](https://fastapi.tiangolo.com/). +For more comprehensive schema validation and robust extension support, use [pystac](https://github.com/stac-utils/pystac). ## Installation -``` + +```shell pip install stac-pydantic ``` For local development: -``` -pip install -e ".[all]" + +```shell +pip install -e '.[dev,lint]' ``` | stac-pydantic | STAC Version | @@ -17,6 +26,7 @@ pip install -e ".[all]" | 1.2.x | 1.0.0-beta.1 | | 1.3.x | 1.0.0-beta.2 | | 2.0.x | 1.0.0 | +| 3.0.x | 1.0.0 | ## Development @@ -78,6 +88,7 @@ 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 @@ -108,9 +119,11 @@ 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. ### STAC API + The [STAC API Specs](https://github.com/radiantearth/stac-api-spec) extent the core STAC specification for implementing dynamic catalogs. STAC Objects used in an API context should always import models from the `api` subpackage. This package extends Catalog, Collection, and Item models with additional fields and validation rules and introduces Collections and ItemCollections models and Pagination/ Search Links. It also implements models for defining ItemSeach queries. @@ -162,6 +175,7 @@ stac_item_collection = ItemCollection(**{ ``` ### 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/) @@ -173,7 +187,8 @@ assert item_dict['properties']['landsat:row'] == item.properties.row == 250 ``` ### CLI -``` + +```text Usage: stac-pydantic [OPTIONS] COMMAND [ARGS]... stac-pydantic cli group diff --git a/stac_pydantic/version.py b/stac_pydantic/version.py index 9ca45f0..7efd038 100644 --- a/stac_pydantic/version.py +++ b/stac_pydantic/version.py @@ -1,2 +1,2 @@ -__version__ = "2.0.3" +__version__ = "3.0.0" STAC_VERSION = "1.0.0"