Skip to main content

Run several python fixers over a python file, to provide simple, deterministic code formatting.

Project description

PyFixFmt

Your all-in-one python formatter. Able to be called on files or strings to format and standarize a Python file.

Removes unused imports (with autoflake), sorts imports (with isort), and then formats the code (with black). It will respect your project's pyproject.toml configuration for those tools.

Meant to make formatting of python code as deterministic as sanely possible.

Instructions

To install:

pip install pyfixfmt

To run:

# file-glob can be either a single file name or a normal unix glob.
python -m pyfixfmt --file-glob <your file glob here> --verbose

Configuration:

# in pyproject.toml
[tool.formatters.python]
# Do not change anything about imports in these files
ignore_import_changes = []
# Do not remove imports that are unused in these files
do_not_remove_imports = []

Developing

Develop with Poetry.

Build with poetry build, and publish with poetry publish.

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

pyfixfmt-0.9.2.tar.gz (4.2 kB view hashes)

Uploaded source

Built Distribution

pyfixfmt-0.9.2-py3-none-any.whl (4.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page