Skip to main content

pyproject-autoflake (pautoflake), a monkey patching wrapper to connect autoflake with pyproject.toml configuration.

Project description

pyproject-autoflake

pyproject-autoflake (pautoflake), a monkey patching wrapper to connect autoflake with pyproject.toml configuration.

Motivation

The original autoflake does not support configuration files such as pyproject.toml. This is slightly inconvenient for modern Python development.

pautoflake is a thin wrapper library that calls autoflake with a configuration read from pyproject.toml.

pyproject-autoflake is inspired by pyproject-flake8. Many thanks! 😉

Installation

pip

pip install pyproject-autoflake

poetry

poetry add -D pyproject-autoflake

Usage

At first, you add [tool.autoflake] in your pyproject.toml.

# pyproject.toml

...

[tool.autoflake]
# return error code if changes are needed
check = false
# make changes to files instead of printing diffs
in-place = true
# drill down directories recursively
recursive = true
# exclude file/directory names that match these comma-separated globs
exclude = "<GLOBS>"
# by default, only unused standard library imports are removed; specify a comma-separated list of additional
# modules/packages
imports = "<IMPORTS>"
# expand wildcard star imports with undefined names; this only triggers if there is only one star import in
# the file; this is skipped if there are any uses of `__all__` or `del` in the file
expand-star-imports = true
# remove all unused imports (not just those from the standard library)
remove-all-unused-imports = true
# exclude __init__.py when removing unused imports
ignore-init-module-imports = true
# remove all duplicate keys in objects
remove-duplicate-keys = true
# remove unused variables
remove-unused-variables = true
# print more verbose logs (larger numbers are more verbose)
verbose = 0

...

Second, you call pautoflake.

pautoflake sample.py

License

MIT License

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

pyproject-autoflake-0.3.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyproject_autoflake-0.3.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file pyproject-autoflake-0.3.0.tar.gz.

File metadata

  • Download URL: pyproject-autoflake-0.3.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.6.15 Linux/5.11.0-1022-azure

File hashes

Hashes for pyproject-autoflake-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4c0aa1582f2b4cde0dc266cfec213ade4f81f1cd18a1067155a9211dfb59246e
MD5 993cd9049801610ca1d00a42e2f7fecd
BLAKE2b-256 3614b3ab8d937803d879256d57d83df10b8983d79d247ea62e01f88b52eef37c

See more details on using hashes here.

File details

Details for the file pyproject_autoflake-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyproject_autoflake-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.6.15 Linux/5.11.0-1022-azure

File hashes

Hashes for pyproject_autoflake-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 79ce3c650c9d50592b25aebd3b603b02cdaabb1d5c7a059100eda514100721c1
MD5 8a88b552c7633e6cdd76988da4776268
BLAKE2b-256 0de9402e9d346efce85e7c9fbc00db5b3aeaeee60188454acaa00d44756e7306

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page