Skip to content

Repository files navigation

fast-ordset

Ordered set for Python implemented in Rust (PyO3 + indexmap).

Features

Same with the original set + pop(index: int) and remove(item)

other in set operations can be an OrderedSet or any iterable.

Build and install

uv sync --all-extras
uv run maturin develop --release

Usage

fromfast_ordsetimportOrderedSets=OrderedSet()
s.add(1)
s.add(2)
s.add(1)
assertlen(s) ==2assert1insasserts[0] ==1asserts[-1] ==2assertlist(s) == [1, 2]
s.update([3, 2, 4])
s.remove(2)
x=s.pop() # 4 (last inserted)

Free-threaded Python (no-GIL)

The extension is built to be thread-safe and declares that it does not rely on the GIL. You can use it with a free-threaded (no-GIL) Python build so that the interpreter does not re-enable the GIL when this module is imported.

Tests

./scripts/debug.sh

Documentation

  • Scripts — build, test, and benchmark scripts
  • Benchmarks — performance and memory benchmarks
  • Development — setup, build, and contribution

License

MIT

About

Ordered set for Python implemented in Rust

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages