Python YAPF Help



Does anyone know what should be place inside “Custom Code Formatter” when using YAPF?

I tried ““python.formatting.yapfArgs”: [”–style", “{based_on_style: chromium, indent_width: 20}”]" but that’s not working.



I had the same problem

lil afraid it is to late to reply this, but sharing for anyone who is looking for this

I got a hint in the Github readme in yapf project :slight_smile:


Note that if you intend to use YAPF as a command-line tool rather than as a library, installation is not necessary. YAPF supports being run as a directory by the Python interpreter. If you cloned/unzipped YAPF into DIR, it’s possible to run:

$ PYTHONPATH=DIR python DIR/yapf [options] …

I cloned the project in home directory(~/yapf) and manually gave a path to it

so the DIR variable for me is “/home/ubuntu/yapf” and my command is like this :

PYTHONPATH=/home/ubuntu/yapf python3.6 /home/ubuntu/yapf/yapf -i “$file”

enjoy coding!