AUTOFLAKE(1)

πŸ“¦
version 2.3.3 Β· 4 versions
, in ubuntu stonking

✨ AUTO FLAKE ✨ (that's AUTOFLAKE(1) bestie, a generated Python manual, and no it's not about cereal)

okay so picture this: your Python file is a mess, you've got imports you literally never use, variables that just vibe there doing nothing, and pyflakes is staring at you πŸ‘€. autoflake is the friend who comes over, opens the closet, and goes "girl. we're getting rid of this." it's a whole glow-up for your code and honestly? iconic. πŸ’…


πŸŽ€ NAME πŸŽ€

autoflake β€” removes unused imports and unused variables in Python code.

periodt.


πŸ¦‹ SYNOPSIS πŸ¦‹

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 ...]

files  files to format

so basically: files is where you point it, and everything else is optional seasoning ✨


🌸 DESCRIPTION 🌸

autoflake removes unused imports and unused variables, based on what pyflakes reports. that's it. that's the whole gig. it reads what pyflakes is yelling about and then quietly, calmly, does the deleting for you πŸ§ΉπŸ¦‹


πŸ’– OPTIONS πŸ’–

  • -c, --check β€” don't fix anything, just snitch: returns an error code if changes are needed πŸ‘€
  • -cd, --check-diff β€” same snitching energy, but it also shows you the file diffs so you can see exactly what it would change πŸ”
  • --imports IMPORTS β€” by default it only yeets unused imports that come from the standard library. wanna include more? pass a comma-separated list of extra modules/packages and it'll consider those too πŸ’«
  • --remove-all-unused-imports β€” listen, be brave: remove ALL unused imports, not just the standard library ones πŸ”₯
  • -r, --recursive β€” drill down through directories recursively, like a girl who checks every last drawer πŸ—„οΈπŸ’…
  • -j n, --jobs n β€” number of parallel jobs; if the value is 0 it matches your CPU count (default: 0) ⚑
  • --exclude globs β€” skip any file/directory names matching these comma-separated globs. not today, not ever 🚫
  • --expand-star-imports β€” expands wildcard star imports using the undefined names. important caveats, bestie: this only triggers if there's only one star import in the file, and it's skipped entirely if the file uses __all__ or del anywhere 🌟
  • --ignore-init-module-imports β€” leave __init__.py out of the unused-import cleanup πŸ›‘οΈ
  • --remove-duplicate-keys β€” removes all duplicate keys in objects πŸ”
  • --remove-unused-variables β€” removes unused variables πŸ«₯
  • --remove-rhs-for-unused-variables β€” removes the RHS of statements when removing unused variables. ⚠️ this one is unsafe, fr fr β€” say it with me, UN-SAFE ⚠️
  • --ignore-pass-statements β€” ignores all pass statements πŸ™ˆ
  • --ignore-pass-after-docstring β€” ignores pass statements that come after a newline ending on '"""' πŸŽ€
  • --version β€” shows the program's version number and exits, like a little name-drop πŸ‘‘
  • --quiet β€” suppresses output if there are no issues. if nothing's wrong, we don't need the commentary 🀫
  • -v, --verbose β€” prints more verbose logs. and yes you can repeat -v to make it even more verbose, stack them like little gossip levels πŸ—£οΈ
  • --stdin-display-name STDIN_DISPLAY_NAME β€” the name used when processing input from stdin 🏷️
  • --config CONFIG_FILE β€” explicitly set the config file instead of auto-determining it based on file location πŸ“
  • -i, --in-place β€” actually makes the changes to your files instead of printing diffs. commit. πŸ’…
  • -s, --stdout β€” prints the changed text to stdout. it defaults to true when formatting stdin, and to false otherwise 🌈

πŸ‘‘ AUTHOR πŸ‘‘

Steven Myint β€” git@stevenmyint.com πŸ’Œ


🌐 DISTRIBUTION 🌐

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


okay that's the whole page bestie, and that's on autoflake, generated Python manual, from 2026-02-20 β€” go forth and delete some unused imports, you absolute icon βœ¨πŸ’–πŸŽ€πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from