Link Search Menu Expand Document


Remove unused imports and variables from Python code. More information:

  • Remove unused variables from a single file and display the diff:

autoflake --remove-unused-variables {{path/to/}}

  • Remove unused imports from multiple files and display the diffs:

autoflake --remove-all-unused-imports {{path/to/ path/to/ ...}}

  • Remove unused variables from a file, overwriting the file:

autoflake --remove-unused-variables --in-place {{path/to/}}

  • Remove unused variables recursively from all files in a directory, overwriting each file:

autoflake --remove-unused-variables --in-place --recursive {{path/to/directory}}