Skip to main content

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.

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.17.tar.gz (460.1 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.17-cp311-abi3-win_amd64.whl (27.5 MB view details)

Uploaded CPython 3.11+Windows x86-64

rustac-0.9.17-cp311-abi3-win32.whl (24.6 MB view details)

Uploaded CPython 3.11+Windows x86

rustac-0.9.17-cp311-abi3-musllinux_1_2_x86_64.whl (38.2 MB view details)

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

rustac-0.9.17-cp311-abi3-musllinux_1_2_i686.whl (40.5 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ i686

rustac-0.9.17-cp311-abi3-musllinux_1_2_armv7l.whl (35.4 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARMv7l

rustac-0.9.17-cp311-abi3-musllinux_1_2_aarch64.whl (35.4 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

rustac-0.9.17-cp311-abi3-manylinux_2_28_x86_64.whl (32.4 MB view details)

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

rustac-0.9.17-cp311-abi3-manylinux_2_28_ppc64le.whl (35.8 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ppc64le

rustac-0.9.17-cp311-abi3-manylinux_2_28_armv7l.whl (27.7 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARMv7l

rustac-0.9.17-cp311-abi3-manylinux_2_28_aarch64.whl (28.9 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

rustac-0.9.17-cp311-abi3-macosx_11_0_arm64.whl (27.1 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

rustac-0.9.17-cp311-abi3-macosx_10_12_x86_64.whl (28.9 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for rustac-0.9.17.tar.gz
Algorithm Hash digest
SHA256 fd65e922e52f277d38f500f3e43fb7c76ea7ffb5d1209bc29a74a5c4754caf4d
MD5 b7611e3fcc0fd2dfd5481e341478ebf2
BLAKE2b-256 9600dfd09a5eb0681af8ed8136d52eb6056def889df33ef1db530419d0d33e1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rustac-0.9.17-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 27.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.17-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 499599ff2f6f54fac5dbc025b98e764a04588e9b153baae2affc1cd68ec0cb30
MD5 0c90e40094137f2bb32fd0ea282fdb16
BLAKE2b-256 754b020856cd4f2ce85cc7077f5e84805f50307094196def58be6b462a440a63

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rustac-0.9.17-cp311-abi3-win32.whl
  • Upload date:
  • Size: 24.6 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.17-cp311-abi3-win32.whl
Algorithm Hash digest
SHA256 0eccaedcdf133c6318f8b8ab7e4af63184a9a8369b6259e8529119c3e6043c1c
MD5 d26b7078b364a27f55e626aa5739f1b9
BLAKE2b-256 d7f67080228e61fc85efdf60c4753ddde267afe2947080359e37a4a6075ab2aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.17-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 bd60f7551100eef0ddf3d6f138a2f1049c757ecd375a88001846e7d1e76644b2
MD5 52f89942b832385ff4b35d0b438e258b
BLAKE2b-256 65c02ae4c215202c2941ba7c40da9027cf34f0569760dbe2d59f1225912e4352

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.17-cp311-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 57a687f2d80e2218d907cf5b17a34dd8663c9128fa8f6f3123fd61ed7d3f9475
MD5 c9d36a2f6ceff489c642e8950dbf6052
BLAKE2b-256 cc84cbec9a7a89413c5d181011ad5117dfdf728abd1011ec8ca82abb4edbaf45

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.17-cp311-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 c9cc83d9bc1380900b91f7a2841f21a22067acad3039c03b94574947f28dd680
MD5 37a549f4d8a0957b81c9c041a20291b6
BLAKE2b-256 417d2980696da86613b8fe65a0c8505dca2a3e99ef27e23fcd304705d1e63a16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.17-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 72fa6c9096a1850c5e07f546954e345f7d5a79aa39386e5dd7563c32405af8df
MD5 53d39d53fd14ace67e1e8f90a47ec61c
BLAKE2b-256 4e74fd4c252d52f3ba0e5e1beb2f9dd5665cd4c1903ff5c072c9e3ef126df5b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.17-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d4846bda2f150e73e3600c8a19ff9d013b11714aaf90fd3494eb4429bf6928a7
MD5 1e033c01b42f26da1a8e5683b9ed46de
BLAKE2b-256 8044799f69cfc09deca638fd08a3f58cb4405a6b9b76f3add121908b66f31325

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.17-cp311-abi3-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 8ca0627cf58da1ba0be43b5be70a66abeea1172212d8062969f0d03a9aba95a4
MD5 fb26e4cb00698896d22008e8666bc894
BLAKE2b-256 d1df2941858d190d4a8fa63fad9a67e3d627bfb88716d79dea310af94af3c4e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.17-cp311-abi3-manylinux_2_28_armv7l.whl
Algorithm Hash digest
SHA256 cb4de4fe181b78bd9aa2834a6bd6460fc01c1fc800b0c681a87fb357004511e7
MD5 95fbdbcdd2c240ce10b4997aa14690ef
BLAKE2b-256 99b2a09273d5d3a27377ef11153e98b1713647a381eacfd70124f80303ed7055

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.17-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f14ed91cd7c2a879d97bea589bd5a69768075bd80d69a348bd4e0ed8deed55f0
MD5 c286c46f7fc757a392d723f0104e293d
BLAKE2b-256 5ec0bd29ef33f5bb95bb9e442d4745d8cb89e0a0739a219f9f556d9ddce87484

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.17-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3bda15586db94be086bf492ddec17c5c1bac3dc5fd603076edea6c8ae4436332
MD5 a1068aa56ff8c5e57e99c8e689969d84
BLAKE2b-256 de86cae59c7628b2d6a0caa400280815054d3b4264d6b9602234dd056129280e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.17-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f3e1885d44497bc553405343a69ac21cb9371311dae1ae63349a520d006d5e25
MD5 54c29ab9f536387bc64d15d62871da5c
BLAKE2b-256 80767eaa45d16c8b17d520a665bc80566288dcb57ca5dc848bd168378f8d2d75

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 Sentry Error logging StatusPage Status page