Tool to move around Python source code.
Project description
refac
A tool for moving and refactoring python code. It supports moving files or entire directories (refac file). Also supports moving specific symbols inside a file (refac symbol) or specific imports (refac import).
Quickstart
pip install refac
refac file /path/to/src.py /path/to/dst.py
and add the following to your .libcst.codemod.yaml
at the root of your project:
modules:
- "refac.visitors"
usage:
refac [file|symbol|import] <src> <dst>
examples:
refac file /path/to/src.py /path/to/dst.py
refac symbol path.to.SrcClass path.to.DstClass
refac symbol path.to.src_func1,path.to.src_func2 path.to.dst_func1,path.to.dst_func2
refac import path.to.src_import path.to.dst_import
Contributing
Contributions are welcomed and appreciated. Check out ARCHITECTURE.md for an overview of the codebase.
To run tests:
# Must be using Python >3.9
python -m pip install -r requirements.txt
python -m unittest tests/**/*.py
Please file GitHub issues for any bugs.
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
refac-0.0.5.tar.gz
(16.2 kB
view hashes)
Built Distribution
refac-0.0.5-py2.py3-none-any.whl
(20.0 kB
view hashes)
Close
Hashes for refac-0.0.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e45d4bd51c0ec2797b99e7625732b24112df862903bb135b76f1c5486175503e |
|
MD5 | 4bfade6020b4346ce7a9924f0726e835 |
|
BLAKE2b-256 | 4d26cc0999c879af1fe6f3b7734a37ecffd8e8755a9f5a57bd8172fbe0e5570a |