Skip to content

Instantly share code, notes, and snippets.

@bryanlimy
Last active October 12, 2024 06:21
Show Gist options
  • Save bryanlimy/236c3ba05d2c45c07365166e0fe4fe9f to your computer and use it in GitHub Desktop.
Save bryanlimy/236c3ba05d2c45c07365166e0fe4fe9f to your computer and use it in GitHub Desktop.
YAPF in PyCharm

This little step-by-step guide show you how to setup YAPF formatting in PyCharm.

  1. Install yapf using pip
    pip install yapf
    
  2. Make sure the YAPF formatting file .style.yapf exists in the root folder of your codebase.
  3. Setup YAPF as External Tools in PyCharm.
    • PyCharm -> Preferences -> Tools -> External Tools
  4. Setup File Watchers in PyCharm to apply YAPF settings on file save.
    • PyCharm -> Preferences -> Tools -> File Watchers
  5. Done.

Note: you can use the command which yapf to get the path of yapf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment