rBloom is a highly optimized Bloom filter library for Python, implemented in Rust. It provides a fast, simple, and lightweight probabilistic data structure that closely mimics the Python built-in `set` API. Currently at version 1.5.4, it's designed for high-performance set membership testing with low memory footprint, and it sees regular updates, often driven by underlying PyO3 version enhancements.
pip install rbloomVerified import paths — ran on the pinned version, not inferred.
Initializes a Bloom filter with a specified capacity and false positive rate, demonstrates adding single and multiple elements, checking for membership, and performing a set-like union operation.
Provide a custom, deterministic hash function (e.g., using `hashlib`) when initializing the `Bloom` filter if you intend to serialize it or use it across multiple Python processes. Ensure the same hash function object is used for both saving and loading.
Ensure all `Bloom` filters involved in set operations or comparisons are initialized with the same arguments (capacity, error_rate, and hash_func).
Install the Rust toolchain (Rustup recommended) and `maturin` (`pip install maturin`) if you need to build `rbloom` from source. Ensure your Rust toolchain is up-to-date.
Ensure that all objects added to the `Bloom` filter are hashable (e.g., strings, numbers, tuples, immutable custom objects). Convert mutable objects to an immutable representation if necessary before adding them.
When creating the `Bloom` filter, provide a custom, deterministic hash function (e.g., using `hashlib.sha256` and serializing the object to bytes before hashing) to ensure consistent hashes for persistence and cross-process usage. Example: `bf = Bloom(capacity, error_rate, hash_func=my_stable_hash_function)`.
Verify `rbloom` is installed with `pip show rbloom`. If not, run `pip install rbloom`. If issues persist, check your Python environment (virtual environment) or try reinstalling in a clean environment.
No dependency data recorded yet.