lmmx / rehome

Rehome your Python scripts into nice interconnected modules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rehome

Documentation CI Status Coverage Checked with mypy Code style: black

Rehome your Python scripts into nice interconnected modules

Read The Docs

Requires

  • Python 3.10+

Installation

pip install rehome

Usage

The CLI allows you to instantiate the Rehome class central to this package directly.

usage: rehome [-h] [-p [PROTECT ...]] [-g [GROUP ...]] [-d] target

Rehome(target: pathlib.Path, protect: list[str] = <factory>, group: list[str] = <factory>, debug:
bool = False)

positional arguments:
  target

options:
  -h, --help            show this help message and exit
  -p [PROTECT ...], --protect [PROTECT ...]
                        (default: <factory>)
  -g [GROUP ...], --group [GROUP ...]
                        (default: <factory>)
  -d, --debug           (default: False)

Protected names

-p specifies names to protect, i.e. to keep in the source file

rehome foo.py -p main

...protects the name main, and ensures it will stay in the source file

Groups

-g specifies groups (each argument is a group, separated by spaces)

rehome foo.py -g "hand glove" "foot sock"

...creates two groups of names: ["hand", "glove"] and ["foot", "sock"]

rehome is available from PyPI, and the code is on GitHub

About

Rehome your Python scripts into nice interconnected modules

License:MIT License


Languages

Language:Python 93.6%Language:Shell 6.4%