Skip to main content

A tool to remove empty lines and clean up whitespace in Python files

Project description

whitespacerun

A Python tool to remove empty lines and clean up whitespace in Python files, with a special focus on removing unnecessary empty lines within functions.

Installation

Simply run:

pip install whitespacerun

That's it! All dependencies will be automatically installed.

Usage

You can use whitespacerun either as a command-line tool or as a library in your Python code.

Command Line Usage

# Clean a single file
whitespacerun run file.py

# Clean multiple files
whitespacerun run file1.py file2.py

# Clean all Python files in a directory
whitespacerun run .

Python Usage

from whitespace import clean_file

# Clean a single file
clean_file("path/to/your/file.py")

Features

  • Removes empty lines within functions
  • Preserves necessary whitespace for Python syntax
  • Maintains code readability while reducing unnecessary spacing
  • Supports both single file and directory processing
  • Can be used as a CLI tool or Python library

Dependencies

All of these will be installed automatically when you install the package:

  • click>=8.0.0 - For command line interface
  • loguru>=0.7.0 - For logging
  • pydantic>=2.0.0 - For data validation
  • typing-extensions>=4.0.0 - For type hints
  • rich>=13.0.0 - For beautiful terminal output

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whitespacerun-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

whitespacerun-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file whitespacerun-0.1.0.tar.gz.

File metadata

  • Download URL: whitespacerun-0.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for whitespacerun-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6e5f9f75823c0321d3c427363ee30dbd78396eafda3322915947ce3fc3560e12
MD5 8b1f538e975f01df024a502f4580e285
BLAKE2b-256 1cb00431ead8d1b35a74524bb30dfdc2e7939a9f99ff82c2f18ceaa53fa34818

See more details on using hashes here.

File details

Details for the file whitespacerun-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: whitespacerun-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for whitespacerun-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82ad11567835845007d9e0a6597a26660df4da10886620090ea4c89429999586
MD5 409f8399f591f0f06f17ffa48f441ece
BLAKE2b-256 a4c6439a9853a287577ef2fccadc5d54427cd8afd8fbc13a99858a5395b2be0c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page