I use Anaconda's Spyder for some visualization. Got used to code formatter called black when I code in Notepad++. Unfortunately, I don't know to use black with Spyder. Does anyone know?
Asked
Active
Viewed 4,943 times
8
-
Check this question https://stackoverflow.com/questions/40595961/how-to-change-the-spyder-editor-background-to-dark hope it helps – TavoGLC Apr 15 '19 at 22:37
-
1My question has nothing to do with background colour but with formatter black: https://black.readthedocs.io/en/stable/ – MiloshB Apr 15 '19 at 23:08
2 Answers
14
Since Spyder 4.2, there's support for black built in, though it was set to autopep8 by default for me.
To enable black, go to Tools -> Preferences -> Completion and Linting -> Code Style and Formatting
Under code formatting dropdown, select black
Then, you can use the default shortcut Ctrl + Alt + i or click the format dropdown under source tab to format a selection or the entire file.

Paritosh Singh
- 6,034
- 2
- 14
- 33
9
(Spyder maintainer here) We'll add an option to use the Black formatter in our next version, Spyder 4.2, to be released in November of 2020.
Unfortunately, there's nothing we can do about it for our current version (4.1.5), sorry.

Carlos Cordoba
- 33,273
- 10
- 95
- 124
-
-
-
It would be nice to update this answer now that Spyder 4 has been released. Can Black be easily used from Spyder 4? – paugier Jan 24 '20 at 05:36
-
2@paugier, we changed our mind and decided to add support for Black and other formatters for 4.2. – Carlos Cordoba Aug 14 '20 at 15:18
-
I think [this link](https://github.com/spyder-ide/spyder/pull/13295), or something better should be included in the answer, since now it is available and this question comes as a top search result. – Sayandip Dutta Feb 11 '21 at 21:55