Safe code refactoring for modern Python projects
Project description
Safe code refactoring for modern Python projects.
Overview
Bowler is a refactoring tool for manipulating Python at the syntax tree level. It enables safe, large scale code modifications while guaranteeing that the resulting code compiles and runs. It provides both a simple command line interface and a fluent API in Python for generating complex code modifications in code.
Bowler uses a “fluent” Query API to build refactoring scripts through a series of selectors, filters, and modifiers. Many simple modifications are already possible using the existing API, but you can also provide custom selectors, filters, and modifiers as needed to build more complex or custom refactorings. See the Query Reference for more details.
Using the query API to rename a single function, and generate an interactive diff from the results, would look something like this:
query = (
Query(<paths to modify>)
.select_function("old_name")
.rename("new_name")
.diff(interactive=True)
)
For more details or documentation, check out https://pybowler.io
Installing Bowler
Bowler supports modifications to code from any version of Python 2 or 3, but it requires Python 3.6 or higher to run. Bowler can be easily installed using most common Python packaging tools. We recommend installing the latest stable release from PyPI with pip:
pip install bowler
You can also install a development version from source by checking out the Git repo:
git clone https://github.com/facebookincubator/bowler
cd bowler
python setup.py install
License
Bowler is MIT licensed, as found in the LICENSE file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bowler-py35-0.9.0.tar.gz
.
File metadata
- Download URL: bowler-py35-0.9.0.tar.gz
- Upload date:
- Size: 30.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 065a0564a1f0ef38618fbfc7e319595382b44a18f63d2faa3639cfadec51c0a2 |
|
MD5 | 67c8f5a9873af00fb8e671d811893b2a |
|
BLAKE2b-256 | 5953a7729c29d6e955cc1d88672f2fc6f7f09ea3ba975b74bb2949ef2f14ed88 |
File details
Details for the file bowler_py35-0.9.0-py3-none-any.whl
.
File metadata
- Download URL: bowler_py35-0.9.0-py3-none-any.whl
- Upload date:
- Size: 38.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 231b5bb8d2d787e38feec85d6bc0b068908155ce47e30ef1169d3339715eaa3c |
|
MD5 | 7701a2fb122f0e55c6c83f3f243652e9 |
|
BLAKE2b-256 | e645614b1c551e2e6b8d8996bf5e8e69dfea7101bc80a643e3460e7235bdb087 |