# 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).
[![Checks](https://github.com/benchling/refac/actions/workflows/checks.yaml/badge.svg?branch=main&event=push)](https://github.com/benchling/refac/actions/workflows/checks.yaml)
## Quickstart
```bash
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:
```yaml
modules:
- "refac.visitors"
```
```bash
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:
```bash
# 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/benchling/refac",
"name": "refac",
"maintainer": "Benchling Open Source",
"docs_url": null,
"requires_python": "",
"maintainer_email": "opensource@benchling.com",
"keywords": "refactor,symbol,move",
"author": "Benchling Open Source",
"author_email": "opensource@benchling.com",
"download_url": "https://files.pythonhosted.org/packages/c6/51/f4d2179e7eba23f33ff95dbd55bb3ceb1946a97859f359ec5aaf032c5ef3/refac-0.0.5.tar.gz",
"platform": null,
"description": "# refac\n\nA 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).\n\n[![Checks](https://github.com/benchling/refac/actions/workflows/checks.yaml/badge.svg?branch=main&event=push)](https://github.com/benchling/refac/actions/workflows/checks.yaml)\n\n## Quickstart\n\n```bash\npip install refac\nrefac file /path/to/src.py /path/to/dst.py\n```\n\nand add the following to your `.libcst.codemod.yaml` at the root of your project:\n\n```yaml\nmodules:\n - \"refac.visitors\"\n```\n\n```bash\nusage:\n refac [file|symbol|import] <src> <dst>\n\n examples:\n refac file /path/to/src.py /path/to/dst.py\n refac symbol path.to.SrcClass path.to.DstClass\n refac symbol path.to.src_func1,path.to.src_func2 path.to.dst_func1,path.to.dst_func2\n refac import path.to.src_import path.to.dst_import\n```\n\n## Contributing\n\nContributions are welcomed and appreciated. Check out ARCHITECTURE.md for an overview of the codebase.\n\nTo run tests:\n\n```bash\n# Must be using Python >3.9\npython -m pip install -r requirements.txt\npython -m unittest tests/**/*.py\n```\n\nPlease file GitHub issues for any bugs.\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Tool to move around Python source code.",
"version": "0.0.5",
"project_urls": {
"Homepage": "https://github.com/benchling/refac"
},
"split_keywords": [
"refactor",
"symbol",
"move"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4d26cc0999c879af1fe6f3b7734a37ecffd8e8755a9f5a57bd8172fbe0e5570a",
"md5": "4bfade6020b4346ce7a9924f0726e835",
"sha256": "e45d4bd51c0ec2797b99e7625732b24112df862903bb135b76f1c5486175503e"
},
"downloads": -1,
"filename": "refac-0.0.5-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "4bfade6020b4346ce7a9924f0726e835",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 20001,
"upload_time": "2023-08-14T19:35:21",
"upload_time_iso_8601": "2023-08-14T19:35:21.207484Z",
"url": "https://files.pythonhosted.org/packages/4d/26/cc0999c879af1fe6f3b7734a37ecffd8e8755a9f5a57bd8172fbe0e5570a/refac-0.0.5-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c651f4d2179e7eba23f33ff95dbd55bb3ceb1946a97859f359ec5aaf032c5ef3",
"md5": "d73ebd73c3cd65980044a31a74b29ba1",
"sha256": "68b8a7d2c4b676ea02c9770ca704a6a2c94ad488b1e06960295644c56e8ab80e"
},
"downloads": -1,
"filename": "refac-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "d73ebd73c3cd65980044a31a74b29ba1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16216,
"upload_time": "2023-08-14T19:35:22",
"upload_time_iso_8601": "2023-08-14T19:35:22.411481Z",
"url": "https://files.pythonhosted.org/packages/c6/51/f4d2179e7eba23f33ff95dbd55bb3ceb1946a97859f359ec5aaf032c5ef3/refac-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-14 19:35:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "benchling",
"github_project": "refac",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "refac"
}