black is an auto formatter that the community seems to be converging around (pandas, numpy and scikit adopted it; heck it's even hosted on python's github homepage)..
I've heard about black for a while but now mne is using it so i've got a first hand look. Here's my take:
Benefits:
increases char limit from 79 to 90 (which is SO nice. 79 characters just doesn't help anybody anymore...).
automatically formats your code for you (very opinionated).
downsides:
automatically formats your code for you (very opinionated).
Sometimes I prefer the way I style my code only to have black automatically reformat it according to it's ethos, but honestly I can live with that, because, it's so consistent and I don't have to worry about fixing flakes.
Overall I'm +1 on switching to black and using a pre-commit hook so that that flakes are caught/fixed before a PR is ever opened (No more CI's yelling at me because I forgot to format something correctly).
We are a small project so I wasn't super pressed to switch to black, but right now in my VScode I have to turn black on and off when I switch between mne and pylossless (otherwise black would automatically format my pylossless files when I save them.).. So i'm tempted to push us to switch to black now so that I don't have to turn it off and on ; )
I can volunteer to set it up and help format our current files to black standard now so others don't have to.
black is an auto formatter that the community seems to be converging around (
pandas
,numpy
andscikit
adopted it; heck it's even hosted on python's github homepage)..I've heard about
black
for a while but nowmne
is using it so i've got a first hand look. Here's my take:Benefits:
downsides:
Sometimes I prefer the way I style my code only to have black automatically reformat it according to it's ethos, but honestly I can live with that, because, it's so consistent and I don't have to worry about fixing flakes.
Overall I'm +1 on switching to black and using a
pre-commit hook
so that that flakes are caught/fixed before a PR is ever opened (No more CI's yelling at me because I forgot to format something correctly).We are a small project so I wasn't super pressed to switch to
black
, but right now in my VScode I have to turnblack
on and off when I switch betweenmne
andpylossless
(otherwiseblack
would automatically format my pylossless files when I save them.).. So i'm tempted to push us to switch toblack
now so that I don't have to turn it off and on ; )I can volunteer to set it up and help format our current files to
black
standard now so others don't have to.