Code duplication detection using AST analysis
Project description
Simuradar
AST-based Python code duplication detection.
Why AST?
Simuradar uses Python's built-in ast module—no external parser dependencies. This means:
- Zero parser dependencies — Only standard library + output formatters
- Native Python version alignment — The AST parser IS your Python interpreter. No parser/ runtime version mismatches
- Automatic updates — When Python adds new syntax
match(like in 3.10 or improved f-strings in 3.12), Simuradar gets it for free - No third-party parser edge cases — External parsers may diverge from CPython's behavior. We use the real thing
Installation
pip install .
# or with uv
uv pip install .
Usage
simuradar /path/to/project
Options:
--engine {apted,jaccard,jaccard-norm}— Similarity algorithm (default: jaccard)--threshold 0.8— Similarity threshold 0.0-1.0 (default: 0.8)--output {rich,json}— Output format (default: rich)
How It Works
- Parse — Walk the target directory, extract code fragments (functions, classes, modules) using Python's
astmodule - Normalize — Optional: strip comments, normalize whitespace (not yet implemented)
- Compare — Run selected similarity algorithm against all fragment pairs
- Report — Group similar fragments and display results
Engines
| Engine | Description | Complexity |
|---|---|---|
apted |
Tree edit distance (APTED) | O(n³) — Slow but accurate |
jaccard |
Node type Jaccard similarity | O(n²) — Fast |
jaccard-norm |
Jaccard + subtree patterns | O(n²) — Balanced |
Requirements
- Python 3.12+
- cyclopts (CLI)
- rich (terminal output)
- apted (optional, for apted engine)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simuradar-0.1.0.tar.gz.
File metadata
- Download URL: simuradar-0.1.0.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c02f1fff82edf52a3662e84db126d69305038cc28cfef98c54f1537c9e31d0a
|
|
| MD5 |
9525ddab5dec8597f57eeec18c5d8d07
|
|
| BLAKE2b-256 |
7dca706fb67471d717369188953fc3f00e5486756452d2013d13d07bbe82c89f
|
Provenance
The following attestation bundles were made for simuradar-0.1.0.tar.gz:
Publisher:
publish.yml on Joxos/simuradar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simuradar-0.1.0.tar.gz -
Subject digest:
0c02f1fff82edf52a3662e84db126d69305038cc28cfef98c54f1537c9e31d0a - Sigstore transparency entry: 1070735349
- Sigstore integration time:
-
Permalink:
Joxos/simuradar@61a5b628768af4597f74dbc57f1ae74446b5bb39 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Joxos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@61a5b628768af4597f74dbc57f1ae74446b5bb39 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file simuradar-0.1.0-py3-none-any.whl.
File metadata
- Download URL: simuradar-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d57ff52554f595c11dfdc8b84d34b2085b975fd9e2022d1ba15e7c6f38c0b508
|
|
| MD5 |
cd4ee799c6677068221817be129027f0
|
|
| BLAKE2b-256 |
14e987a54deac2ea51b94671efb3f62dee8903845009e61bd98dad37e00282a4
|
Provenance
The following attestation bundles were made for simuradar-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Joxos/simuradar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simuradar-0.1.0-py3-none-any.whl -
Subject digest:
d57ff52554f595c11dfdc8b84d34b2085b975fd9e2022d1ba15e7c6f38c0b508 - Sigstore transparency entry: 1070735444
- Sigstore integration time:
-
Permalink:
Joxos/simuradar@61a5b628768af4597f74dbc57f1ae74446b5bb39 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Joxos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@61a5b628768af4597f74dbc57f1ae74446b5bb39 -
Trigger Event:
workflow_dispatch
-
Statement type: