Rust-accelerated drop-in replacement for python-rasterstats
Project description
oxidized-rasterstats
Rust-accelerated, GDAL-backed implementation of rasterstats with drop-in Python API compatibility.
Status
- Import path compatibility:
from rasterstats import zonal_stats, point_query - Build/packaging flow:
maturin - Rust fast paths: zonal stats + point query
- Python fallback: upstream-compatible behavior preserved
- Non-overlap
nodatasemantics: matches upstreampython-rasterstatsboundless footprint behavior - Rust dispatch exceptions are logged before fallback so backend failures are visible in operations logs
Quick Start
python -m venv .venv
. .venv/bin/activate
pip install -U pip
pip install -e ".[test,perf]"
pip install maturin
python scripts/sync_upstream.py \
--repo /workdir/python-rasterstats \
--sha e51b48a62e3ac7e4ef4a81a8c2a8e5b90fa5e8ac
maturin develop --release
Dispatch Model
- Default mode enables Rust fast-path for eligible
zonal_statsandpoint_querycalls. - Set
OXRS_DISABLE_RUST=1to force Python fallback behavior. - Fast path auto-falls back to Python for unsupported dynamic cases.
Examples:
# Default mode (zonal fast path active when eligible)
PYTHONPATH=python python -c "from rasterstats import zonal_stats; print(callable(zonal_stats))"
# Force Python fallback for both APIs
PYTHONPATH=python OXRS_DISABLE_RUST=1 python -c "from rasterstats import point_query; print(point_query('POINT(245309 1000064)','tests/upstream/data/slope.tif')[0])"
# Explicit Rust-on flag is optional (kept for compatibility)
PYTHONPATH=python OXRS_ENABLE_RUST=1 python -c "from rasterstats import zonal_stats; print(zonal_stats('tests/upstream/data/polygons.shp','tests/upstream/data/slope.tif')[0])"
Build and Test Commands
# Parity + API compatibility
PYTHONPATH=python pytest tests/upstream tests/compat -q
# Rust unit tests
cargo test --all
# Regression denylist
PYTHONPATH=python pytest tests/regression -q
# Forced Python fallback sweep
PYTHONPATH=python OXRS_DISABLE_RUST=1 pytest tests/upstream tests/compat -q
# Performance suites
PYTHONPATH=python pytest tests/perf -q -m perf_small --benchmark-only --benchmark-min-rounds=5
PYTHONPATH=python pytest tests/perf -q -m perf_large --benchmark-only --benchmark-min-rounds=5
PyPI Release Workflow
- Tag a release commit with
v*(for examplev0.1.0) and push the tag. - GitHub workflow
.github/workflows/release-wheels.ymlbuilds:- Linux wheels for CPython 3.9-3.12
- source distribution (
sdist)
- Publish job uses PyPI Trusted Publishing with
environment: pypi.
Benchmark Snapshot (2026-02-16)
See benchmarks/results/2026-02-16.md.
- Small fixture (
vacant-better):- Zonal: Rust
290.9ms, baseline2264.8ms(7.78x) - Point query: Rust
144.2ms, baseline1829.9ms(12.69x)
- Zonal: Rust
- Large fixture (
copacetic-notelocal):- Zonal: Rust
2.655s, baseline27.969s(10.53x) - Point query: Rust
1.242s, baseline21.613s(17.41x)
- Zonal: Rust
Upstream Attribution
oxidized-rasterstats is built from and compatible with the upstream
python-rasterstats project by
Matthew Perry and contributors.
- Upstream project:
python-rasterstats(author: Matthew Perry /perrygeo) - Pinned upstream snapshot:
vendor/upstream_rasterstats/SHA.txt - Vendored upstream source/tests:
vendor/upstream_rasterstats/ - Imported parity fixtures/tests:
tests/upstream/ - Python compatibility copies based on upstream modules:
python/rasterstats/_upstream_main.py,python/rasterstats/_upstream_point.py,python/rasterstats/io.py,python/rasterstats/utils.py,python/rasterstats/cli.py
See docs/attribution.md for attribution and licensing details.
License
- Project license: BSD 3-Clause (
LICENSE) - Copyright and component-level ownership notes:
NOTICE.md - Upstream
python-rasterstatslicense snapshot:vendor/upstream_rasterstats/LICENSE.txt
Repository Layout
python/rasterstats/: compatibility package + dispatcher + upstream fallback copiessrc/: Rust core (zonal,point,raster,stats,errors,geom)tests/upstream/: imported upstream teststests/regression/: issue denylist coveragetests/perf/: benchmark harnessscripts/: upstream sync, fixture generation, API manifest toolingdocs/upstream_issues/: issue snapshotsvendor/upstream_rasterstats/: pinned upstream source/tests
Review Guide
Start with docs/review_guide.md for scope, command log, and file-level review map.
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 oxidized_rasterstats-0.1.1.tar.gz.
File metadata
- Download URL: oxidized_rasterstats-0.1.1.tar.gz
- Upload date:
- Size: 553.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
febe045eb1634ec058f04e9620fad5fe45beecd1d79e230153ff3e456b147fe2
|
|
| MD5 |
d99ada6a6a6d507af9710e75bbcf3170
|
|
| BLAKE2b-256 |
a705aad350ce4309b64b0d44dc46035fc2b2a6f6c1657d2aedad6f8acedb6e39
|
Provenance
The following attestation bundles were made for oxidized_rasterstats-0.1.1.tar.gz:
Publisher:
release-wheels.yml on rogerlew/oxidized-rasterstats
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oxidized_rasterstats-0.1.1.tar.gz -
Subject digest:
febe045eb1634ec058f04e9620fad5fe45beecd1d79e230153ff3e456b147fe2 - Sigstore transparency entry: 956146022
- Sigstore integration time:
-
Permalink:
rogerlew/oxidized-rasterstats@18f0ed4a46526375bddff4fbb24b5b0d762316a2 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/rogerlew
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-wheels.yml@18f0ed4a46526375bddff4fbb24b5b0d762316a2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file oxidized_rasterstats-0.1.1-cp312-cp312-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: oxidized_rasterstats-0.1.1-cp312-cp312-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 57.0 MB
- Tags: CPython 3.12, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbdf359c735d56dc6bcc1cae6477866030315c109dbf0152d196e0ff682fe2f1
|
|
| MD5 |
25888bccf1c85cbbb500153431576a73
|
|
| BLAKE2b-256 |
b920cee785a42b9382eb697fc0cee7336a9d43a050ec56ddd54adc1874ce0f6f
|
Provenance
The following attestation bundles were made for oxidized_rasterstats-0.1.1-cp312-cp312-manylinux_2_39_x86_64.whl:
Publisher:
release-wheels.yml on rogerlew/oxidized-rasterstats
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oxidized_rasterstats-0.1.1-cp312-cp312-manylinux_2_39_x86_64.whl -
Subject digest:
fbdf359c735d56dc6bcc1cae6477866030315c109dbf0152d196e0ff682fe2f1 - Sigstore transparency entry: 956146029
- Sigstore integration time:
-
Permalink:
rogerlew/oxidized-rasterstats@18f0ed4a46526375bddff4fbb24b5b0d762316a2 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/rogerlew
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-wheels.yml@18f0ed4a46526375bddff4fbb24b5b0d762316a2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file oxidized_rasterstats-0.1.1-cp311-cp311-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: oxidized_rasterstats-0.1.1-cp311-cp311-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 57.0 MB
- Tags: CPython 3.11, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6feebfb438e4891b8f0ce9d7a5ad317a3f391b7a52cacaf77c42eddb092dfea2
|
|
| MD5 |
dad5d0630c33962186d0134486455cc9
|
|
| BLAKE2b-256 |
c2d1a648a3d79d564f0e8ab0dcdbb4cff90e87955b6310213b7323b6b3ba66d9
|
Provenance
The following attestation bundles were made for oxidized_rasterstats-0.1.1-cp311-cp311-manylinux_2_39_x86_64.whl:
Publisher:
release-wheels.yml on rogerlew/oxidized-rasterstats
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oxidized_rasterstats-0.1.1-cp311-cp311-manylinux_2_39_x86_64.whl -
Subject digest:
6feebfb438e4891b8f0ce9d7a5ad317a3f391b7a52cacaf77c42eddb092dfea2 - Sigstore transparency entry: 956146025
- Sigstore integration time:
-
Permalink:
rogerlew/oxidized-rasterstats@18f0ed4a46526375bddff4fbb24b5b0d762316a2 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/rogerlew
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-wheels.yml@18f0ed4a46526375bddff4fbb24b5b0d762316a2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file oxidized_rasterstats-0.1.1-cp310-cp310-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: oxidized_rasterstats-0.1.1-cp310-cp310-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 57.0 MB
- Tags: CPython 3.10, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4db47b604f5ef3e8310c22b1ab6ac6ad879f39799fd6bea8791f9b019821d85e
|
|
| MD5 |
fee395e672d5314fbffbb1a5600a5eca
|
|
| BLAKE2b-256 |
39fd6c98d3c12acf771591cccd217b928549d7f2060d6051bd6170b1add66cc7
|
Provenance
The following attestation bundles were made for oxidized_rasterstats-0.1.1-cp310-cp310-manylinux_2_39_x86_64.whl:
Publisher:
release-wheels.yml on rogerlew/oxidized-rasterstats
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oxidized_rasterstats-0.1.1-cp310-cp310-manylinux_2_39_x86_64.whl -
Subject digest:
4db47b604f5ef3e8310c22b1ab6ac6ad879f39799fd6bea8791f9b019821d85e - Sigstore transparency entry: 956146026
- Sigstore integration time:
-
Permalink:
rogerlew/oxidized-rasterstats@18f0ed4a46526375bddff4fbb24b5b0d762316a2 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/rogerlew
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-wheels.yml@18f0ed4a46526375bddff4fbb24b5b0d762316a2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file oxidized_rasterstats-0.1.1-cp39-cp39-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: oxidized_rasterstats-0.1.1-cp39-cp39-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 57.0 MB
- Tags: CPython 3.9, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afb7b8aaab0357dbb6d13f35c21d7d48f2b0fa6e7698f6e2c8d277fcbe08fa60
|
|
| MD5 |
31ca564d7b077514c9baf8fd6916f489
|
|
| BLAKE2b-256 |
06f82474dd2a4ca880d03bc2c59c24e785417d600d502d18f6ef3706e7a19d62
|
Provenance
The following attestation bundles were made for oxidized_rasterstats-0.1.1-cp39-cp39-manylinux_2_39_x86_64.whl:
Publisher:
release-wheels.yml on rogerlew/oxidized-rasterstats
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oxidized_rasterstats-0.1.1-cp39-cp39-manylinux_2_39_x86_64.whl -
Subject digest:
afb7b8aaab0357dbb6d13f35c21d7d48f2b0fa6e7698f6e2c8d277fcbe08fa60 - Sigstore transparency entry: 956146023
- Sigstore integration time:
-
Permalink:
rogerlew/oxidized-rasterstats@18f0ed4a46526375bddff4fbb24b5b0d762316a2 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/rogerlew
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-wheels.yml@18f0ed4a46526375bddff4fbb24b5b0d762316a2 -
Trigger Event:
push
-
Statement type: