bouquet-bloom (Python bindings)
Python bindings for bouquet —
pluggable Bloom filters with a Rust core.
Install bouquet-bloom for
CPython 3.11 or later, then import it as bouquet.
python -m pip install bouquet-bloom
import bouquet
f = bouquet.ClassicalFilter.from_false_pos(0.001, 100_000, seed=0xfeedface)
f.insert("hello") # str is fine — encoded as UTF-8 before hashing
assert "hello" in f
assert b"hello" in f # bytes work too; str + equivalent bytes hash the same
# Concurrent inserts: GIL is released during the bulk loop.
g = bouquet.AtomicFilter.from_false_pos(0.001, 1_000_000)
items = [str(i) for i in range(1_000_000)]
duplicates = g.insert_many(items) # parallelizable across Python threads
Building from source
Any Python 3.11+ works; one ABI3 wheel serves all of them.
cd bouquet-py
uv sync # locked dev environment + builds the cdylib
uv run --no-sync pytest # runs the test suite
--no-sync matters after a Rust change: a bare uv run re-syncs the project
and can reinstall a cached wheel over the extension you just built. The
reliable loop is:
uv run --no-sync maturin develop --release
uv run --no-sync pytest
uv sync invokes maturin transparently because of the build-system = { build-backend = "maturin" } section in pyproject.toml. After a Rust
source change, force a rebuild + reinstall:
uv sync --reinstall-package bouquet-bloom
For wheel builds (CI uses this):
uv run maturin build --release
ls ../target/wheels/ # bouquet_bloom-*.whl, one ABI3 wheel per OS/arch
What's exposed
| Python class | Rust backend | Notes |
|---|---|---|
ClassicalFilter |
bouquet::Classical |
Single-threaded. The general-purpose default. |
AtomicFilter |
bouquet::Atomic |
Concurrent; insert_many and contains_many release the GIL. |
BlockedFilter |
bouquet::Blocked |
Cache-line-blocked layout. Trades accuracy for locality — see the root README. |
Every class has the same methods: the from_false_pos and from_num_bits
constructors, insert, contains, __contains__, insert_many,
contains_many, clear, estimate_count, is_saturated, to_bytes,
from_bytes, num_bits, and num_hashes.
Batch calls
insert_many and contains_many take a list or tuple and make one call
into Rust instead of one per item. On 100,000 short strings that measured
about 30% faster than a Python loop over insert or contains.
f = bouquet.ClassicalFilter.from_false_pos(0.001, 100_000)
duplicates = f.insert_many(["a", "b", "c"]) # count already present
hits = f.contains_many(["a", "z"]) # [True, False]
On AtomicFilter both release the GIL while they run. They take a real
sequence, not a generator, and reject a bare str or bytes instead of
iterating it character by character.
Saving and loading
blob = f.to_bytes()
g = bouquet.ClassicalFilter.from_bytes(blob)
assert "a" in g
The bytes include the filter's hash key, because the key is needed to query it after loading. Anyone who can read them can test membership and craft colliding inputs, so store them as carefully as the data the filter describes, and only load bytes you trust.
ClassicalFilter and AtomicFilter share a bit layout and can load each
other's bytes. BlockedFilter uses a different layout; loading across that
boundary raises ValueError rather than returning a filter that answers
wrongly. The format carries a version byte, and a future release that
changes it will reject old bytes instead of misreading them.
ClassicalFilter and BlockedFilter wrap !Sync Rust types and are pinned
to the thread that created them — passing one to another thread raises rather
than racing. AtomicFilter is the one built for sharing.
SimdBlocked is intentionally not exposed yet — see
ROADMAP.md for
the open redesign.
Hashing model
Methods accept bytes / bytearray / memoryview or str. Strings are
encoded as UTF-8 before hashing, so f.insert("hello") and f.insert(b"hello")
produce identical filter state — pass whichever is more natural at the call
site.
For richer Python objects, serialize to bytes yourself before calling. This
keeps the hash domain explicit instead of hidden behind __hash__, and
avoids the cross-process instability that PYTHONHASHSEED randomization
would otherwise introduce.
License
MIT — see LICENSE.
Metadata
Release files for bouquet-bloom 0.2.0
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 |
|---|---|---|---|---|
| bouquet_bloom-0.2.0.tar.gz | 82.6 kB | With provenance | Details for bouquet_bloom-0.2.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| bouquet_bloom-0.2.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details for bouquet_bloom-0.2.0-cp311-abi3-win_amd64.whl |
| bouquet_bloom-0.2.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ x86-64 | Details for bouquet_bloom-0.2.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| bouquet_bloom-0.2.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ ARM64 | Details for bouquet_bloom-0.2.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| bouquet_bloom-0.2.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for bouquet_bloom-0.2.0-cp311-abi3-macosx_11_0_arm64.whl |
| bouquet_bloom-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details for bouquet_bloom-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl |
Total release size: 1.3 MB
Release files / bouquet_bloom-0.2.0.tar.gz
| Download URL | bouquet_bloom-0.2.0.tar.gz |
|---|---|
| Size | 82.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eba2284810e96f8f1e2e32d4df43c3453881e9be6a6a04c197e5d487cab758f3
|
|
BLAKE2b-256 checksum How to use checksums |
0f6b86dce4eb2cde735b7aad65d0bac3fb9b92675ec0816caa4af2a65bfc9e95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logRelease files / bouquet_bloom-0.2.0-cp311-abi3-win_amd64.whl
| Download URL | bouquet_bloom-0.2.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 184.5 kB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7415f62a9f2b4219884408237ce5c236a8fe579417ba0b49f7b279be2e899101
|
|
BLAKE2b-256 checksum How to use checksums |
97d501664bf884af37a3a17f50674d4ee957f9cff67f0ad927408d535c81a0ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logRelease files / bouquet_bloom-0.2.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | bouquet_bloom-0.2.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 268.0 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b2560012d87a0c7f2d5ef9ace5513c515af3d865023885e0c9bbc6fe356c657d
|
|
BLAKE2b-256 checksum How to use checksums |
ea84bde35da3bf0acd741051f26baa92625ab02281bb9d5c3f46db8c7ce6c012
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logRelease files / bouquet_bloom-0.2.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | bouquet_bloom-0.2.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 263.2 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
63687fd7a36b1b5c1af5ab29221aa637a29f3bc3d377cac6824a81021eb1a5d9
|
|
BLAKE2b-256 checksum How to use checksums |
34b40b1a878f460bc4cafd7bf843c0579a33f5e88aa0558932731227cde47506
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logRelease files / bouquet_bloom-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | bouquet_bloom-0.2.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 248.9 kB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
150f9ca8fa074ef5b1d1e93afa5db753face0677107afda6f300cc602dd57596
|
|
BLAKE2b-256 checksum How to use checksums |
51200e31ef5c219569b32538a3488a48c0eb9e1f88d18b418137efb97b982e09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logRelease files / bouquet_bloom-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | bouquet_bloom-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 252.1 kB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
141b483407f511c4e8168ec207740cca063f1b4d9437bd194a4bf7afa43091a5
|
|
BLAKE2b-256 checksum How to use checksums |
6cc2c64954e204ad705887d8917e1416ae8bd02fcb31454ea61bdd15cdde5f08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logSecurity for bouquet-bloom 0.2.0
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.
Full provenance
All 6 files in this release have been uploaded with provenance metadata.
Attestation for bouquet_bloom-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logA 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.