This crate exposes an interval tree implementation written in Rust to Python via PyO3. The Python wrapper provides the ability to build a tree from tuples, insert additional intervals, search for overlaps, and delete intervals by their (left, right) key.
- Rust toolchain (for compiling the extension module)
- Python 3.8+
- maturin for building/installing the package
You can install the package with (also with uv)
maturin develop builds the extension module in-place and installs it into the active virtual environment, making it importable as intervaltree_rs.
Once installed, you can use the interval tree directly from Python:
IntervalTree.search(ql, qr, inclusive=True) accepts an inclusive flag. Set it to False to perform exclusive range queries.
To build a wheel that you can distribute or upload to PyPI, run:
The built wheels will be placed under target/wheels/.
The Python bindings are covered by Rust unit tests. Run them with:
.png)


