How to install Autopep8

12 July 2021

Two options to apply PEP8 format to your Python code.


Autopep8 on Visual Studio code

The first option is to install Autopep8 as an extension on VScode. With this extension, PEP8 format is applied to your current file.

  • How to install

On the left menu, go to extensions and search for Python-autopep8.

vs_extensions_menu

Click on install, et voilá. Ready to use!

  • How to run

Ctrl-Shift-P on Linux, or cmd-Shift-P on Mac to open the command palette. Then type Autopep8 and enter. You will see the changes immediately.

Note: Save the file before applying Autopep8.

Autopep8 via PIP

  • How to install

As simple as:

pip install autopep8

  • How to run

autopep8 --in-place --aggressive --aggressive <your_file.py>

Back to Top ↑