Skip to main content

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

  1. Parse — Walk the target directory, extract code fragments (functions, classes, modules) using Python's ast module
  2. Normalize — Optional: strip comments, normalize whitespace (not yet implemented)
  3. Compare — Run selected similarity algorithm against all fragment pairs
  4. 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


Download files

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

Source Distribution

simuradar-0.1.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

simuradar-0.1.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

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

Hashes for simuradar-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0c02f1fff82edf52a3662e84db126d69305038cc28cfef98c54f1537c9e31d0a
MD5 9525ddab5dec8597f57eeec18c5d8d07
BLAKE2b-256 7dca706fb67471d717369188953fc3f00e5486756452d2013d13d07bbe82c89f

See more details on using hashes here.

Provenance

The following attestation bundles were made for simuradar-0.1.0.tar.gz:

Publisher: publish.yml on Joxos/simuradar

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

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

Hashes for simuradar-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d57ff52554f595c11dfdc8b84d34b2085b975fd9e2022d1ba15e7c6f38c0b508
MD5 cd4ee799c6677068221817be129027f0
BLAKE2b-256 14e987a54deac2ea51b94671efb3f62dee8903845009e61bd98dad37e00282a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for simuradar-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Joxos/simuradar

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