rpds-py
rpds-py provides Python bindings to Rust's persistent data structures (rpds), offering immutable collections with efficient structural sharing. The current version is 0.30.0, released on March 28, 2026. The library has a regular release cadence, with multiple updates per year.
Warnings
- breaking rpds-py requires Python 3.10 or higher.
- gotcha rpds-py collections are immutable; modifying them returns a new instance.
Install
-
pip install rpds-py
Imports
- HashTrieMap
from rpds import HashTrieMap
- HashTrieSet
from rpds import HashTrieSet
Quickstart
from rpds import HashTrieMap
# Create an empty HashTrieMap
map = HashTrieMap()
# Insert a key-value pair
map = map.set('key', 'value')
# Retrieve a value
value = map.get('key')
print(value) # Output: 'value'