Skip to main content

The power of Rust for the Python STAC ecosystem

Project description

rustac

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

The rustac logo

The power of Rust for the Python STAC ecosystem.

[!TIP] We pronounce rustac "ruh-stac".

[!NOTE] Until 2025-04-17, this package was named stacrs. See this RFC for context on the name change.

Why?

Q: We already have PySTAC, so why rustac?

A: rustac can

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

Installation

rustac has zero required dependencies. Install via pip:

# basic
python -m pip install rustac

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

Or via conda:

conda install conda-forge::rustac

From source

You'll need Rust. By default, rustac wants to find DuckDB on your system:

brew install duckdb  # if you're using Homebrew ... if not, get DuckDB another way
python -m pip install -U git+https://github.com/stac-utils/rustac-py

If you don't want to (or can't) install DuckDB, can build DuckDB as a "bundled" build (warning: it takes a while):

MATURIN_PEP517_ARGS="--features=duckdb-bundled" python -m pip install -U git+https://github.com/stac-utils/rustac-py

Usage

import asyncio
import rustac

async def main() -> None:
    # Search a STAC API
    items = await rustac.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 = rustac.to_arrow(items)
    data_frame = GeoDataFrame.from_arrow(table)
    items = rustac.from_arrow(data_frame.to_arrow())

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

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

    # Use `search_to` for better performance if you know you'll be writing the items
    # to a file
    await rustac.search_to(
        "/tmp/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,
    )

asyncio.run(main())

See the documentation for details. In particular, our examples demonstrate some of the more interesting features.

Command line interface (CLI)

rustac comes with a CLI:

rustac -h

stac-geoparquet

rustac 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 rustac 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/rustac-py.git
cd rustac-py
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.

Docs

If you want to run an off-cycle docs update (e.g. if you fixed something and want to post it without having to make a new release):

mike deploy [version] latest --push

Acknowledgements

We'd like to thank @jkeifer, @parksjr, and @Xenocide122 (all from @Element84) for creating the rustac logo from an AI-generated image from this prompt:

There is a library for working with STAC metadata that is written in rust called rustac: https://github.com/stac-utils/rustac. That name sounds like the word "rustic", and is meant to envoke (sic) an image of "a cabin and a glass of neat whisky".

License

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rustac-0.9.13.tar.gz (765.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rustac-0.9.13-cp311-abi3-win_amd64.whl (26.5 MB view details)

Uploaded CPython 3.11+Windows x86-64

rustac-0.9.13-cp311-abi3-win32.whl (23.8 MB view details)

Uploaded CPython 3.11+Windows x86

rustac-0.9.13-cp311-abi3-musllinux_1_2_x86_64.whl (37.3 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ x86-64

rustac-0.9.13-cp311-abi3-musllinux_1_2_i686.whl (39.5 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ i686

rustac-0.9.13-cp311-abi3-musllinux_1_2_armv7l.whl (34.5 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARMv7l

rustac-0.9.13-cp311-abi3-musllinux_1_2_aarch64.whl (34.6 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

rustac-0.9.13-cp311-abi3-manylinux_2_28_x86_64.whl (31.5 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ x86-64

rustac-0.9.13-cp311-abi3-manylinux_2_28_ppc64le.whl (34.8 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ppc64le

rustac-0.9.13-cp311-abi3-manylinux_2_28_armv7l.whl (26.8 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARMv7l

rustac-0.9.13-cp311-abi3-manylinux_2_28_aarch64.whl (28.1 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

rustac-0.9.13-cp311-abi3-macosx_11_0_arm64.whl (26.2 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

rustac-0.9.13-cp311-abi3-macosx_10_12_x86_64.whl (28.0 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file rustac-0.9.13.tar.gz.

File metadata

  • Download URL: rustac-0.9.13.tar.gz
  • Upload date:
  • Size: 765.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for rustac-0.9.13.tar.gz
Algorithm Hash digest
SHA256 d128b6d38f0d6af6f1c21c412442f575b86077325f95467556ff04cc483c5ba5
MD5 7af2de8370fb307cd9ccfe1d3d5ff3b1
BLAKE2b-256 d999894bd62a37299193d8c1959c94a6fdb55c19fbe2533baca4b9bc94531724

See more details on using hashes here.

File details

Details for the file rustac-0.9.13-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: rustac-0.9.13-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 26.5 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for rustac-0.9.13-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 31552bb5fdca5918257a23c1ce0ec41aa77ed94953e61f3deb3dc7774fcc2f7f
MD5 ab02c7e423d39de6e68e33882e702764
BLAKE2b-256 d241b692c79af43e8aa252ae3e278b359e1d84b58dcb5998631268cbfaac5cf7

See more details on using hashes here.

File details

Details for the file rustac-0.9.13-cp311-abi3-win32.whl.

File metadata

  • Download URL: rustac-0.9.13-cp311-abi3-win32.whl
  • Upload date:
  • Size: 23.8 MB
  • Tags: CPython 3.11+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for rustac-0.9.13-cp311-abi3-win32.whl
Algorithm Hash digest
SHA256 7387cdae671a7ce9ed6b3fcd9d21fb0e93e9cc72783102ac2c68de8a27852759
MD5 9ac8b0a16119ec897f5d5a094354f5e8
BLAKE2b-256 d9c61032099d9a398302188f6b8faef2c04ac158ff83a45dcc8c6969998a06f4

See more details on using hashes here.

File details

Details for the file rustac-0.9.13-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rustac-0.9.13-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c49693c5cba93305793fd8ec43c0b9c54d5f7b51f71572138e9a25245c6a6f4b
MD5 a9bfa17d0b146485621c0259101b2e9d
BLAKE2b-256 69ccc3eeb8521f63f98d50cc43ef8a3e9c0e25e16856ac6edf00dff38d5ea110

See more details on using hashes here.

File details

Details for the file rustac-0.9.13-cp311-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for rustac-0.9.13-cp311-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 3d1d4d4431175d680450c95dc40c0c2f8ce11228298c5448bc06e4e1062545a9
MD5 0721e9159a8e11d2fef62108553c281b
BLAKE2b-256 d2ac1b4e91232cc00956d90ae5b8e084d007b04f1abd36fa74ebe84bcdcca23b

See more details on using hashes here.

File details

Details for the file rustac-0.9.13-cp311-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for rustac-0.9.13-cp311-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 2ea22d712a3d4d5d615033c25db4963a79c035a8fdef4850c51b6baba3096bdc
MD5 43838e7176568dac63b1d35f99bc4bf4
BLAKE2b-256 9c0ee63b8d4bcaf8c2754aaf6819064a02609d20aece57ff9b462f087060b942

See more details on using hashes here.

File details

Details for the file rustac-0.9.13-cp311-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for rustac-0.9.13-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 b8aaf93dd7cd0c9f48c551605e0ebd4e4cd5d99c2e91b9675f768e3a496dcf9e
MD5 c4058035b5ac737e1ced7c0da8df984e
BLAKE2b-256 b8c397807b8bec13430dbc3dd6b752fdf39267f675f9059cb211499ad3fc7e48

See more details on using hashes here.

File details

Details for the file rustac-0.9.13-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rustac-0.9.13-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7805450072bd412d22c047ea54b19abe77649685139f362b5d3ed6db66dbe9e7
MD5 12f03b468b313b2b8d1e964568bdea3e
BLAKE2b-256 20ec8b3c4d3f6d8bbba19cc879f8e4d59327eca9aa39636d299cd3b7b593f2e6

See more details on using hashes here.

File details

Details for the file rustac-0.9.13-cp311-abi3-manylinux_2_28_ppc64le.whl.

File metadata

File hashes

Hashes for rustac-0.9.13-cp311-abi3-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 1a44cdc447ea8dd707a84378082db3c49dc9681953b52eb4773b4264e7ba0713
MD5 31b02baada4b96cd863b83d4375710c2
BLAKE2b-256 baaf53d608ef37aef7cee83c73178cb53f773aa2bd6e4cbc2a46ce47910a16d4

See more details on using hashes here.

File details

Details for the file rustac-0.9.13-cp311-abi3-manylinux_2_28_armv7l.whl.

File metadata

File hashes

Hashes for rustac-0.9.13-cp311-abi3-manylinux_2_28_armv7l.whl
Algorithm Hash digest
SHA256 cf9e83ed6bd36800725c546e960c11d73dc3d65db36b5d215ad1a019c3ebbe79
MD5 81ce0bc51adc9a4474ca0c74283d123d
BLAKE2b-256 ee9e358083bc7a09a6ec7925b24502cc764f4be90b7346c66c47869cb4404f50

See more details on using hashes here.

File details

Details for the file rustac-0.9.13-cp311-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for rustac-0.9.13-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0c2cd3b3ba411e6f82ab5a2e44f8f985f39d62f992ad39686f669406770f17fb
MD5 65bfd51a67fe82fef9feb6ccb040d60b
BLAKE2b-256 30b4776e5dc11330b586a2b66a31f7f12abf07e1f4c128cc20d90d6f83c76f31

See more details on using hashes here.

File details

Details for the file rustac-0.9.13-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustac-0.9.13-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bd9aefef756a24155bedd5cfcb666cba34ec999afae2d564046cd83b47f2bb6d
MD5 96a4a38f56dd80efcdc6ae0acb8ea972
BLAKE2b-256 5cf94883c881bc579cb1084970f795596d9765938aaa2c17d5d4204f58922b87

See more details on using hashes here.

File details

Details for the file rustac-0.9.13-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rustac-0.9.13-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7a0d2417b9cc2fcbb90357012e5d7a27a028a5b2a0d356f32729941b7f5d8438
MD5 33c6ece0c6f284e6e6a1b2efcc3862ad
BLAKE2b-256 ffe4f7c974aa3c8eefdc71999a3cd8ed946c72b09a1a110e01faab6ba3d561b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page