Rust-native Python package that targets the low-level eccodes import surface
for modern GRIB workflows.
Current benchmark and handoff state for follow-on work lives in AGENT_CONTEXT.md.
The latest Windows HRRR benchmark there shows ecrust ahead of ecCodes on both
the single-file end-to-end values path and the 4-copy multi-file run.
GitHub CI for release verification now lives in .github/workflows/ci.yml.
Goal:
- replace
import eccodeswithimport ecrust - keep the common
codes_*handle/get/release flow unchanged - avoid a native ecCodes C-library dependency
For the supported GRIB workflows, ecrust is a pure-Rust path and does not
require linking against the ecCodes C library.
Current implemented surface:
codes_grib_new_from_filecodes_new_from_filecodes_any_new_from_filecodes_count_in_filecodes_get,codes_get_long,codes_get_double,codes_get_stringcodes_get_array,codes_get_double_array,codes_get_long_arraycodes_get_valuescodes_is_defined,codes_is_missingcodes_get_size,codes_get_offset,codes_get_message_offset,codes_get_message_sizecodes_get_native_typecodes_keys_iterator_*codes_skip_*codes_clone,codes_release
Performance note:
codes_get_valuesand native/double"values"array access now return read-only NumPy arrays backed by Rust-owned memory to avoid an extra copy on the hot path.codes_get_version_info()and the benchmark scripts now report allocator and target metadata so performance reruns are attributable to a concrete build variant.
Windows dev note:
- Local Python tests and benchmarks load
python\ecrust\_ecrust.cp313-win_amd64.pyd. Aftercargo build --release, copytarget\release\_ecrust.dllover that file before rerunning Python-side checks. - Plain Windows release builds now default to
mimallocbecause the system allocator was materially slower on the HRRR workload. Usecargo build --release --features system-allocatoronly for A/B comparison.
Linux / WSL dev note:
- For Linux validation, run benchmarks from the distro filesystem rather than
/mnt/c, and pass explicit--source/--copy-dirpaths to the benchmark scripts. - Non-Windows builds still default to the system allocator. Use
maturin develop --release --features mimallocorcargo build --release --features mimalloconly when comparing allocators. - On Ubuntu 24.04 WSL with Rust
1.94.1,maturin develop --releasehit a rustc warning-emission ICE.RUSTFLAGS="-Awarnings" maturin develop --releaseworked around it.
Verification note:
- The local parity suite now includes focused drop-in API coverage in
tests/test_dropin_surface.py, and the repository includes a Linux/Windows GitHub Actions workflow that builds the extension and runspytest -q. - The parity suite now also includes pinned official operational ECMWF, GFS,
and RRFS near-surface GRIB2 subsets, assembled from published
.idx/.indexsidecars via HTTP range requests so CI verifies real model data without downloading full upstream files.
Current scope:
- GRIB1 and GRIB2 decode
- modern GRIB metadata and value access
- GRIB2 mutation and write-back for common sample and real-world workflows:
codes_set_*,codes_get_message, andcodes_writenow repack common GRIB2 messages and patch original section metadata instead of only exposing shadow state through getters - expanded real-world parity coverage against the cfgrib sample corpus plus pinned official ECMWF/GFS/RRFS operational subsets, with broad modern GRIB message compatibility checks and mutation round-trip tests
- pure-Rust decode path, including JPEG2000 and CCSDS/AEC support through Rust crates
Current non-goals:
- BUFR, METAR, and GTS support
- full GRIB write/repack parity across every grid/packing/template combination
- the full long-tail of every historical
eccodesbinding function
Release checklist:
- Set the final GitHub repository URL in package metadata once the repo is online.
- Push the branch and confirm
.github/workflows/ci.ymlis green on Linux and Windows. - Configure trusted publishing for this repo on TestPyPI and PyPI, or provide the equivalent publish credentials expected by
.github/workflows/release.yml. - Run
.github/workflows/release.ymlwithpublish_to=testpypifor a dry-run package upload. - Verify
pip install ecrustfrom the published TestPyPI build on Windows and Linux. - Push a
vX.Y.Ztag that matches the package version to build Linuxx86_64manylinux wheels, Windowsx64wheels, and an sdist, upload them to the GitHub release, and publish to PyPI.
Known remaining GRIB gap:
- GRIB1 spectral-complex packing (
spherical_harmonics.grib) is still not implemented