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
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-0.9.0.tar.gz
.
File metadata
- Download URL: bowler-0.9.0.tar.gz
- Upload date:
- Size: 42.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdb85ce2e7bd545802a15d755d1daf2b6a125429355c50d2019a9f35d63e45db |
|
MD5 | 89314a63214c06b08f50cc379e4948c4 |
|
BLAKE2b-256 | f4024728875b1fc4382ea71e771c3475a2af6ccaf140663b36c8456ebba4ac5a |
File details
Details for the file bowler-0.9.0-py3-none-any.whl
.
File metadata
- Download URL: bowler-0.9.0-py3-none-any.whl
- Upload date:
- Size: 36.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0351839e9917765be694aa52c99ea784dc1286c9bdd6fd066b810097fc273e1b |
|
MD5 | bbf1bb4c688ce72ebc80c9f6c67c3ffb |
|
BLAKE2b-256 | b4dc17d999c602eb0ce1d1cd8d0833d29ca8cc1472ba3585c6e891450c2a621f |