Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 73 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,86 @@
*.out
*.app

# Build directories
build/
dist/
*.egg-info/

# Env
# Python packaging and build artifacts
*.egg
*.whl
.eggs/
*.manifest
*.spec

# Virtual environments
*env/
venv/
ENV/
env/

# python
# Python cache and compiled files
*__pycache__/

# Ignore compiled Python files
*.pyc
*.pyo
*.pyd
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging artifacts
.Python
develop-eggs/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
MANIFEST

# PyInstaller
*.manifest
*.spec

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# vscode
# VS Code
.vscode/

# Allow specific VS Code files to be tracked
Expand Down
125 changes: 125 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Installation Guide for diNo-lib

## For Users: Installing the Package

### Quick Install (Recommended)

```bash
# Create and activate virtual environment (recommended)
python -m venv diNo_env
source diNo_env/bin/activate # On Windows: diNo_env\Scripts\activate

# Install from source
git clone https://github.com/MChatzakis/diNo-lib.git
cd diNo-lib
git submodule update --init --recursive

# Install build dependencies and package
pip install pybind11 numpy setuptools wheel
pip install .

# Or with optional dependencies
pip install .[mpi] # With MPI support
pip install .[dev] # With development tools
```

## For Developers: Development Setup

### Prerequisites

```bash
# Make sure you have Python 3.8+ and pip installed
python --version
pip --version
```

### Development Environment Setup

```bash
# Create virtual environment for development
python -m venv diNo_dev_env
source diNo_dev_env/bin/activate # On Windows: diNo_dev_env\Scripts\activate

# Clone repository
git clone https://github.com/MChatzakis/diNo-lib.git
cd diNo-lib
git submodule update --init --recursive

# Install build dependencies
pip install pybind11 numpy setuptools wheel build

# Install in development mode (editable install)
pip install -e .[dev]
```

## For Maintainers: Creating Distribution Packages

### Build Packages

```bash
# Create clean virtual environment for packaging
python -m venv packaging_env
source packaging_env/bin/activate

# Install packaging tools
pip install build twine pybind11 numpy

# Build source distribution and wheel
python -m build

# This creates files in dist/ directory:
# - dino-lib-1.0.0.tar.gz (source distribution)
# - dino-lib-1.0.0-py3-none-any.whl (wheel distribution)
```

### Test Built Package

```bash
# Create fresh test environment
python -m venv test_env
source test_env/bin/activate

# Install from built wheel
pip install dist/dino-lib-1.0.0-*.whl

# Test the installation
python -c "import diNoSimilaritySearch; print('Installation successful!')"
```

### Upload to PyPI (when ready)

```bash
# Upload to TestPyPI first
twine upload --repository testpypi dist/*

# Upload to PyPI
twine upload dist/*
```

## Usage

```python
import numpy as np
from diNoSimilaritySearch import DistanceType, BruteForceSearch

# Create random data
np.random.seed(100)
db = np.random.randn(1000, 64).astype(np.float32)
query = np.random.randn(10, 64).astype(np.float32)

# Create search index
index = BruteForceSearch(DistanceType.L2_SQUARED)
index.buildIndex(db)

# Search
I, D = index.searchIndex(query, k=5)
print("Indices:", I)
print("Distances:", D)
```

## Troubleshooting

- If you get import errors, make sure pybind11 and numpy are installed
- On some systems you may need to install a C++ compiler (gcc/clang)
- For CUDA support, make sure CUDA toolkit is installed
- For MPI support, install MPI library (e.g., `sudo apt-get install libopenmpi-dev`)
13 changes: 13 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
include README.md
include LICENSE
include requirements_diNo.txt
recursive-include lib *.hpp *.cpp
recursive-include commons *.hpp *.cpp
recursive-include pybinds *.cpp
recursive-exclude build *
recursive-exclude diNo_env *
recursive-exclude faiss_env *
recursive-exclude fastdtw_env *
recursive-exclude tslearn_env *
recursive-exclude demos *.so
recursive-exclude demos __pycache__
26 changes: 26 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
diNo-lib: High-performance similarity search library for time series data

This library provides multiple algorithms for nearest neighbor search on time series data:
- Brute Force search
- Lower Bound Brute Force search
- MESSI - Advanced indexing algorithm for DTW searches
- Odyssey - MPI-based distributed search
- PARIS - Parallel indexing for disk-based datasets
- SING - CUDA-accelerated search
"""

__version__ = "1.0.0"
__author__ = ""

try:
from .diNoSimilaritySearch import *
except ImportError:
# If the compiled extension is not available, provide a helpful message
import warnings
warnings.warn(
"diNoSimilaritySearch extension not found. "
"The library may not have been compiled properly. "
"Please check the installation instructions.",
ImportWarning
)
54 changes: 54 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[build-system]
requires = [
"setuptools>=45",
"wheel",
"pybind11>=2.10.0",
"numpy>=1.19.0"
]
build-backend = "setuptools.build_meta"

[project]
name = "diNo-lib"
version = "1.0.0"
description = "High-performance similarity search library for time series data"
readme = "README.md"
requires-python = ">=3.8"
license = {file = "LICENSE"}
authors = [
{name = ""},
]
keywords = ["similarity-search", "time-series", "nearest-neighbor", "dtw", "cuda", "mpi"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Programming Language :: C++",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"numpy>=1.19.0",
"pybind11>=2.10.0",
]

[project.optional-dependencies]
mpi = ["mpi4py>=4.0.0"]
dev = ["pytest", "cmake"]

[project.urls]
Homepage = "https://github.com/MChatzakis/diNo-lib"
Repository = "https://github.com/MChatzakis/diNo-lib"
Issues = "https://github.com/MChatzakis/diNo-lib/issues"

[tool.setuptools]
packages = []
2 changes: 2 additions & 0 deletions requirements_diNo.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
numpy==2.2.6
mpi4py==4.0.3
pip==24.0
setuptools==80.9.0
Loading