Skip to main content

dm_pybloom
=======

.. image:: https://travis-ci.org/jaybaird/python-bloomfilter.svg?branch=master
:target: https://travis-ci.org/jaybaird/python-bloomfilter

``dm_pybloom`` is a module that includes a Bloom Filter data structure along with
an implmentation of Scalable Bloom Filters as discussed in:

P. Almeida, C.Baquero, N. Preguiça, D. Hutchison, Scalable Bloom Filters,
(GLOBECOM 2007), IEEE, 2007.

Bloom filters are great if you understand what amount of bits you need to set
aside early to store your entire set. Scalable Bloom Filters allow your bloom
filter bits to grow as a function of false positive probability and size.

A filter is "full" when at capacity: M * ((ln 2 ^ 2) / abs(ln p)), where M
is the number of bits and p is the false positive probability. When capacity
is reached a new filter is then created exponentially larger than the last
with a tighter probability of false positives and a larger number of hash
functions.

.. code-block:: python

>>> from dm_pybloom import BloomFilter
>>> f = BloomFilter(capacity=1000, error_rate=0.001)
>>> [f.add(x) for x in range(10)]
[False, False, False, False, False, False, False, False, False, False]
>>> all([(x in f) for x in range(10)])
True
>>> 10 in f
False
>>> 5 in f
True
>>> f = BloomFilter(capacity=1000, error_rate=0.001)
>>> for i in xrange(0, f.capacity):
... _ = f.add(i)
>>> (1.0 - (len(f) / float(f.capacity))) <= f.error_rate + 2e-18
True

>>> from dm_pybloom import ScalableBloomFilter
>>> sbf = ScalableBloomFilter(mode=ScalableBloomFilter.SMALL_SET_GROWTH)
>>> count = 10000
>>> for i in xrange(0, count):
... _ = sbf.add(i)
...
>>> (1.0 - (len(sbf) / float(count))) <= sbf.error_rate + 2e-18
True

# len(sbf) may not equal the entire input length. 0.01% error is well
# below the default 0.1% error threshold. As the capacity goes up, the
# error will approach 0.1%.


Metadata

Release files for dm-pybloom 3.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dm-pybloom 3.0.4
File Size Uploaded Provenance Actions
dm_pybloom-3.0.4.tar.gz 9.3 kB Without provenance Details for dm_pybloom-3.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dm-pybloom 3.0.4
File Interpreter ABI Platform Actions
dm_pybloom-3.0.4-py2.py3-none-any.whl Python 2, Python 3 none any Details for dm_pybloom-3.0.4-py2.py3-none-any.whl

Total release size: 20.0 kB

Release files / dm_pybloom-3.0.4.tar.gz

Download URL dm_pybloom-3.0.4.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a98fbd293158b3412696d9585044fb422330b51d6056ed87acdd46158ac15bdb
BLAKE2b-256 checksum
How to use checksums
6e272e1d03cc38f0cb89149a47702e97895d19ac4d29919c25526e7f7b26db12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / dm_pybloom-3.0.4-py2.py3-none-any.whl

Download URL dm_pybloom-3.0.4-py2.py3-none-any.whl
Size 10.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e9be7ca1d6b6e2bf37dff737b5765381da34431d6c376f4b1d089d0d83d84a92
BLAKE2b-256 checksum
How to use checksums
25650b7828b36aca661594c3765e37409c5d2ed9a523c5e8fbac055f99a73197
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for dm-pybloom 3.0.4

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page