-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 548fc81
Showing
72 changed files
with
4,225 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# Docusaurus | ||
.DS_Store | ||
|
||
node_modules | ||
|
||
lib/core/metadata.js | ||
lib/core/MetadataBlog.js | ||
|
||
website/translated_docs | ||
website/build/ | ||
website/yarn.lock | ||
website/node_modules | ||
website/i18n/* | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# dotenv | ||
.env | ||
|
||
# virtualenv | ||
.venv | ||
venv/ | ||
ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
language: python | ||
dist: xenial | ||
sudo: required | ||
env: | ||
python: | ||
- "3.7" | ||
- "3.7-dev" | ||
install: | ||
- "pip install -U black mypy pylint isort" | ||
- "pip install -U ." | ||
script: | ||
- "make test" | ||
matrix: | ||
allow_failures: | ||
- python: "3.7-dev" | ||
include: | ||
- python: "3.6" | ||
env: LINTING=true | ||
script: | ||
- "make lint test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Code of Conduct | ||
|
||
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. | ||
Please read the [full text](https://code.facebook.com/pages/876921332402685/open-source-code-of-conduct) | ||
so that you can understand what actions will and will not be tolerated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Contributing to Bowler | ||
|
||
We want to make contributing to this project as easy and transparent as | ||
possible. | ||
|
||
## Getting Started | ||
|
||
When developing Bowler, follow these steps to setup your environment, | ||
format your code, and run linters and unit tests: | ||
|
||
1. Fork [Bowler][] on Github. | ||
|
||
1. Clone the git repo: | ||
```bash | ||
$ git clone https://github.com/$USERNAME/bowler | ||
$ cd bowler | ||
``` | ||
|
||
1. Setup the virtual environment with dependencies and tools: | ||
```bash | ||
$ make dev | ||
$ source .venv/bin/activate | ||
``` | ||
|
||
1. Format your code using [*Black*](https://github.com/ambv/black) and | ||
[isort](https://pypi.org/project/isort/): | ||
```bash | ||
$ make format | ||
``` | ||
|
||
1. Run linter, type checks, and unit tests: | ||
```bash | ||
$ make lint test | ||
``` | ||
|
||
## Pull Requests | ||
|
||
We actively welcome your pull requests. | ||
|
||
1. If you've added code that should be tested, add unit tests. | ||
1. If you've changed APIs, update the documentation. | ||
1. Ensure the test suite passes. | ||
1. Make sure your code lints. | ||
1. If you haven't already, complete the Contributor License Agreement ("CLA"). | ||
|
||
## Contributor License Agreement ("CLA") | ||
|
||
In order to accept your pull request, we need you to submit a CLA. You only need | ||
to do this once to work on any of Facebook's open source projects. | ||
|
||
Complete your CLA here: <https://code.facebook.com/cla> | ||
|
||
## Issues | ||
|
||
We use GitHub issues to track public bugs. Please ensure your description is | ||
clear and has sufficient instructions to be able to reproduce the issue. | ||
|
||
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe | ||
disclosure of security bugs. In those cases, please go through the process | ||
outlined on that page and do not file a public issue. | ||
|
||
## License | ||
|
||
By contributing to Bowler, you agree that your contributions will be licensed | ||
under the `LICENSE` file in the root directory of this source tree. | ||
|
||
|
||
[Bowler]: https://github.com/facebookincubator/bowler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Facebook, Inc. and its affiliates. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include README.md LICENSE CODE_OF_CONDUCT.md CONTRIBUTING.md requirements.txt docs/*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<a href="https://pybowler.io"><img alt="Bowler" height="96" src="https://github.com/facebookincubator/Bowler/raw/master/website/static/img/logo/Bowler_FullColor_DarkText.png" /></a> | ||
|
||
**Safe code refactoring for modern Python projects.** | ||
|
||
[![build status](https://travis-ci.com/facebookincubator/Bowler.svg?branch=master)](https://travis-ci.com/facebookincubator/Bowler) | ||
[![version](https://img.shields.io/pypi/v/bowler.svg)](https://pypi.org/project/bowler) | ||
[![license](https://img.shields.io/pypi/l/bowler.svg)](https://github.com/facebookincubator/bowler/blob/master/LICENSE) | ||
[![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) | ||
|
||
|
||
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](https://pybowler.io/docs/api-query.md) 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: | ||
|
||
```python | ||
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`: | ||
|
||
```bash | ||
pip install bowler | ||
``` | ||
|
||
You can also install a development version from source by checking out the Git repo: | ||
|
||
```bash | ||
git clone https://github.com/facebookincubator/bowler | ||
cd bowler | ||
python setup.py install | ||
``` | ||
|
||
|
||
License | ||
------- | ||
|
||
Bowler is MIT licensed, as found in the `LICENSE` file. | ||
|
||
|
||
[PyPI]: https://pypi.org/p/bowler |
Oops, something went wrong.