pystreamliner
Automatically clean up messy Python files — without breaking anything.
pystreamliner uses Python's AST (abstract syntax tree) to safely detect and fix common code issues. It operates on two tiers: things it can fix automatically with zero risk, and things it flags for you to review manually.
Supports single files, multiple files, and recursive directory cleaning with a tight summary mode for large runs.
What it does
Auto-fixes (Tier 1 — applied immediately):
- Removes unused imports, or trims partially unused
from x import ystatements - Removes consecutive duplicate lines
- Caps excessive blank lines
Warnings (Tier 2 — reported, never auto-changed):
- Unused variables
- Unused top-level functions
- Vague variable names (
x,tmp,foo,bar, etc.) - Shadowed built-ins
- Dangerous calls (
eval,exec,pickle,os.system,subprocess(..., shell=True), unsafeyaml.load) - Possible hardcoded secrets
- Assert statements
- Broad
except:/except Exception
pystreamliner never touches code it isn't certain about. If there's any doubt, it warns you instead.
Install
pip install pystreamliner
No dependencies. Runs on Python 3.13+.
Usage
Single file:
pystreamliner your_file.py
Multiple files:
pystreamliner file1.py file2.py utils/*.py
Entire project (recursive):
pystreamliner .
# or
pystreamliner src/ tests/
Directories are walked recursively. Common junk directories (.git, __pycache__, venv, node_modules, etc.) are automatically skipped.
Preview without modifying:
pystreamliner --dry-run .
CI mode (exit non-zero on issues):
pystreamliner --check --quiet .
Big runs / Summary mode
When you process 5 or more files (configurable with --summary-threshold), pystreamliner switches to a compact summary instead of dumping a full report for every file:
══════════════════════════════════════════════════
pystreamliner summary
══════════════════════════════════════════════════
Files processed: 47
Clean (no issues): 39
Modified: 6
Warnings only: 2
Totals:
Unused imports removed: 14
Duplicate lines removed: 3
Blank lines reduced: 11
Warnings issued: 8
──────────────────────────────────────────────────
Files modified:
✓ src/utils.py (3 imports, 2 blanks)
✓ src/main.py (1 imports + 2 warnings)
...
══════════════════════════════════════════════════
This keeps the output usable even on large codebases.
Example (single-file detailed report)
══════════════════════════════════════════
pystreamliner report
══════════════════════════════════════════
File: main.py
Lines analyzed: 312
Auto-fixes applied:
Unused imports removed: 3
Duplicate lines removed: 1
Blank lines reduced: 2
Warnings (manual review needed):
Unused variables detected: 2
Unused functions detected: 1
Vague variable names: 1
──────────────────────────────────────────
Unused imports removed:
• line 4: import os
• line 5: import sys
• line 7: from pathlib import Path, PurePath (partially cleaned: kept 'Path')
Unused variables:
⚠ line 42: result
⚠ line 87: temp_val
Vague variable names:
⚠ line 23: tmp
══════════════════════════════════════════
Contributing
See CONTRIBUTING.md.
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 pystreamliner-1.18.0.tar.gz.
File metadata
- Download URL: pystreamliner-1.18.0.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf5179621d87500bbb511a36229fdcd26a0fa45a9340ac7e1f564ee3900861aa
|
|
| MD5 |
1023d92eafe52a9598c9793039168d59
|
|
| BLAKE2b-256 |
35d002c78609b284f2f2ffceb42f0c3ad1785e7c89f709d0c6e33570b0a896fc
|
Provenance
The following attestation bundles were made for pystreamliner-1.18.0.tar.gz:
Publisher:
main.yml on Supe232323/pystreamliner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pystreamliner-1.18.0.tar.gz -
Subject digest:
bf5179621d87500bbb511a36229fdcd26a0fa45a9340ac7e1f564ee3900861aa - Sigstore transparency entry: 2524626881
- Sigstore integration time:
-
Permalink:
Supe232323/pystreamliner@3a4a535739d7d6eaeed723e3d61fa373a3c5f975 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Supe232323
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@3a4a535739d7d6eaeed723e3d61fa373a3c5f975 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pystreamliner-1.18.0-py3-none-any.whl.
File metadata
- Download URL: pystreamliner-1.18.0-py3-none-any.whl
- Upload date:
- Size: 25.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3ba0422722519e064b0a25ad382e916c7858305bc71049ca3ae90f36bd5f5c8
|
|
| MD5 |
15d980a1f38badbe1bb5af8faee3bf8d
|
|
| BLAKE2b-256 |
b4f173b4afedf8c0ff38067bb470267d0bde43a4b44eeffdaa6b482de6af983a
|
Provenance
The following attestation bundles were made for pystreamliner-1.18.0-py3-none-any.whl:
Publisher:
main.yml on Supe232323/pystreamliner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pystreamliner-1.18.0-py3-none-any.whl -
Subject digest:
a3ba0422722519e064b0a25ad382e916c7858305bc71049ca3ae90f36bd5f5c8 - Sigstore transparency entry: 2524627793
- Sigstore integration time:
-
Permalink:
Supe232323/pystreamliner@3a4a535739d7d6eaeed723e3d61fa373a3c5f975 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Supe232323
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@3a4a535739d7d6eaeed723e3d61fa373a3c5f975 -
Trigger Event:
push
-
Statement type: