Linter that catches AI-generated code slop in Python — the ex_slop of the Python ecosystem.
Project description
py-slop
Linter that catches AI-generated code slop in Python.
Deep, single-ecosystem checks for patterns that LLMs produce but experienced Python developers don't — narrator comments, silent exception swallowing, boilerplate docstrings, N+1 query loops, and more.
Modeled on ex_slop (40 Credo checks for Elixir). Where ex_slop integrates with Credo, py-slop ships as a standalone CLI and pre-commit hook. Ruff already covers the classics (E722, S110, B006, PGH003) — py-slop targets what ruff cannot express.
Installation
pip install py-slop
Usage
py-slop check path/to/file.py [more files...]
Checks
Comment / docstring content (ruff can't — it never inspects content)
| Check | What it catches | Nearest ruff rule |
|---|---|---|
narrator-comment |
# First, we validate the input / # Here we fetch |
None — ERA001 catches commented-out code, not narration |
obvious-comment |
# Fetch the user above user = get_user(id) |
None |
step-comment |
# Step 1: validate / # Step 2: process |
None |
boilerplate-docstring |
def get_user(id): """Get the user.""" |
D-series checks formatting, not semantic redundancy |
Error handling (beyond ruff's scope)
| Check | What it catches | Nearest ruff rule |
|---|---|---|
except-returns-default |
except: return None / "" / 0 / False / [] / {} |
BLE001 flags blanket except:, not what it returns |
except-log-continue |
except Exception as e: logger.error(e) — logs but swallows |
None — behavioral analysis of except bodies |
useless-try-except |
try: f() except e: raise e — redundant wrapper |
TRY302 is similar but not identical |
Patterns
| Check | What it catches | Nearest ruff rule |
|---|---|---|
query-in-loop |
N+1 queries in loops (Django objects.*, SQLAlchemy session.*) |
None — no framework-aware detection |
redundant-boolean-return |
if x: return True; else: return False |
SIM103 covers the no-else form; this catches explicit else |
Ruff overlap honesty
Run ruff for these — py-slop deliberately does not duplicate them:
| Pattern | Ruff rule |
|---|---|
Blanket except: |
BLE001 |
Bare except Exception: + pass |
S110 |
print() left behind |
T201 |
| Commented-out code | ERA001 |
Blanket type: ignore |
PGH003 |
| Mutable default arguments | B006 |
License
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 py_slop-0.1.1.tar.gz.
File metadata
- Download URL: py_slop-0.1.1.tar.gz
- Upload date:
- Size: 30.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c43c5f61963360622db25c73d77d5619f86b4f52823cf3f85af667e43531dd8f
|
|
| MD5 |
14275c0744e6765ba6005bf533bbd4de
|
|
| BLAKE2b-256 |
4e87591619e00c16f23d702e1fe0e09385befc7a40cc70d317d71929a597a281
|
Provenance
The following attestation bundles were made for py_slop-0.1.1.tar.gz:
Publisher:
publish.yml on AugurCognito/py_slop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_slop-0.1.1.tar.gz -
Subject digest:
c43c5f61963360622db25c73d77d5619f86b4f52823cf3f85af667e43531dd8f - Sigstore transparency entry: 2098835504
- Sigstore integration time:
-
Permalink:
AugurCognito/py_slop@3cfa43c3560da250e085d131f8766e21aceeafb0 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/AugurCognito
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3cfa43c3560da250e085d131f8766e21aceeafb0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file py_slop-0.1.1-py3-none-any.whl.
File metadata
- Download URL: py_slop-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d23a924c21d27dd7f216f8a10219a606380522652e36e5ad10b70a63909f6b1
|
|
| MD5 |
10142e6944e61cc7f7bb83bc5af8d781
|
|
| BLAKE2b-256 |
de1324710f203cbac48d7d671e9f422985239ea3d4936fb0b4235e46e528e0af
|
Provenance
The following attestation bundles were made for py_slop-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on AugurCognito/py_slop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_slop-0.1.1-py3-none-any.whl -
Subject digest:
9d23a924c21d27dd7f216f8a10219a606380522652e36e5ad10b70a63909f6b1 - Sigstore transparency entry: 2098835749
- Sigstore integration time:
-
Permalink:
AugurCognito/py_slop@3cfa43c3560da250e085d131f8766e21aceeafb0 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/AugurCognito
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3cfa43c3560da250e085d131f8766e21aceeafb0 -
Trigger Event:
release
-
Statement type: