Skip to main content

pyproject-autoflake

PyPI version Python Versions

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

Metadata

Release files for pyproject-autoflake 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyproject-autoflake 1.0.2
File Size Uploaded Provenance Actions
pyproject-autoflake-1.0.2.tar.gz 4.5 kB Without provenance Details for pyproject-autoflake-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyproject-autoflake 1.0.2
File Interpreter ABI Platform Actions
pyproject_autoflake-1.0.2-py3-none-any.whl Python 3 none any Details for pyproject_autoflake-1.0.2-py3-none-any.whl

Total release size: 9.5 kB

Release files / pyproject-autoflake-1.0.2.tar.gz

Download URL pyproject-autoflake-1.0.2.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7ad1ab8c8e522bd04f05728f2656935853288b7b974a47850174c6cf6cc378ad
BLAKE2b-256 checksum
How to use checksums
89ce85563b11e0ee67bd2ab7f374e6dd5a53aca6a039e0b5449b7dfddd779a13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.6.15 Linux/5.15.0-1014-azure

Release files / pyproject_autoflake-1.0.2-py3-none-any.whl

Download URL pyproject_autoflake-1.0.2-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db7220bec762cbc8cfe93f1d23f3a564d0c076529bc1ebafc2dcb023c5ee265c
BLAKE2b-256 checksum
How to use checksums
b8d67494a533baef27a6b43227ea5a264c249bd654e271f9c95920bd04805385
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.6.15 Linux/5.15.0-1014-azure

Security for pyproject-autoflake 1.0.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page