Skip to content

developmentseed/hydraters

Repository files navigation

hydraters

GitHub Actions Workflow Status PyPI - Version

Hydrate Python dictionaries with Rust. A general-purpose algorithm, used in pgstac to reduce the size of the items table.

import hydraters

base = {"a": "first", "b": "second", "c": {"d": "third"}}
item = {"c": {"e": "fourth", "f": "fifth"}}
result = hyrdraters.hydrate(base, item)
assert result == {
    "a": "first",
    "b": "second",
    "c": {"d": "third", "e": "fourth", "f": "fifth"},
}

Installation

python -m pip install hydraters

Or, if you're using uv:

uv add hydraters

Developing

Get Rust and uv. Then:

git clone git@github.com:developmentseed/hydraters.git
cd hydraters
uv sync
uv run pre-commit install

To run tests:

uv run pytest

Background

The code for this package was taken from pypgstac. It came from some benchmarking that determined it was much faster to do this operation in Rust than in pure Python.

License

MIT