REST API to format python code.
# if pipenv is not installed yet
pip install pipenv
# force pipenv to create .venv in the current directory
export PIPENV_VENV_IN_PROJECT=1
# install dependencies
pipenv install
# run the app
python run.py
docker-compose up
see examples.
import requests
code = """
a=1+2*3/4
def foo():
pass
"""
params = {
'code': code,
'indent_size': 2
}
url = 'https://pyformatter.com/api/format'
resp = requests.get(url, params)
print(resp.json()['code'])
The output looks like:
a = 1 + 2 * 3 / 4
def foo():
pass
flake8 -v
python -m pytest
- Add an option which allows users to choose a code formatter. The current version only supports
autopep8
.