sloptrace
Is your Python codebase getting messier? sloptrace measures it, and tracks how the numbers change over your git history.
It reports four things:
| Metric | What it tells you |
|---|---|
| Erosion | How much of your code's complexity is concentrated in a few huge functions, plus a ranked list of those functions. Watch the trend, not the absolute value. |
| Clones | Copy-pasted functions and code blocks, with file:line for each copy. |
| Repeated literals | Strings or lists of literals repeated across the code; usually a missing constant. |
| Import cycles | Modules that import each other and can't be understood on their own. |
Everything is computed from the source with plain AST analysis (no LLM), so the same code always gives the same numbers. The approach is adapted from the SlopCodeBench paper (Orlanski et al., 2025).
Install
pip install git+https://github.com/sjtechdev/sloptrace.git
Requires Python 3.9+.
Usage
sloptrace . # analyse the current checkout
sloptrace /path/to/repo --history # ...and how it changed over git history
sloptrace . --history --every 20 --max-commits 15 # sample every 20th commit, at most 15
sloptrace . --history --since 2024-01-01 -o out.json
sloptrace . --show-literals # also list repeated literals (noisy, off by default)
sloptrace --help # all options
Which files are scanned: in a git repo, everything tracked or untracked but
not ignored; otherwise the whole directory tree. Tests, docs, build output,
virtualenvs and vendored code are skipped by default; change that with
--exclude.
Development
git clone https://github.com/sjtechdev/sloptrace.git
cd sloptrace
pip install -e ".[test]"
pytest
Docs
Metric reference: the exact formula and a worked example for each metric.
Compared to scb-check
The paper's authors also publish scb-check.
It supports many languages and flags code with lots of pattern rules.
sloptrace only handles Python, but gives you evidence (which functions, which
copies) and trends over history.
Its erosion number won't exactly match the paper's: the two tools count branches slightly differently, so don't compare absolute values with the paper's published baselines.
Metadata
Release files for sloptrace 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sloptrace-0.0.2.tar.gz | 23.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sloptrace-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 50.8 kB
Release files / sloptrace-0.0.2.tar.gz
| Download URL | sloptrace-0.0.2.tar.gz |
|---|---|
| Size | 23.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
329cf2b695ebefedf2ed55fc6ef461edbb85a4ee2a5898f351ae4846f680e8bb
|
|
BLAKE2b-256 checksum How to use checksums |
489c765af54736c077da286b7b8c6d62f9a2b67212fff6259041f9794a1edc76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / sloptrace-0.0.2-py3-none-any.whl
| Download URL | sloptrace-0.0.2-py3-none-any.whl |
|---|---|
| Size | 26.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6aa760b5fba10a1bd954db7e9a7a0fc06a56394dee0736a1ab9cc1372878fbd
|
|
BLAKE2b-256 checksum How to use checksums |
bbb14b12785a530f0b248d59edaa5323576087e613e023d290e5aceb0d51e159
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|