skillfed

pypgstac

Schema, functions and a python library for storing and accessing STAC collections and items in PostgreSQL

pypgstac v0.9.12 138.4K downloads/30d#11,329 on PyPI220
Permissive license MIT Active released

What it is and what it does

pypgstac is a Python library for interacting with STAC (Spatio-Temporal Asset Catalog) data stored in PostgreSQL. It provides schema management, search utilities, and integration with PostgreSQL's spatial capabilities to build performant catalogs of geospatial and temporal metadata. The package is part of a larger ecosystem that includes SQL schema definitions, a Rust CLI, and migration tools—but pypgstac itself focuses on the Python read/write layer.

The library is designed to work alongside PostgreSQL drivers and is typically used in production deployments where STAC catalogs need to scale to hundreds of millions of items. It does not expose an HTTP API directly; instead, it serves as a backend for frameworks like STAC FastAPI or other applications that need programmatic access to STAC collections and items stored in a PostgreSQL database.

Use it for:

  • Query and filter STAC collections and items from a PostgreSQL database using CQL2 search syntax
  • Manage indexing and partitioning of large STAC catalogs in production environments
  • Build custom STAC API backends by integrating pypgstac with web frameworks
  • Migrate or maintain STAC data stored in PostgreSQL with schema utilities
  • Integrate geospatial asset metadata into Python applications backed by PostgreSQL

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

pypgstac provides Python bindings and utilities for managing Spatio-Temporal Asset Catalog (STAC) data in PostgreSQL, including search, filtering, and schema management functions.

Yes, if you are building or maintaining a STAC catalog in PostgreSQL and need Python access to query and manage it. The package is actively maintained, has no known vulnerabilities, and low install friction. Not necessary if you only need HTTP-level STAC API access or are not using PostgreSQL as your backend.

Install

pypgstac on PyPI

pip

pip install pypgstac

uv

uv add pypgstac

poetry

poetry add pypgstac

Installing pypgstac

Before you install

Low friction installation with a pure-Python wheel. Active maintenance: released 15 days ago with a last commit on 2026-08-10. Depends on 10 runtime packages including pydantic, orjson, and tenacity—all common, stable dependencies.

License in practice

MIT license (permissive) allows use in commercial and proprietary projects with minimal restrictions beyond attribution.

Quickstart

pip install pypgstac

import pypgstac
from pydantic import BaseModel

# Use pypgstac with PostgreSQL connection to query STAC items

Requires a PostgreSQL database with PgSTAC schema installed; pypgstac is a Python client library, not a standalone database.

Verify before relying

  • Specific API surface and method signatures available in version 0.9.12
  • Whether pypgstac-rs (Rust-backed extension) is included or requires separate installation
  • Performance characteristics when querying hundreds of millions of STAC items

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 10 — cachetools, fire, hydraters, orjson, plpygis, pydantic, python-dateutil, smart-open, tenacity, version-parser
Maintenance actively maintained — 15 days since the last release
Last repo commit
First released
Downloads 138,382/month — #11,329 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pypgstac-0.9.12-py3-none-any.whl

Keywords: PgSTAC, Postgresql, STAC

Intended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

STAC PostgreSQL Python libraryspatio-temporal asset catalog databaseSTAC search and indexingPostgreSQL STAC schemageospatial catalog managementSTAC collection storageCQL2 search PostgreSQL
geospatialstac-catalogpostgresql

More Database packages