Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

stacrs

GitHub Workflow Status GitHub Workflow Status PyPI - Version Conda Downloads PyPI - License Contributor Covenant

A Python package for STAC using Rust under the hood.

Why?

Q: We already have PySTAC, so why stacrs?

A: stacrs can

If you don't need those things, stacrs probably isn't for you — use pystac and its friend, pystac-client.

Usage

Install via pip:

# basic
python -m pip install stacrs

# support arrow tables
python -m pip install 'stacrs[arrow]'

Or via conda:

conda install conda-forge::stacrs

Then:

import stacrs

# Search a STAC API
items = await stacrs.search(
    "https://landsatlook.usgs.gov/stac-server",
    collections="landsat-c2l2-sr",
    intersects={"type": "Point", "coordinates": [-105.119, 40.173]},
    sortby="-properties.datetime",
    max_items=100,
)

# If you installed with `pystac[arrow]`:
from geopandas import GeoDataFrame
table = await stacrs.search_to_arrow(...)
data_frame = GeoDataFrame.from_arrow(table)
items = stacrs.from_arrow(data_frame.to_arrow())

# Write items to a stac-geoparquet file
await stacrs.write("items.parquet", items)

# Read items from a stac-geoparquet file as an item collection
item_collection = await stacrs.read("items.parquet")

# You can search geoparquet files using DuckDB
# If you want to search a file on s3, make sure to configure your AWS environment first
item_collection = await stacrs.search("s3://bucket/items.parquet", ...)

# Use `search_to` for better performance if you know you'll be writing the items
# to a file
await stacrs.search_to(
    "items.parquet",
    "https://landsatlook.usgs.gov/stac-server",
    collections="landsat-c2l2-sr",
    intersects={"type": "Point", "coordinates": [-105.119, 40.173]},
    sortby="-properties.datetime",
    max_items=100,
)

See the documentation for details. In particular, our example notebook demonstrates some of the more interesting features.

CLI

stacrs comes with a CLI:

$ stacrs -h
stacrs: A command-line interface for the SpatioTemporal Asset Catalog (STAC)

Usage: stacrs [OPTIONS] <COMMAND>

Commands:
  translate  Translates STAC from one format to another
  search     Searches a STAC API or stac-geoparquet file
  serve      Serves a STAC API
  validate   Validates a STAC value
  help       Print this message or the help of the given subcommand(s)

Options:
  -i, --input-format <INPUT_FORMAT>
          The input format.
      --opt <OPTIONS>
          Options for getting and putting files from object storage.
  -o, --output-format <OUTPUT_FORMAT>
          The output format.
  -c, --compact-json <COMPACT_JSON>
          Whether to print compact JSON output [possible values: true, false]
      --parquet-compression <PARQUET_COMPRESSION>
          The parquet compression to use when writing stac-geoparquet.
  -h, --help
          Print help (see more with '--help')

[!NOTE] Before stacrs v0.5.4, the CLI was its own PyPI package named stacrs-cli, which is no longer needed.

stac-geoparquet

stacrs replicates much of the behavior in the stac-geoparquet library, and even uses some of the same Rust dependencies. We believe there are a couple of issues with stac-geoparquet that make stacrs a worthy replacement:

  • The stac-geoparquet repo includes Python dependencies
  • It doesn't have a nice one-shot API for reading and writing
  • It includes some leftover code and logic from its genesis as a tool for the Microsoft Planetary Computer

We test to ensure compatibility between the two libraries, and we intend to consolidate to a single "stac-geoparquet" library at some point in the future.

Development

Get Rust, uv, and (optionally) libduckdb. Then:

git clone git@github.com:stac-utils/stacrs.git
cd stacrs
scripts/test

See CONTRIBUTING.md for more information about contributing to this project.

DuckDB

By default, this package expects libduckdb to be present on your system. If you get this sort of error when building:

  = note: ld: library 'duckdb' not found

Set your DUCKDB_LIB_DIR to point to your libduckdb. If you're using homebrew, that might look like this:

export DUCKDB_LIB_DIR=/opt/homebrew/lib

Alternatively, you can use the duckdb-bundled feature to build DuckDB bindings into the Rust library:

maturin dev --uv -F duckdb-bundled && pytest

[!WARNING] Building DuckDB bundled takes a long while.

License

stacrs is dual-licensed under both the MIT license and the Apache license (Version 2.0). See LICENSE-APACHE and LICENSE-MIT for details.

Metadata

Release files for stacrs 0.5.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stacrs 0.5.9
File Size Uploaded
stacrs-0.5.9.tar.gz 603.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for stacrs 0.5.9
File
stacrs-0.5.9-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details
stacrs-0.5.9-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details
stacrs-0.5.9-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
stacrs-0.5.9-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details
stacrs-0.5.9-cp310-cp310-manylinux_2_28_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ ARM64 Details
stacrs-0.5.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
stacrs-0.5.9-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
stacrs-0.5.9-cp310-cp310-macosx_10_12_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.12+ x86-64 Details

Total release size: 174.5 MB

Release files / stacrs-0.5.9.tar.gz

Download URL stacrs-0.5.9.tar.gz
Size 603.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ddcfca4615d1ab71c79625499110f46961953e9b8c79e1366450f34d194b8a77
BLAKE2b-256 checksum
How to use checksums
4812ad49dd6a31536dd9027f729184dc81be30867d0fe23dc3176ecb3ac8a98e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.8.2

Release files / stacrs-0.5.9-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL stacrs-0.5.9-cp311-abi3-manylinux_2_28_aarch64.whl
Size 20.8 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
a3c5610a76d69b9baf200b3f9faaa8882f4fd3c11c66c1af71ac992d4df4941d
BLAKE2b-256 checksum
How to use checksums
e049fcc313d747e48992b13a2f7021fc35ea174db1bff14d273b5c0be8445745
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.8.2

Release files / stacrs-0.5.9-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL stacrs-0.5.9-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 22.8 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
238c96a746d77cb35770dc002b6c7b1904ef874070e4300cf6643cb6adf98dec
BLAKE2b-256 checksum
How to use checksums
84bd67efad6c19263dbc4f27b6f7db628b7aceda865ca969b50a3073651eb9b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.8.2

Release files / stacrs-0.5.9-cp311-abi3-macosx_11_0_arm64.whl

Download URL stacrs-0.5.9-cp311-abi3-macosx_11_0_arm64.whl
Size 22.3 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0c93b07048111a6480080db23cd5f5c89e67966dcd90cbee78dca15c1cc8ddb1
BLAKE2b-256 checksum
How to use checksums
f076fb56297b57551adb58c731c7a7ee2eec9f4d12c22d81014e5443c1f0594e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.8.2

Release files / stacrs-0.5.9-cp311-abi3-macosx_10_12_x86_64.whl

Download URL stacrs-0.5.9-cp311-abi3-macosx_10_12_x86_64.whl
Size 21.0 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0da7a1cd7c04bf29d054efd4e1a2258fc3c214f2cdacc934e512a3c4b6a8cc7c
BLAKE2b-256 checksum
How to use checksums
21bd7494be14b748b313baec39242b14878a77a6684ad6b9857fc6c0605da6fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.8.2

Release files / stacrs-0.5.9-cp310-cp310-manylinux_2_28_aarch64.whl

Download URL stacrs-0.5.9-cp310-cp310-manylinux_2_28_aarch64.whl
Size 20.8 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
6cce4a93e59ebe6f3222d65015853a13c8d5a5d9a5006872d34be29163f05423
BLAKE2b-256 checksum
How to use checksums
506d172788f2a5742d0645a1e48b230f14a0e4ec46b3bcf1f2eab91210ca5baa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.8.2

Release files / stacrs-0.5.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL stacrs-0.5.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 22.8 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
eac36df2826e2140e91e0365bb04c6461675aa654635c3f27663c01d7e03b112
BLAKE2b-256 checksum
How to use checksums
1f4b5f3ed391e64d25426f4643f66cd05795b1068b20f6675fb7649b5778b9e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.8.2

Release files / stacrs-0.5.9-cp310-cp310-macosx_11_0_arm64.whl

Download URL stacrs-0.5.9-cp310-cp310-macosx_11_0_arm64.whl
Size 22.3 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
edfdff03574b887d018c7dd8a98aa267d68f2fa7ad9aa3206756847fd8c99da0
BLAKE2b-256 checksum
How to use checksums
c9c7561faf34afbe4e7ab8c0c1e376865aeb7ee4eabd3029a81eb1897c4a9301
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.8.2

Release files / stacrs-0.5.9-cp310-cp310-macosx_10_12_x86_64.whl

Download URL stacrs-0.5.9-cp310-cp310-macosx_10_12_x86_64.whl
Size 21.0 MB
Tags CPython 3.10 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
059ed79ac277c8de2fbd58e1b19d8ac2cb802fc1ec4fd42741b0fac8f7df887c
BLAKE2b-256 checksum
How to use checksums
19ebb74b39f2a46f8254eb867bb1704ebd065aa48ae9db6bfcc61983a6b0f154
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.8.2

Release history Release notifications | RSS feed

This release

0.5.9 This release

9 release files

0.5.7

9 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page