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.10+.


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

Why not just use Black / isort / autoflake?

Those are great tools and pystreamliner doesn't replace them. The difference:

  • Black formats style. pystreamliner removes dead code.
  • autoflake removes unused imports but doesn't warn about unused variables, vague names, or dead functions.
  • pystreamliner combines lightweight static analysis with conservative auto-fixing and a human-readable report — in a single file with zero dependencies.

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.13.1.tar.gz (6.0 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.13.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pystreamliner-1.13.1.tar.gz
Algorithm Hash digest
SHA256 560e662dc306da633bc531888587eb68e147e95dff5d1cbf363c9d8b40f8d757
MD5 3e65dd67c7b75de3c83db34be2bdc26e
BLAKE2b-256 4fc33d4114e35d32c9e099c0006c3d926fb464f6872578dc2291fc426f0f1200

See more details on using hashes here.

Provenance

The following attestation bundles were made for pystreamliner-1.13.1.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.13.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for pystreamliner-1.13.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5f9695abdc4ca04ccc37e7dcdf4874e2d7d8dc212117597b7df62b4680bf7034
MD5 83b9b75e227c56b9c0c7cd688d1c377b
BLAKE2b-256 da162b593628c7f1a8f97786ce348530ced01d5187090473efa093008eac799e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pystreamliner-1.13.1-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

1.16.0

2 files

1.15.0

2 files

1.14.0

2 files

This release

1.13.1 This release

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