Skip to main content

The power of Rust for the Python STAC ecosystem

Reason this release was yanked:

Unable to import because of circular dependency

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.1.tar.gz (730.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.1-cp311-abi3-musllinux_1_2_x86_64.whl (35.2 MB view details)

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

rustac-0.9.1-cp311-abi3-musllinux_1_2_i686.whl (37.5 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ i686

rustac-0.9.1-cp311-abi3-musllinux_1_2_armv7l.whl (32.9 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARMv7l

rustac-0.9.1-cp311-abi3-musllinux_1_2_aarch64.whl (33.3 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

rustac-0.9.1-cp311-abi3-manylinux_2_28_x86_64.whl (29.7 MB view details)

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

rustac-0.9.1-cp311-abi3-manylinux_2_28_ppc64le.whl (33.2 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ppc64le

rustac-0.9.1-cp311-abi3-manylinux_2_28_armv7l.whl (25.5 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARMv7l

rustac-0.9.1-cp311-abi3-manylinux_2_28_aarch64.whl (26.8 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

rustac-0.9.1-cp311-abi3-macosx_11_0_arm64.whl (22.7 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

rustac-0.9.1-cp311-abi3-macosx_10_12_x86_64.whl (24.5 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for rustac-0.9.1.tar.gz
Algorithm Hash digest
SHA256 9b5b91c9cd0001915f641c3359cc57e9821da487a8fbcd346ef1ba402caba03b
MD5 7a495f658c30be37530d633a73ffdb5e
BLAKE2b-256 4e19e01a1ba65e3bab87eefd420f8d42e11673bd0c5c08a207061ce73dbdd01b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.1-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 47272063745ed195fe9fae698686bf1f32ca08042e8df6e1291c6c3eae9c5abf
MD5 6184921f6052f33917b420dbc1d5992a
BLAKE2b-256 26428184677c3f300ff015b0930224afe66f7689e6cc969ce7bed77ca0a601d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.1-cp311-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 2d171125828a7afae3e8ee41f91637164a56bc6b13a816fb7f5dd0b2f7ddffd5
MD5 79f43be96a6fc7aee3ffa656db0bf7d7
BLAKE2b-256 f38cf9f6630c699ef11b610667e403190e017f27c6c4eb0306a835d974cc8212

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.1-cp311-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 7a7d86cd30b3d7f3edb066f376337d658b213e5cbc4eb9fa3f6542d180cf8fd0
MD5 0059d8224aa8253fd983f62d3e0aa567
BLAKE2b-256 994699c00f35a5d60662f19ab53a142405f7c396bc402c2ddb2bf81ecbcedd53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.1-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 50ddcf9235a6c6821168fd3e52a60bb9945b68388179940d45d334286f865e2f
MD5 fe5d939043448fc311a9199977592f3f
BLAKE2b-256 95fd3016472ab9fa2482d0b8e58d1ff8fe3aa0b6098bec39a50bf4b9dfc35d8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.1-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cc5aba77c2ff720b4926e31b372c600876d6d1eefe206029978db7dc7b3177ae
MD5 5b7eac1be08ffcd57530941a9f1fe5fa
BLAKE2b-256 9061acbf60b1937bbde01d1acd335691cb581a6d58c406368e9a0100bca17512

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.1-cp311-abi3-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 e3671bd3262beea8d2fd8de61305b310d5c5efff8ef3b6a5bb41b64d52a3b906
MD5 af7f21697d6c26d812563335ad2aee45
BLAKE2b-256 a33cf0b9b8b88d95d6f0c3a41dd1b786198e84c5da3060219eadb153cf32b0d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.1-cp311-abi3-manylinux_2_28_armv7l.whl
Algorithm Hash digest
SHA256 b64264670916a90138e63106458e5af0de679d85826f8d3037308bf687cfe566
MD5 6019e9e7a583e0d6a5de2edd53327850
BLAKE2b-256 fa7ba2d861dec11d2129083e2293b6f91fbfe81c2c1c5604599dcfba7749d02c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.1-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 49ef6ac84e031297a2784edf6e7af12d2e086aabdaf5fc1f1067b15e2e39f2a8
MD5 d74c46e51e2fbd1a4bb5933f610ee033
BLAKE2b-256 366b361cfdc4f1aef2e7b3a829c8c9de40d6302ba48f97c2dd8d78610e86cad1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 82958a6be1fa2a0244ca6f6fd31a70f564218ad9fa6957e18ff0777910a14fb1
MD5 32137b108779c769b243c2ed3254d20e
BLAKE2b-256 be865d145ced72e39e87bcefd2b121c989df70435ef05248372a19ac8d0c68ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustac-0.9.1-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 851646144aadeb352dcf42b1ee4e2cd6f66288bac4907144f6934c3c81869d6c
MD5 26ce82653c4c54b801a5934d5f86245e
BLAKE2b-256 56a1b84dd4c41c17dbeacd314231f75e2a750a66caffa8a12b9b0babbb3f91d8

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