Rehome your Python scripts into nice interconnected modules
- Python 3.10+
pip install rehome
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)
-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
-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"]