Skip to main content

Safe code refactoring for modern Python projects.

build status code coverage version changelog license code style

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.

Release files for bowler-py35 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bowler-py35 0.9.1
File Size Uploaded
bowler-py35-0.9.1.tar.gz 30.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bowler-py35 0.9.1
File Interpreter ABI Platform
bowler_py35-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 68.2 kB

Release files / bowler-py35-0.9.1.tar.gz

Download URL bowler-py35-0.9.1.tar.gz
Size 30.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3a8696179f06a75c1cba2e780a33d965e9fa93e9ec1a92ab203306649e7f0a39
BLAKE2b-256 checksum
How to use checksums
8c75110d5aa452012e3023ce2eb2b5906ace6b13064bf67d1455f9f29531e3ed
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / bowler_py35-0.9.1-py3-none-any.whl

Download URL bowler_py35-0.9.1-py3-none-any.whl
Size 38.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a646b76a162065a0419b7cefc9b7af24c0fed82cf1ffab975f052774e37d1bd9
BLAKE2b-256 checksum
How to use checksums
d28dd4f679cbfb1c407e534f35532e67f0b29edd11008cc4a5e415fac4a85c1a
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.9.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page