Skip to main content

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

Project description

rigby

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


Download files

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

Source Distribution

rigby-0.1.3.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

rigby-0.1.3-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file rigby-0.1.3.tar.gz.

File metadata

  • Download URL: rigby-0.1.3.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

Hashes for rigby-0.1.3.tar.gz
Algorithm Hash digest
SHA256 004e95b5e7897e422ac7fc9edb9385b641f07c23ceb76b4b931c57ed99969b69
MD5 e9c69451045141c69f679fd7db142d39
BLAKE2b-256 3ea4d90902eb7b66a3844fe351fe61c692bbb09730737b3aa6ab4a4d30f5630f

See more details on using hashes here.

File details

Details for the file rigby-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: rigby-0.1.3-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

Hashes for rigby-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9d81bcede1be546bc6e1c439f11da16dc04b0c4fe9e067636a836cc77bf6e032
MD5 61a16d9a0e6096fbbd7d6238147d6c70
BLAKE2b-256 635eeffc9dae8dc50eb188b7e12310c3241fd325afc018588336b1b5681c4b2f

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