The power of Rust for the Python STAC ecosystem
Project description
rustac
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
- Read, write, and search stac-geoparquet
- Go to and from arrow tables, allowing easy interoperability with (e.g.) GeoPandas
async
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rustac-0.9.9.tar.gz.
File metadata
- Download URL: rustac-0.9.9.tar.gz
- Upload date:
- Size: 744.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
061062dbcfc085f093658dda2aa262955f5a1ca11c8f6a621863f048e6830272
|
|
| MD5 |
589e2381bff447b35c9703ec2e934df0
|
|
| BLAKE2b-256 |
ca730d88f8761848cf6c6e3411ae1a89569530677ad7d5de28e0c717e22123b8
|
File details
Details for the file rustac-0.9.9-cp311-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: rustac-0.9.9-cp311-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 36.9 MB
- Tags: CPython 3.11+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ce1ade12aa36acce7d8de268abdd2b5249b3fa08a9658413c54b522e9bcec61
|
|
| MD5 |
e026ce29e3df964d750838565e0d0b9b
|
|
| BLAKE2b-256 |
d845f32be7229683552e9fced5be885c79547b996f4efbc97ffc7cd5ea2df7c6
|
File details
Details for the file rustac-0.9.9-cp311-abi3-musllinux_1_2_i686.whl.
File metadata
- Download URL: rustac-0.9.9-cp311-abi3-musllinux_1_2_i686.whl
- Upload date:
- Size: 39.2 MB
- Tags: CPython 3.11+, musllinux: musl 1.2+ i686
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e66e9bd5b202a94c9559e228bcdd4f67f3acb92de7d9192776369d47c8466d3
|
|
| MD5 |
089993498943f215bcaf70dac828fb79
|
|
| BLAKE2b-256 |
6574950c9bfd1ac97cc912334256e3e1a77ebbd2fcbb5fb6f1f1368a42f65cb2
|
File details
Details for the file rustac-0.9.9-cp311-abi3-musllinux_1_2_armv7l.whl.
File metadata
- Download URL: rustac-0.9.9-cp311-abi3-musllinux_1_2_armv7l.whl
- Upload date:
- Size: 34.2 MB
- Tags: CPython 3.11+, musllinux: musl 1.2+ ARMv7l
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7e5951ff56c636c2b2d7a859bc29e452c8c76a73767f190baf1f2075880e673
|
|
| MD5 |
9e8899f22325d9cf4bf367e4d69f0971
|
|
| BLAKE2b-256 |
2218ada97c97564b9a499fc4774f55dc35e985e7fe595277d53a2a02dcd0af2c
|
File details
Details for the file rustac-0.9.9-cp311-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: rustac-0.9.9-cp311-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 34.3 MB
- Tags: CPython 3.11+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b57645affe5f1d50cc9d8c009b424883546def377228b40c1c099cdcc7c9045
|
|
| MD5 |
703c00d3b35c1895ebcc0a172eb5656f
|
|
| BLAKE2b-256 |
a0b8ed85a38fd62d70f8747f6b33429b7f1aee5c0b45f7b53bd3c60866a2bf0e
|
File details
Details for the file rustac-0.9.9-cp311-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: rustac-0.9.9-cp311-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 31.1 MB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91b6b5a0b97adb906bf558faf41beec6a58d5d96e600e668ab9950187cead6d3
|
|
| MD5 |
8f907b780ec93e8122e512734c80598e
|
|
| BLAKE2b-256 |
8e1d9410eb407a6e5d9eab512afb7644c848a414a08e46d6235a5d8b01cc4ad9
|
File details
Details for the file rustac-0.9.9-cp311-abi3-manylinux_2_28_ppc64le.whl.
File metadata
- Download URL: rustac-0.9.9-cp311-abi3-manylinux_2_28_ppc64le.whl
- Upload date:
- Size: 34.4 MB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ ppc64le
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a44843f2d5862b358727ab3bd14c167a9c0bc4a7f82b54816b7c74029b5fcf4
|
|
| MD5 |
951bf866d706f9970f9da01a49bd812f
|
|
| BLAKE2b-256 |
69da9af7fa4116954365cdda1947530916ffbbf822a767e34711fd4cc5afdf33
|
File details
Details for the file rustac-0.9.9-cp311-abi3-manylinux_2_28_armv7l.whl.
File metadata
- Download URL: rustac-0.9.9-cp311-abi3-manylinux_2_28_armv7l.whl
- Upload date:
- Size: 26.5 MB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ ARMv7l
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c40de5c59d1a8b7dd1c82805ce55353e72df6e8f8c7db7c3d99c73326f24479d
|
|
| MD5 |
dfd1dc7faef30884c0bb4f073632b298
|
|
| BLAKE2b-256 |
15b23d4951651cc2d3877d2dcea9a7e3ab1246985a4f5e2edd7a7c6b374742ec
|
File details
Details for the file rustac-0.9.9-cp311-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: rustac-0.9.9-cp311-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 27.7 MB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e3cf317b6a5db00bea813ccdf6a5aee985a59ece840ae981252cbff6445f987
|
|
| MD5 |
3eaeadf50a4a089d0c0905603a4f723e
|
|
| BLAKE2b-256 |
c02d9ef71c0af8c717f14cf237c995295a292c0d032d46352fcfd8965c6a15df
|
File details
Details for the file rustac-0.9.9-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: rustac-0.9.9-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 26.0 MB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c41672d88f3fd4acc51672aa0358013c846c00fa0c32de331c0807b671ee75d9
|
|
| MD5 |
c9ccc887e30b19c80b3a3174da6774f4
|
|
| BLAKE2b-256 |
36ede1d697729094c77133408e8ddc89fb0bb0d03f5986de24d654245090e593
|
File details
Details for the file rustac-0.9.9-cp311-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: rustac-0.9.9-cp311-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 27.8 MB
- Tags: CPython 3.11+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7acc53a0c855ec7ad7d7ced225e54ce669775d53fc22b0d3367b7b86d4afdfc6
|
|
| MD5 |
a152ea23098d4537043e83d60dfcbe32
|
|
| BLAKE2b-256 |
ca144fd3d5974a9bff03e782d918eb9bff413f7878a45f610a4a94e81940b247
|