sloptools
Deterministic code-quality tools for Python codebases. Everything is computed from the source with plain AST analysis (no LLM), so the same code always gives the same results.
| Tool | What it does |
|---|---|
sloptrace |
Measures whether a codebase is getting messier, and tracks it over git history. |
Formerly published as sloptrace; that package now just installs sloptools.
Install
pip install sloptools
Requires Python 3.9+.
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. |
The approach is adapted from the SlopCodeBench paper (Orlanski et al., 2025).
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.
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.
Development
git clone https://github.com/sjtechdev/sloptools.git
cd sloptools
pip install -e ".[test]"
pytest
Metadata
Release files for sloptools 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sloptools-0.2.0.tar.gz | 24.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sloptools-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.7 kB
Release files / sloptools-0.2.0.tar.gz
| Download URL | sloptools-0.2.0.tar.gz |
|---|---|
| Size | 24.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
858e5498677ae06bf4e82e2fc60f12138864ebf2d2867d6dda70a03589373c54
|
|
BLAKE2b-256 checksum How to use checksums |
094ae5471db040a89b203b0f95155d6f1813e8130b12d49e3a7b260890633910
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.
Transparency logRelease files / sloptools-0.2.0-py3-none-any.whl
| Download URL | sloptools-0.2.0-py3-none-any.whl |
|---|---|
| Size | 27.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ebaba8d41dd0b08c205b075a3517df6d90872bf56a77bc1a7713a25e7eefd54
|
|
BLAKE2b-256 checksum How to use checksums |
1a2fb481a6d66178d453bc595424304728141116ed5d623b201b9a76af3b8494
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.
Transparency log