autopep8

Format Python code according to the PEP 8 style guide. More information: <https://github.com/hhatto/autopep8>.

Install

All systems
curl cmd.cat/autopep8.sh
Debian Debian
apt-get install python-autopep8
Ubuntu
apt-get install python-autopep8
Arch Arch Linux
pacman -S autopep8
image/svg+xml Kali Linux
apt-get install python-autopep8
Fedora
dnf install python-autopep8
Windows (WSL2)
sudo apt-get update sudo apt-get install python-autopep8
OS X
brew install autopep8
Raspbian
apt-get install python-autopep8

Format Python code according to the PEP 8 style guide. More information: <https://github.com/hhatto/autopep8>.

  • Format a file to `stdout`, with a custom maximum line length:
    autopep8 path/to/file.py --max-line-length length
  • Format a file, displaying a diff of the changes:
    autopep8 --diff path/to/file
  • Format a file in-place and save the changes:
    autopep8 --in-place path/to/file.py
  • Recursively format all files in a directory in-place and save changes:
    autopep8 --in-place --recursive path/to/directory

© tl;dr; authors and contributors