DOKK / manpages / debian 12 / autoflake / autoflake.1.en
autoflake(1) General Commands Manual autoflake(1)

autoflake - removes unused imports and unused variables in Python code

autoflake [-h] [-c | -cd] [--imports IMPORTS | --remove-all-unused-imports] [-r] [-j n] [--exclude globs] [--expand-star-imports] [--ignore-init-module-imports] [--remove-duplicate-keys] [--remove-unused-variables] [--remove-rhs-for-unused-variables] [--ignore-pass-statements] [--ignore-pass-after-docstring] [--version] [--quiet] [-v] [--stdin-display-name STDIN_DISPLAY_NAME] [--config CONFIG_FILE] [-i | -s] files [files ...]

Removes unused imports and unused variables as reported by pyflakes.

files to format

return error code if changes are needed

return error code if changes are needed, also display file diffs

by default, only unused standard library imports are removed; specify a comma-
separated list of additional modules/packages

remove all unused imports (not just those from the standard library)

drill down directories recursively

number of parallel jobs; match CPU count if value is 0 (default: 0)

exclude file/directory names that match these comma-separated globs

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

exclude __init__.py when removing unused imports

remove all duplicate keys in objects

remove unused variables

remove RHS of statements when removing unused variables (unsafe)

ignore all pass statements

ignore pass statements after a newline ending on '"""'

show program's version number and exit

Suppress output if there are no issues

print more verbose logs (you can repeat `-v` to make it more verbose)

the name used when processing input from stdin

Explicitly set the config file instead of auto determining based on file
location

make changes to files instead of printing diffs

print changed text to stdout. defaults to true when formatting stdin, or to
false otherwise

autoflake was written by Steven Myint <git@stevenmyint.com>.

The latest version of autoflake may be downloaded from https://github.com/PyCQA/autoflake

Manual