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
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
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
python prettify.py <path_to_file_or_directory>
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
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