Skip to main content

Probabilistic data structures for processing and searching very large datasets

Project description

https://static.pepy.tech/badge/datasketch/month https://zenodo.org/badge/DOI/10.5281/zenodo.598238.svg https://codecov.io/gh/ekzhu/datasketch/branch/master/graph/badge.svg

datasketch gives you probabilistic data structures that can process and search very large amount of data super fast, with little loss of accuracy.

This package contains the following data sketches:

Data Sketch

Usage

MinHash

estimate Jaccard similarity and cardinality

Weighted MinHash

estimate weighted Jaccard similarity

HyperLogLog

estimate cardinality

HyperLogLog++

estimate cardinality

The following indexes for data sketches are provided to support sub-linear query time:

Index

For Data Sketch

Supported Query Type

MinHash LSH

MinHash, Weighted MinHash

Jaccard Threshold

LSHBloom

MinHash, Weighted MinHash

Jaccard Threshold

MinHash LSH Forest

MinHash, Weighted MinHash

Jaccard Top-K

MinHash LSH Ensemble

MinHash

Containment Threshold

HNSW

Any

Custom Metric Top-K

datasketch must be used with Python 3.9 or above, NumPy 1.11 or above, and Scipy.

Note that MinHash LSH and MinHash LSH Ensemble also support Redis and Cassandra storage layer (see MinHash LSH at Scale).

Install

To install datasketch using pip:

pip install datasketch

This will also install NumPy as dependency.

To install with Redis dependency:

pip install datasketch[redis]

To install with Cassandra dependency:

pip install datasketch[cassandra]

To install with Bloom filter dependency:

pip install datasketch[bloom]

Contributing

We welcome contributions from everyone. Whether you’re fixing bugs, adding features, improving documentation, or helping with tests, your contributions are valuable.

Development Setup

The project uses uv for fast and reliable Python package management. Follow these steps to set up your development environment:

  1. Install uv: Follow the official installation guide at https://docs.astral.sh/uv/getting-started/installation/

  2. Clone the repository:

    git clone https://github.com/ekzhu/datasketch.git
    cd datasketch
  3. Set up the environment:

    # Create a virtual environment
    # (Optional: specify Python version with --python 3.x)
    uv venv
    # Activate the virtual environment (optional, uv run commands work without it)
    source .venv/bin/activate
    
    # Install all dependencies
    uv sync
  4. Verify installation:

    # Run tests to ensure everything works
    uv run pytest
  5. Optional dependencies (for specific development needs):

    # For testing
    uv sync --extra test
    
    # For Cassandra support
    uv sync --extra cassandra
    
    # For Redis support
    uv sync --extra redis
    
    # For all extras
    uv sync --all-extras

Learn more about uv at https://docs.astral.sh/uv/

Development Workflow

  1. Fork the repository on GitHub if you haven’t already.

  2. Create a feature branch for your changes:

    git checkout -b feature/your-feature-name
    # Or for bug fixes:
    git checkout -b fix/issue-description
  3. Make your changes following the project’s coding standards.

  4. Run the tests to ensure nothing is broken:

    uv run pytest
  5. Check code quality with ruff:

    # Check for issues
    uvx ruff check .
    
    # Auto-fix formatting issues
    uvx ruff format .
  6. Commit your changes with a clear, descriptive commit message:

    git commit -m "Add feature: brief description of what was changed"
  7. Push to your fork and create a pull request on GitHub:

    git push origin your-branch-name
  8. Respond to feedback from maintainers and iterate on your changes.

Guidelines

  • Follow PEP 8 style guidelines

  • Write tests for new features

  • Update documentation as needed

  • Keep commits focused and atomic

  • Be respectful in discussions

For more information, check the GitHub issues for current priorities or areas needing help. You can also join the discussion on project roadmap and priorities.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

datasketch-1.10.0.tar.gz (91.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datasketch-1.10.0-py3-none-any.whl (99.9 kB view details)

Uploaded Python 3

File details

Details for the file datasketch-1.10.0.tar.gz.

File metadata

  • Download URL: datasketch-1.10.0.tar.gz
  • Upload date:
  • Size: 91.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for datasketch-1.10.0.tar.gz
Algorithm Hash digest
SHA256 d23aea80ce4c40790ca7a40795659848be92ecc43db80942be26f21e81d24714
MD5 b47671f7c6b440bbf95737c97d5c1b17
BLAKE2b-256 8d738e9014887f9fca2d785777a0a6186813e4fc7faa24f05fc88c6420624891

See more details on using hashes here.

Provenance

The following attestation bundles were made for datasketch-1.10.0.tar.gz:

Publisher: pypi.yml on ekzhu/datasketch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file datasketch-1.10.0-py3-none-any.whl.

File metadata

  • Download URL: datasketch-1.10.0-py3-none-any.whl
  • Upload date:
  • Size: 99.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for datasketch-1.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 303dd90cda0948a21abba3aaefc9f8528fa12b8204edc5e1ae8b1d7b750234e7
MD5 d19e29cb6786662784313d09ced7744f
BLAKE2b-256 ede7a94668082e078099eb0161635649510aa887690767b779fffe4bdc479913

See more details on using hashes here.

Provenance

The following attestation bundles were made for datasketch-1.10.0-py3-none-any.whl:

Publisher: pypi.yml on ekzhu/datasketch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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