Skip to main content

Safe code refactoring for modern Python projects

Project description

Bowler

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.

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

bowler-0.7.0.tar.gz (39.1 kB view details)

Uploaded Source

Built Distribution

bowler-0.7.0-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

Details for the file bowler-0.7.0.tar.gz.

File metadata

  • Download URL: bowler-0.7.0.tar.gz
  • Upload date:
  • Size: 39.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for bowler-0.7.0.tar.gz
Algorithm Hash digest
SHA256 8bee2f9b14c38b13e0d1f68ae417fa74ba40c45baa23dc2f927a220575332aef
MD5 c812bc943bff75b4f8b1cb58152d782d
BLAKE2b-256 0d5925ddf9039fc07f497ec45d9b7081afff3eb49ede5c856cd32b7c41d9b392

See more details on using hashes here.

Provenance

File details

Details for the file bowler-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: bowler-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 34.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for bowler-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7918744bd1a25629f7afccdcb9c290f00f2eb6c596ecd509046c5fb80bd57e34
MD5 5e759960b3d693fdb49612e3bf8953de
BLAKE2b-256 32464bc2cb2231b9cd4aaf134503d0b37ff000bcc45155dc99f87929ef73a42f

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page