Skip to main content

pybloomer

pybloomer is a Python 3 compatible fork of pybloomfiltermmap by @axiak.

The goal of pybloomer is simple: to provide a fast, simple, scalable, correct library for Bloom filters in Python.

Documentation Status PyPI PyPI PyPI

Why pybloomer?

There are a couple reasons to use this module:

  • It natively uses mmaped files.
  • It is fast (see benchmarks).
  • It natively does the set things you want a Bloom filter to do.

Quickstart

After you install, the interface to use is a cross between a file interface and an ste interface. As an example:

    >>> import pybloomer
    >>> fruit = pybloomer.BloomFilter(100000, 0.1, '/tmp/words.bloom')
    >>> fruit.update(('apple', 'pear', 'orange', 'apple'))
    >>> len(fruit)
    3
    >>> 'mike' in fruit
    False
    >>> 'apple' in fruit
    True

To create an in-memory filter, simply omit the file location:

    >>> cakes = pybloomer.BloomFilter(10000, 0.1)

Caveat: it is currently not possible to persist this filter later.

Docs

Current docs are available at pybloomer.rtfd.io.

Install

To install:

    $ pip install pybloomer

and you should be set.

Note to Python 2 to < 3.5 users

This library is specifically meant for Python 3.5 and above. As of 2020, we strongly advise you to switch to an actively maintained distribution of Python 3. If for any reason your current environment is restricted to Python 2, please see pybloomfiltermmap. Please note that the latter is not actively maintained and will lack bug fixes and new features.

History and Future

pybloomfiltermmap is an excellent Bloom filter implementation for Python 2 by @axiak and contributors. I, @prashnts, made initial changes to add support for Python 3 sometime in 2016 as the current pybloomer on PyPI. Since then, with the help of contributors, there have been incremental improvements and bug fixes while maintaining the API from versions 0.4.x and below.

Some new features and changes were first introduced in version 0.5.0. From this point on, the goal is to reach stability, as well as add a few more APIs to expand upon the use cases. While we can't guarantee that we won't change the current interface, the transition from versions 0.4.x and below should be quick one liners. Please open an issue if we broke your build!

Suggestions, bug reports, and / or patches are welcome!

Contributions and development

When contributing, you should set up an appropriate Python 3 environment and install the dependencies listed in requirements-dev.txt. Package installation depends on a generated pybloomer.c file, which requires Cython module to be in your current environment.

Maintainers

License

See the LICENSE file. It's under the MIT License.

Metadata

Release files for pybloomer 0.6.0

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

Source distribution (sdist)

Source distribution for pybloomer 0.6.0
File Size Uploaded
pybloomer-0.6.0.tar.gz 521.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pybloomer 0.6.0
File Interpreter ABI Platform
pybloomer-0.6.0-py3.11-win-amd64.egg Legacy Egg format - - Details
pybloomer-0.6.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details

Total release size: 651.8 kB

Release files / pybloomer-0.6.0.tar.gz

Download URL pybloomer-0.6.0.tar.gz
Size 521.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d3a988ae79342feeb59dedeaf62057f8e58cdd410fc07c39dd9030f2c0f6b131
BLAKE2b-256 checksum
How to use checksums
9cdf46c351e7b9ff029ff7c0768176cec016e501375d8870abf52d4b98dcf154
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / pybloomer-0.6.0-py3.11-win-amd64.egg

Download URL pybloomer-0.6.0-py3.11-win-amd64.egg
Size 56.7 kB
Tags Egg
SHA-256 checksum
How to use checksums
1e2ba04560d6133b7e19e0e890db5d15abbdbf25da52e9e7c8b8ae5bab7bbc2f
BLAKE2b-256 checksum
How to use checksums
da929f02095a334062cb2be521f3a23302f0b65ea79c1c2ebbbaaf2452cdc1ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / pybloomer-0.6.0-cp311-cp311-win_amd64.whl

Download URL pybloomer-0.6.0-cp311-cp311-win_amd64.whl
Size 73.5 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
2b543bb48ec2230749ccfb9200b98274ffb88bfee793af2dfec7f04b98810bd0
BLAKE2b-256 checksum
How to use checksums
d6168e3db45569863480ebea4034d2a09f922ff6888d1172cfb8c2b2b415cf70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.6.0 This release

3 release files

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