9

Opened a ticket with AutoPep8, but when I installed the autopep8 extension, it doesn't seem to find the module. When I change the config to tell it where it is a format doesn't do anything. Formating in terminal does however. Any ideas? https://github.com/hhatto/autopep8/issues/349#issuecomment-335662565

Parth Sharma
  • 441
  • 4
  • 19
Dan Quackenbush
  • 123
  • 1
  • 1
  • 6

3 Answers3

10

Install the below python packages for Python Code Format supporting in Windows

pip install autopep8

pip install pylint

Once you have successfully installed the packages, Open the code in vs code -> Press Ctrl + A and Ctrl + K, it will format the code.

Dhandapani Sudhakar
  • 305
  • 1
  • 4
  • 16
6

autopep8 is listed as a requirement. On mac, using brew, you can install it as follows:

brew install autopep8
Sybrand
  • 766
  • 1
  • 6
  • 6
  • The other [answer](https://stackoverflow.com/a/60880116/1705829) recommends `pylint`, is it needed for Mac to autoformat code? – Timo Sep 22 '22 at 06:55
2

you should try black.

pip install black

and then open the auto format option in vscode when save and modify the python format provider to black in vscode settings. enjoy the black.

jiakai
  • 31
  • 4