# PFA (Python Fast Autoformat)
An autoformatter should be three things:
Fast: Run quickly so that you can afford to run the autoformatter on a large code base without ever having to wait for the autoformat to complete.
Consistent: Running the autoformatter a second time won’t change the output. Code will run the same before and after the autoformatter is run. Trivial whitespace changes will be reverted.
Pretty: Output looks nice and preferably follows PEP8.
PFA chooses to be Fast and Consistent, but sacrifices Pretty output in favor of speed.
## Installation and Usage
To create the executable file pfa, run
make
Afterwards you can copy it into PATH, say to /usr/bin or ~/bin/.
There are two ways to run the program. If the executable file name does not end in “i”, i.e. with
pfa that_python_script.py
then the formatted file will be dumped to standard output. If you make a symlink from pfa to pfai and run the latter like
pfai that_python_script.py scriptus_secundus.py
then all files listed as arguments will be formatted in place.
## FAQ
Why is PFA written in C? The startup time for the Python interpreter is often longer than it takes to run pfa on a 2000 line file.
How fast is it? The other popular Python formatters are yapf and autopep8. Formatting about 120KB of python code in place for the second time in a row with the following commands,
yapf -i bx.py autopep8 -i bx.py pfai bx.py
one finds that yapf takes 14.0 seconds; autopep8 takes 1.8 seconds; and pfai completes in 0.020 seconds, less than the time it takes to press Enter.
I have a change to contribute. Will it be accepted?: Yes, as long as pfa still runs in O(n) for even pathological input.
Metadata
Release files for pfa 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pfa-0.4.tar.gz | 18.2 kB | Without provenance | Details |
Release files / pfa-0.4.tar.gz
| Download URL | pfa-0.4.tar.gz |
|---|---|
| Size | 18.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33cae38ccec9af912c9018a0456636a0467d2df8043dd6b0d22d113f31b83bf7
|
|
BLAKE2b-256 checksum How to use checksums |
c1ae0a32a94d7ebd8c2b0f6053e7a620090e0f1187edf1206a3bd30feda055ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pfa 0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.