A tool to remove empty lines and clean up whitespace in Python files
Project description
whitespaces
https://pypi.org/project/whitespaces/ 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 whitespaces
That's it! All dependencies will be automatically installed.
Usage
You can use whitespaces either as a command-line tool or as a library in your Python code.
Command Line Usage
# Clean a single file
whitespaces run file.py
# Clean multiple files
whitespaces run file1.py file2.py
# Clean all Python files in a directory
whitespaces 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
Release history Release notifications | RSS feed
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 whitespaces-0.1.0.tar.gz.
File metadata
- Download URL: whitespaces-0.1.0.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3640bf11d23cc8989cda6e93dce7526cfcc533cfb3484798364c226074b1b9a9
|
|
| MD5 |
3d961438e1918b7097fbdc02d4741867
|
|
| BLAKE2b-256 |
00992c8f1f59f04f2b693ebb492f9584c520ccadacb1c14cee89426fc85deec5
|
File details
Details for the file whitespaces-0.1.0-py3-none-any.whl.
File metadata
- Download URL: whitespaces-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc74863fb7fbdd84978d0192f0aa3803bb407e955990038c94e35d84640ab9b0
|
|
| MD5 |
7453ba0d616388d7bcc331365200ea63
|
|
| BLAKE2b-256 |
16e77db77ebc423a25618b69ba462fa21b1273418ab5baa27e4bcc8bffdae126
|