neoglez / spyder-black-formatter

Spyder IDE plugin to format python files using black

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spyder IDE black formatter plugin

Description

Spyder IDE plugin to format code using black.

The source code in this repo is heavely inspired in the previous work make by others in this repo.

Installation

Using pip

pip install git+https://github.com/neoglez/spyder-black-formatter.git

Using conda (what I think it is the easiest way)

conda install conda-build
git clone https://github.com/neoglez/spyder-black-formatter.git
cd spyder-black-formatter/
conda develop .

Uninstall

Using pip

pip uninstall spyder_black_formatter

Using conda

cd /path/to/spyder-black-formatter/ # local repo from where it was installed
conda develop -u .

Usage

It is as easy as pressing "SHIFT+F5" and the active file in the editor will be formatted.

Here you have your code:

imgs/01-Spyder_file_before.png

If you want to setup the way black will format your code you should go to "Tools > Preferences":

imgs/02-Spyder_go_to_plugin_setup.png

And the following window will pop up:

imgs/03-Spyder_plugin_setup.png

Once it is done you can press "SHIFT+F5" or go to "Source code > Format code using black":

imgs/04-Spyder_run_black_formatter.png

After that the source code of the active window in the editor should be formatted with your preferences:

imgs/05-Spyder_file_after.png

License

MIT (see License.txt in this repository).

About

Spyder IDE plugin to format python files using black

License:MIT License


Languages

Language:Python 100.0%