pystreamliner 1.11.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pystreamliner-1.11.0/PKG-INFO +5 -0
- pystreamliner-1.11.0/README.md +104 -0
- pystreamliner-1.11.0/pyproject.toml +17 -0
- pystreamliner-1.11.0/pystreamliner.egg-info/PKG-INFO +5 -0
- pystreamliner-1.11.0/pystreamliner.egg-info/SOURCES.txt +7 -0
- pystreamliner-1.11.0/pystreamliner.egg-info/dependency_links.txt +1 -0
- pystreamliner-1.11.0/pystreamliner.egg-info/entry_points.txt +2 -0
- pystreamliner-1.11.0/pystreamliner.egg-info/top_level.txt +1 -0
- pystreamliner-1.11.0/setup.cfg +4 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# PyStreamliner
|
|
2
|
+
|
|
3
|
+
**Automatically clean up messy Python files — without breaking anything.**
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## What it does
|
|
10
|
+
|
|
11
|
+
**Auto-fixes (Tier 1 — applied immediately):**
|
|
12
|
+
- Removes unused imports, or trims partially unused `from x import y` statements
|
|
13
|
+
- Removes consecutive duplicate lines
|
|
14
|
+
- Caps excessive blank lines
|
|
15
|
+
|
|
16
|
+
**Warnings (Tier 2 — reported, never auto-changed):**
|
|
17
|
+
- Unused variables
|
|
18
|
+
- Unused top-level functions
|
|
19
|
+
- Vague variable names (`x`, `tmp`, `foo`, `bar`, etc.)
|
|
20
|
+
|
|
21
|
+
PyStreamliner never touches code it isn't certain about. If there's any doubt, it warns you instead.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/Supe232323/PyStreamliner.git
|
|
29
|
+
cd PyStreamliner
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
No dependencies. Runs on Python 3.10+.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python streamliner.py your_file.py
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This will:
|
|
43
|
+
1. Analyze `your_file.py`
|
|
44
|
+
2. Write the cleaned version in-place
|
|
45
|
+
3. Print a full report of what was changed and what needs manual review
|
|
46
|
+
4. Show a diff of every modification
|
|
47
|
+
|
|
48
|
+
**Preview changes without modifying anything:**
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python streamliner.py --dry-run your_file.py
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Example output
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
══════════════════════════════════════════
|
|
60
|
+
PyStreamliner Report
|
|
61
|
+
══════════════════════════════════════════
|
|
62
|
+
File: main.py
|
|
63
|
+
Lines analyzed: 312
|
|
64
|
+
|
|
65
|
+
Auto-fixes applied:
|
|
66
|
+
Unused imports removed: 3
|
|
67
|
+
Duplicate lines removed: 1
|
|
68
|
+
Blank lines reduced: 2
|
|
69
|
+
|
|
70
|
+
Warnings (manual review needed):
|
|
71
|
+
Unused variables detected: 2
|
|
72
|
+
Unused functions detected: 1
|
|
73
|
+
Vague variable names: 1
|
|
74
|
+
──────────────────────────────────────────
|
|
75
|
+
|
|
76
|
+
Unused imports removed:
|
|
77
|
+
• line 4: import os
|
|
78
|
+
• line 5: import sys
|
|
79
|
+
• line 7: from pathlib import Path, PurePath (partially cleaned: kept 'Path')
|
|
80
|
+
|
|
81
|
+
Unused variables:
|
|
82
|
+
⚠ line 42: result
|
|
83
|
+
⚠ line 87: temp_val
|
|
84
|
+
|
|
85
|
+
Vague variable names:
|
|
86
|
+
⚠ line 23: tmp
|
|
87
|
+
══════════════════════════════════════════
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Why not just use Black / isort / autoflake?
|
|
93
|
+
|
|
94
|
+
Those are great tools and PyStreamliner doesn't replace them. The difference:
|
|
95
|
+
|
|
96
|
+
- **Black** formats style. PyStreamliner removes dead code.
|
|
97
|
+
- **autoflake** removes unused imports but doesn't warn about unused variables, vague names, or dead functions.
|
|
98
|
+
- **PyStreamliner** combines lightweight static analysis with conservative auto-fixing and a human-readable report — in a single file with zero dependencies.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Contributing
|
|
103
|
+
|
|
104
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pystreamliner"
|
|
7
|
+
version = "1.11.0"
|
|
8
|
+
description = "A script to analyze and clean Python files"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
|
|
11
|
+
[project.scripts]
|
|
12
|
+
streamliner = "streamliner:main"
|
|
13
|
+
|
|
14
|
+
[tool.setuptools.packages.find]
|
|
15
|
+
include = ["streamliner*"]
|
|
16
|
+
exclude = ["test_messy*", "tests*"]
|
|
17
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|