Skip to main content

A Python source formatter that uses the tokenize library to ensure correctness

Project description

Introduction

Test Status Coverage Status

formatter2 is a Python formatter based on the tokenize library in Python. Due to a bug with line continuations we are currently running a fork of the tokenize library however.

During every format sequence the compile method is used to check if no code has been broken, but backing up is still a good idea.

The library is made to be very extendable and configurable but it’s still in the beginning phase. Eventually this will become a fully featured formatting tool for Python.

Install

To install simply execute python setup.py install or pip install formatter2. If you want to run the tests first, run nosetests

Usage

To format all of your code recursively (MAKE BACKUPS!):

python-formatter -r DIRECTORY

Or:

format-python -r DIRECTORY

Formatting stdin is also possible:

cat some_python_file.py | format-python - > some_formatted_file.py

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

formatter2-1.2.2.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

formatter2-1.2.2-py2.py3-none-any.whl (25.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file formatter2-1.2.2.tar.gz.

File metadata

  • Download URL: formatter2-1.2.2.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for formatter2-1.2.2.tar.gz
Algorithm Hash digest
SHA256 3d4510a3f0629a214c2c601072d785398b3b83b42605df55a471aa21de94a637
MD5 8b8d7371770c4de3431d2e7d2769bd03
BLAKE2b-256 d93339826386ee1f3f4157bdb8ddf814a0faea2984f636cee142bbbbb1768382

See more details on using hashes here.

File details

Details for the file formatter2-1.2.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for formatter2-1.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5a3108e619c4291e5075078bef0f39b1861c6543b23d21a3685eff835a90672f
MD5 87a43b6ca0da2d28536b1ca9aac3101a
BLAKE2b-256 8232e2bc418d64c007b4a11d435bf9a35ff2e7ee11c57382e50f6b6b3f5405f1

See more details on using hashes here.

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