rBloom
Ultralightweight, blazing fast, minimalistic bloom filter library for Python, implemented in Rust.
Usage
This library defines only one class, the signature of which should be thought of as:
class Bloom:
def __init__(self, size_in_bits):
...
def __contains__(self, object):
...
def add(self, object):
...
See examples.
The size in bits is equal to the theoretical maximum amount of objects that could be
contained in the filter. However, the filter should ideally be significantly larger
than this to reduce the likelihood of birthday collisions, which in practice result
in a false positive True returned by the __contains__ method. To decide on an ideal
size, calculate size_in_bits by dividing the maximum number of expected items by the
maximum acceptable likelihood of a false positive
(e.g. 200 items / 0.01 likelihood = 20000 bits).
Building
Use maturin to build this library. As of the time of writing, this can be performed with:
$ pip install maturin
$ maturin build --release
This will result in the creation of a wheel, which can be found in target/wheels.
Examples
Most primitive example:
from rbloom import Bloom
filter = Bloom(200)
assert "hello" not in filter
filter.add("hello")
assert "hello" in filter
Print the first 1000 squares as well as around 0.001 = 0.1% of the numbers in between:
from rbloom import Bloom
filter = Bloom(int(1000 / 0.001))
for i in range(1, 1001):
filter.add(i*i)
for i in range(1, 1000**2 + 1):
if i in filter:
print(i, end=" ")
Metadata
Release files for rbloom 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rbloom-0.1.2.tar.gz | 7.8 kB | Without provenance | Details for rbloom-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rbloom-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.34+ x86-64 | Details for rbloom-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl |
Total release size: 206.6 kB
Release files / rbloom-0.1.2.tar.gz
| Download URL | rbloom-0.1.2.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78aa84a482357a62f7db848ba4025ebed823b156e6b03a71731826057044c41a
|
|
BLAKE2b-256 checksum How to use checksums |
722626e129315865e0d4035b172b1253b1647d83c720ecedc1db2d173306626d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.8
|
Release files / rbloom-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl
| Download URL | rbloom-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 198.8 kB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
f25dafc40d9cc22acdf64f7eeef446f31fef13f5fb9a66dfc3b8f8fe32a4393f
|
|
BLAKE2b-256 checksum How to use checksums |
9b7f692fb2e1ec31ff7c118516741597a4ca796a7daa13e9e7086d3e1790a6da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.8
|
Security for rbloom 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.