Skip to main content

A fast implementation of Bloom filter for Python 3 built on mmap

Project description

pybloomfiltermmap3

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

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

Build Status Documentation Status PyPI PyPI PyPI

Why pybloomfiltermmap3?

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 pybloomfilter
    >>> fruit = pybloomfilter.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 = pybloomfilter.BloomFilter(10000, 0.1)

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

Docs

Current docs are available at pybloomfiltermmap3.rtfd.io.

Install

To install:

    $ pip install pybloomfiltermmap3

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 pybloomfiltermmap3 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 pybloomfilter.c file, which requires Cython module to be in your current environment.

Maintainers

License

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pybloomfiltermmap3py310-0.5.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (382.6 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pybloomfiltermmap3py310-0.5.5-cp310-cp310-macosx_13_0_x86_64.whl (85.6 kB view details)

Uploaded CPython 3.10 macOS 13.0+ x86-64

File details

Details for the file pybloomfiltermmap3py310-0.5.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pybloomfiltermmap3py310-0.5.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ebc7e93be22cd5adc1be235dfda05608bc437612899aa45acfc9740372d8f95f
MD5 e9ea892f265472ce785be980c16b1b6b
BLAKE2b-256 5bdf8ec7ae3f89e6a924c815c244b778dc8b4762b451eb4161cb0bc5cfc6e607

See more details on using hashes here.

File details

Details for the file pybloomfiltermmap3py310-0.5.5-cp310-cp310-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pybloomfiltermmap3py310-0.5.5-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 11f450a0cb7a617009220cbb771fb10deeeab07496a4de282563c50c2abb889f
MD5 455f051d78865880262f6eada8d9f3c0
BLAKE2b-256 27ead0643312d850acebbaae959627aaff9045b306cb0c8fed7f3370682485b8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page