Registry / serialization / stac-pydantic

stac-pydantic

JSON →
library3.5.1pypypi✓ verified 84d ago

Pydantic data models for the SpatioTemporal Asset Catalog (STAC) specification. Provides Python classes for validating and serializing STAC objects (Catalogs, Collections, Items, associated extensions) with strict conformance to the STAC spec. Version 3.5.1 supports Pydantic v2 and Python >=3.8.

pip install stac-pydantic
INSTALL
IMPORT
SIG · STAC-PYDANTIC
S
stac-pydantic
serializationpythonv3.5.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Catalog
from stac_pydantic import Catalog
from stac_pydantic.catalog import Catalog
The top-level import is preferred and equivalent.

Create a basic STAC Catalog and dump to dict.

from stac_pydantic import Catalog, Collection, Item catalog = Catalog( id='my-catalog', description='An example catalog', stac_version='1.0.0', stac_extensions=[], links=[] ) print(catalog.model_dump())
Debug
Known issues
breakingVersion 3.0.0 dropped Pydantic v1 support. Use `model_dump()` instead of `dict()`, `model_validate()` instead of `parse_obj()`.
fix
Migrate to Pydantic v2 API: replace `.dict()` with `.model_dump()` and `parse_obj()` with `model_validate()`.
affects: >=3.0.0
gotchaThe `stac_extensions` field expects a list of URIs (strings), not objects. Passing extension objects will raise a validation error.
fix
Always pass extension URIs as strings, e.g., `['https://stac-extensions.github.io/eo/v1.0.0/schema.json']`.
affects: all
deprecatedThe `from stac_pydantic.api import ItemCollection` and related API endpoints are deprecated and will be removed in 4.0. Use `stac_pydantic.collections.Collection` and `ItemCollection` from `stac_pydantic.links` instead.
fix
Import from `stac_pydantic.collections` and `stac_pydantic.links` as appropriate.
affects: <4.0
Errors
Common errors & fixes
ValidationError: 1 validation error for Item ... Extra inputs are not permitted
STAC Item contains fields not defined in the spec or extensions. The model is strict by default.
fix
Set `model_config = {'extra': 'allow'}` on a subclass or use `strict=False` when creating the model (if supported).
TypeError: 'type' object is not subscriptable
Using Pydantic v1 syntax like `Optional[str]` inside a `Field` with v2. stac-pydantic uses Pydantic v2.
fix
Upgrade to Pydantic v2 syntax: use `str | None` instead of `Optional[str]`.
Upgrade
Version history
3.5.1latest on PyPI · released May 5, 2026
Audit
Dependencies
pydanticrequiredCore validation framework; requires v2 for stac-pydantic >=3.0.0
Agent activity
34 hits · last 30 days
node
28
Amazon
1
OpenAI (training)
1
Resources
stac-pydantic — pip install stac-pydantic · libregistry