A tool to remove empty lines and clean up rigby in Python files
Project description
rigby
https://pypi.org/project/rigby/
A Python tool to clean up Python files by managing empty lines, with a focus on:
- Removing ALL empty lines within functions and classes
- Maintaining exactly one empty line between functions
- Maintaining exactly two empty lines between classes
Installation
Simply run:
pip install rigby
That's it! All dependencies will be automatically installed.
Usage
You can use rigby either as a command-line tool or as a library in your Python code.
Command Line Usage
# Clean a single file
rigby run file.py
# Clean multiple files
rigby run file1.py file2.py
# Clean all Python files in a directory
rigby run .
Python Usage
from rigby import clean_file, clean_source
# Clean a single file
clean_file("path/to/your/file.py")
# Clean source code directly
source = '''
class MyClass:
def foo():
print("hello")
print("world")
def bar():
print("bar")
'''
cleaned = clean_source(source) # Will remove empty lines within functions and format properly
Features
- Removes ALL empty lines within functions and classes
- Maintains exactly one empty line between functions
- Maintains exactly two empty lines between classes
- Preserves code functionality while cleaning up 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
rm -rf dist/ && python3 -m build python3 -m twine upload dist/* pip uninstall -y rigby && pip install --no-cache-dir rigby
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 rigby-0.1.2.tar.gz.
File metadata
- Download URL: rigby-0.1.2.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e62e02b891ecbce8f4fe0e075d2d83b0b326655bc780e89af6867b5617a80f1
|
|
| MD5 |
ac8ebebc09dbd79f1657131c7e28e852
|
|
| BLAKE2b-256 |
81029646b528b0fcd9f56b116acd366f22e0b1c706c74260b9e2f62e89dceba7
|
File details
Details for the file rigby-0.1.2-py3-none-any.whl.
File metadata
- Download URL: rigby-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.9 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 |
6ea58dc091f835d0499aa1cb2b70656d5f78777382cb6ce6f8512f211561bca2
|
|
| MD5 |
e90dcbf1da83e3d3ae77c4577db32679
|
|
| BLAKE2b-256 |
0de5bac8b3a6624a0f07980faf228f633f477c6f46ba8c05b69f4740cade54b1
|