Skip to main content

pystreamliner

PyPI version PyPI downloads

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.


What it does

Auto-fixes (Tier 1 — applied immediately):

  • Removes unused imports, or trims partially unused from x import y statements
  • 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.)

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

python streamliner.py your_file.py

This will:

  1. Analyze your_file.py
  2. Write the cleaned version in-place
  3. Print a full report of what was changed and what needs manual review
  4. Show a diff of every modification

Preview changes without modifying anything:

python streamliner.py --dry-run your_file.py

Example output

══════════════════════════════════════════
  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

pystreamliner-1.16.0.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pystreamliner-1.16.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file pystreamliner-1.16.0.tar.gz.

File metadata

  • Download URL: pystreamliner-1.16.0.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pystreamliner-1.16.0.tar.gz
Algorithm Hash digest
SHA256 6fa0e19af7f8b096119e45a8098dff25940c2233afaad7b92718a619befecbe0
MD5 fd89c1e435687a09c1d98dba33b137ab
BLAKE2b-256 b092daaca17f7330fcc0679c56ca17f48084facf1d831a1c34236670cb0f58a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pystreamliner-1.16.0.tar.gz:

Publisher: main.yml on Supe232323/pystreamliner

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pystreamliner-1.16.0-py3-none-any.whl.

File metadata

  • Download URL: pystreamliner-1.16.0-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pystreamliner-1.16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3100b4634ceb690d12191abb9b474a4ff9d7e56698edade5fd3ad34ee18f3bf4
MD5 c7c6d1fa0f7dd463b6165c532608f0e2
BLAKE2b-256 9adfa6049143615eac08df8a70626037f0e5624f4f2bcce92f4c37f7c24f0e7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pystreamliner-1.16.0-py3-none-any.whl:

Publisher: main.yml on Supe232323/pystreamliner

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.21.1

2 files

1.21.0

2 files

1.20.3

2 files

1.20.2

2 files

1.20.0

2 files

1.19.1

2 files

1.19.0

2 files

1.18.0

2 files

1.17.0

2 files

This release

1.16.0 This release

2 files

1.15.0

2 files

1.14.0

2 files

1.13.1

2 files

1.12.1

2 files

1.12.0

2 files

1.11.0

2 files

1.3

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page