Skip to content

faruken/ubloom-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Writing a Python library in Rust

This is a very simple bloom filter Python library written in Rust. Purpose of this library is to demonstrate extending Python with Rust.

Installation

  1. Clone the repo
  2. Install Rust and switch to Rust nightly ($ rustup default nightly)
  3. Create a new virtualenv. ($ python3.8 -m venv .virtualenvs/ubloom-filter)
  4. Compile the Rust code ($ cargo build --release)
  5. Run setup.py ($ python setup.py install)

Usage

Sample code:

import ubloom_filter


def main():
    bloom = ubloom_filter.ubloom.BloomFilter(10_000, 0.02)
    bloom.insert("hello")
    bloom.insert("world")
    print(bloom.has("hello"))
    print(bloom.has("world"))
    print(bloom.has("NickiMinaj"))

if __name__ == '__main__':
    main()

About

Bloom filter library for Python written in Rust.

Topics

Resources

License

Stars

Watchers

Forks