GithubHelp home page GithubHelp logo

masroore / pybloomer Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 2.24 MB

Fast Python Bloom Filter using memory-mapped files

Home Page: https://pybloomer.readthedocs.io

License: MIT License

Python 17.62% C 68.23% Makefile 0.35% Cython 13.80%
bloom-filter bloom-filters bloomfilter bloomfilter-python python python3

pybloomer's Introduction

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?

This module implements a Bloom filter in Cython (ANSI C) that's fast and uses memory-mapped files for better scalability.

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.

Installation

To install pybloomer, use the Python 3 version of pip:

    $ pip install pybloomer

Quickstart

Here’s a quick example:

>>> import pybloomer
>>> fruits = pybloomer.BloomFilter(capacity=10000000, error_rate=0.01, filename='/tmp/fruits.bloom')
>>> fruits.update(('apple', 'pear', 'orange', 'apple'))
>>> len(fruits)
3
>>> 'mike' in fruits
False
>>> 'orange' in fruits
True

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

cake_ingredients = pybloomer.BloomFilter(capacity=1000, error_rate=0.1)

Caveat: in-memory filters cannot be persisted to disk.

Documentation

Current docs are available at pybloomer.rtfd.io.

Contributions and development

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

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.

pybloomer's People

Watchers

 avatar  avatar

Forkers

niharikasingh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.