Skip to content
/ Prettify Public

Zsh script to linter and format your python project

License

Notifications You must be signed in to change notification settings

whyh/Prettify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prettify

Zsh script to linter and format your python project

What it does

Formats and checks your python code with

  • autoflake
  • isort
  • black
  • flake8
  • mypy
    in this order

You can execute script on python file or a directory, to prettify all files in it

It will load config from the configuration file in the running directory and falls back to the default when can't find one

Please note that black and autoflake do not support setup.cfg. Instead you can modify their running options here

Initial Setup

pip install autoflake black flake8 isort mypy

Change DEFAULT_CONFIG_PATH to your's default setup.cfg here
Here is an example of the default setup.cfg

How to run

Make sure CONFIG_PATH is pointing to project setup.cfg here if your project has one. By default it will look for setup.cfg in the running directory

Make sure VENV_PATH is pointing to project virtual environment folder here. By default it point to venv in the running directory. This is important for isort

CLI

python prettify.py <path_to_file_or_directory>

PyCharm external tool

Configure your external tool the following way

Now select file/folder in the project view or start editing a file, open right mouse klick menue and choose prettify

PyCharm shortcut

Configure your shortcut the following way

Now select any file/folder in the project view, or start editing a file and press the shortcut on your keyboard

About

Zsh script to linter and format your python project

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages