Metadata-Version: 2.4
Name: matheel
Version: 0.3.6
Summary: Matheel: A CLI and Python package for source-code similarity detection.
Author: Fahad Ebrahim
License-Expression: MIT
Project-URL: Homepage, https://github.com/FahadEbrahim/matheel
Project-URL: Source, https://github.com/FahadEbrahim/matheel
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: <3.14,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click<9,>=8
Requires-Dist: pandas<3.1,>=2.2
Requires-Dist: numpy<3,>=2
Requires-Dist: rapidfuzz<4,>=3
Requires-Dist: networkx<4,>=3
Requires-Dist: tree-sitter-language-pack<0.8,>=0.7
Requires-Dist: func-timeout<5,>=4
Provides-Extra: chunking
Requires-Dist: chonkie<1.7,>=1.5; extra == "chunking"
Provides-Extra: chunking-code
Requires-Dist: chonkie[code]<1.7,>=1.5; extra == "chunking-code"
Provides-Extra: metrics
Requires-Dist: apted<2,>=1.0; extra == "metrics"
Requires-Dist: bert-score<0.4,>=0.3; extra == "metrics"
Provides-Extra: sentence-transformers
Requires-Dist: sentence-transformers<5.2,>=5.1; extra == "sentence-transformers"
Requires-Dist: sentencepiece<0.3,>=0.2; extra == "sentence-transformers"
Provides-Extra: model2vec
Requires-Dist: model2vec<0.9,>=0.7; extra == "model2vec"
Provides-Extra: pylate
Requires-Dist: sentence-transformers<5.2,>=5.1; extra == "pylate"
Requires-Dist: sentencepiece<0.3,>=0.2; extra == "pylate"
Requires-Dist: pylate<1.5,>=1.4; extra == "pylate"
Provides-Extra: semantic
Requires-Dist: sentence-transformers<5.2,>=5.1; extra == "semantic"
Requires-Dist: sentencepiece<0.3,>=0.2; extra == "semantic"
Requires-Dist: model2vec<0.9,>=0.7; extra == "semantic"
Requires-Dist: pylate<1.5,>=1.4; extra == "semantic"
Provides-Extra: gradio
Requires-Dist: sentence-transformers<5.2,>=5.1; extra == "gradio"
Requires-Dist: sentencepiece<0.3,>=0.2; extra == "gradio"
Requires-Dist: gradio<6,>=5; extra == "gradio"
Requires-Dist: gradio-huggingfacehub-search<0.1,>=0.0.8; extra == "gradio"
Provides-Extra: all
Requires-Dist: chonkie[code]<1.7,>=1.5; extra == "all"
Requires-Dist: apted<2,>=1.0; extra == "all"
Requires-Dist: bert-score<0.4,>=0.3; extra == "all"
Requires-Dist: sentence-transformers<5.2,>=5.1; extra == "all"
Requires-Dist: sentencepiece<0.3,>=0.2; extra == "all"
Requires-Dist: model2vec<0.9,>=0.7; extra == "all"
Requires-Dist: pylate<1.5,>=1.4; extra == "all"
Requires-Dist: gradio<6,>=5; extra == "all"
Requires-Dist: gradio-huggingfacehub-search<0.1,>=0.0.8; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest<10,>=8; extra == "dev"
Requires-Dist: ruff<0.16,>=0.15; extra == "dev"
Requires-Dist: build<2,>=1; extra == "dev"
Requires-Dist: twine<7,>=6; extra == "dev"
Dynamic: license-file

# Matheel

[![Tests](https://github.com/FahadEbrahim/matheel/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/FahadEbrahim/matheel/actions/workflows/tests.yml)
[![PyPI](https://img.shields.io/pypi/v/matheel.svg)](https://pypi.org/project/matheel/)
[![Python versions](https://img.shields.io/pypi/pyversions/matheel.svg)](https://pypi.org/project/matheel/)
[![Docs](https://img.shields.io/badge/docs-GitHub%20Pages-blue.svg)](https://fahadebrahim.github.io/matheel/)
[![Latest release](https://img.shields.io/github/v/release/FahadEbrahim/matheel.svg)](https://github.com/FahadEbrahim/matheel/releases)
[![License](https://img.shields.io/github/license/FahadEbrahim/matheel.svg)](LICENSE)

Matheel is a Python package and CLI for source-code similarity. It combines semantic embeddings, lexical similarity, chunking, preprocessing, and code evaluation metrics in one workflow.

## Demos

- Hugging Face Space demo: [buelfhood/matheel-framework](https://huggingface.co/spaces/buelfhood/matheel-framework)
- Gradio Colab notebook: [Open in Colab](https://colab.research.google.com/github/FahadEbrahim/matheel/blob/main/gradio_app/matheel_gradio_colab_demo.ipynb)
- Examples Colab notebook: [Open in Colab](https://colab.research.google.com/github/FahadEbrahim/matheel/blob/main/examples/matheel_examples_colab.ipynb)

## Installation

Use Python `3.10` to `3.13`. Installation can take some time.

Base install:

```bash
pip install matheel
```

Optional extras:

```bash
pip install "matheel[semantic]"
pip install "matheel[chunking]"
pip install "matheel[metrics]"
pip install "matheel[gradio]"
pip install "matheel[all]"
```

`matheel[semantic]` installs the supported semantic backends. `matheel[chunking]` installs Chonkie chunkers. `matheel[metrics]` installs optional code metric runtimes. `matheel[gradio]` installs the web app dependencies. `matheel[all]` installs all supported optional backends.

Compatibility extras remain available for narrower installs: `sentence_transformers`, `model2vec`, `pylate`, and `chunking_code`.

Examples that use semantic weights assume `matheel[semantic]` or `matheel[all]` is installed. See the [usage guide](https://fahadebrahim.github.io/matheel/usage/) for more install details.

## Quick Start

```bash
matheel compare sample_pairs.zip \
  --model huggingface/CodeBERTa-small-v1 \
  --feature-weight semantic=0.7 \
  --feature-weight levenshtein=0.3 \
  --threshold 0.2 \
  --num 10
```

```python
from matheel.similarity import calculate_similarity

score = calculate_similarity(
    "def add(a, b):\n    return a + b\n",
    "def add(x, y):\n    return x + y\n",
    feature_weights={"levenshtein": 1.0},
)
print(round(score, 4))
```

See the [usage guide](https://fahadebrahim.github.io/matheel/usage/) for archive, suite, chunking, embedding, and code-metric examples.

## Docs

- Published docs: [fahadebrahim.github.io/matheel](https://fahadebrahim.github.io/matheel/)
- Source docs: [docs/index.md](docs/index.md)
- Usage guide: [docs/usage.md](docs/usage.md)
- Development: [docs/development.md](docs/development.md)

## Development

Install Matheel in editable mode with the development tools, then run the default checks:

```bash
python -m pip install -e ".[dev]"
python -m pytest
python -m ruff check .
```

More development and release checks are in the [development docs](docs/development.md).

## License

This project is licensed under the [MIT License](LICENSE).
