deduplicate_lib
deduplication algorithms in python
Key Features
- Easy to use deduplication algorithms for any vector array
- Suite of tolerance tuning algorithms to help you find the right tolerance value for your system
- Suite of benchmarking tools to ensure rigor, accuracy, and speed (not yet implemented)
- Factory Plugin architecture, for easy extensibility and modification
Implemented Algorithms
- Distance Matrix (Simple, accurate, expensive): Computes the distance matrix for all vectors and determines duplicates by finding those that fall below a given distance
- Multi Hashing (Fast): Smears and rounds the vectors using a normal distribution and computes the hashes for each which are then used to determine duplicates by proportion of hash clashes.
Quick Start
pip install deduplicate_lib
from deduplicate_lib.plugins.duplicate_detection_algorithms.multi_hashing import MultiHashing
import numpy as np
dataset = np.array([[1.0, 2.0], [1.01, 2.01], [5.0, 6.0]])
dda = MultiHashing(tolerance=0.1, dataset_array=dataset)
# return unique vectors
print(dda.deduplicate())
# check a single vector against the dataset
dda.input_vector = np.array([1.0, 2.0])
print(dda.duplicate_check()) # True
Large datasets
Datasets too large for memory can be deduplicated straight from disk (.npy, HDF5, or any
source via CallableStore), in chunks sized by memory_limit:
dda = MultiHashing(dataset="descriptors.npy", tolerance=0.05, memory_limit="8GB", n_threads=8)
dda.get_dataset_unique_structures()
mask = dda.get_unique_vector_mask() # boolean mask over the dataset
dda.deduplicate() # writes descriptors_unique.npy
Optional extras: pip install deduplicate_lib[hdf5,progress].
See the full documentation for API reference, tolerance tuning, and more examples.
Dependencies
- Python 3.10+
numpynumbascipy
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
# Clone the repository
git clone https://github.com/julianholland/deduplicate.git
cd deduplicate
# Create a virtual environment with the package and dev dependencies (needs uv)
uv sync
# Run tests
uv run pytest
# Run linting
uv run ruff check .
uv run ruff format .
Running Tests
# Run all tests
pytest
# Run specific test categories
pytest tests/core/
pytest tests/plugins/
pytest tests/plugins/duplicate_detection_algorithms/distance_matrix
# Run with coverage
pytest --cov
📝 Citation
If you use deduplicate_lib in your research, please cite:
@software{deduplicate2026,
title={deduplicate_lib: Auto Tolerance Finding Deduplication Algorithms in Python},
author={Julian Holland},
year={2026},
url={https://github.com/julianholland/deduplicate},
version={0.0.5}
}
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- The Fritz Haber Institute
- Juan Manuel Lombardi <3
- Maximillion Ach
- Chiara Panosetti
Project Links
Project To-Do
- Add example.ipynb
- Create general Pre-allocation protocal
- Add benchmarks for time and robustness
- Add Locality-Sensitive Hashing as an option
- Speedup slow tasks with Numba
- Set up Read the Docs
- Create general deduplicate function
- Speed up NTPP
Metadata
Release files for deduplicate_lib 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| deduplicate_lib-1.0.0.tar.gz | 1.1 MB | Without provenance | Details for deduplicate_lib-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| deduplicate_lib-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for deduplicate_lib-1.0.0-py3-none-any.whl |
Total release size: 1.1 MB
Release files / deduplicate_lib-1.0.0.tar.gz
| Download URL | deduplicate_lib-1.0.0.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b6de6e1880c9cf952fc830732e39ae20caabc694d5aab8bbfb16ba179c392e5
|
|
BLAKE2b-256 checksum How to use checksums |
409e51954732b7d606cb5994708307eb4d9d15e455aab6da21e873b3d8bdd8dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / deduplicate_lib-1.0.0-py3-none-any.whl
| Download URL | deduplicate_lib-1.0.0-py3-none-any.whl |
|---|---|
| Size | 44.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ccb1585e533e535e9714de519f63d06419901a301f857e786c954feb59af5e84
|
|
BLAKE2b-256 checksum How to use checksums |
809bcb49af73c3d95457ee24348a9ecf610d9f632693df4943e3b1002765e643
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for deduplicate_lib 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.