Change Python code formatter from yapf to Black
During some discussions at Tiger Team meetings I have proposed changing from the yapf auto-formatter to the Black auto-formatter.
Personally, I have used Black in all my other projects and I prefer the alignment/styling, and @timothyfrank.davies and I do have a preference for a slightly longer line length (+10%).
Given auto-formatter selection is primarily subjective and the main developers (us) have a preference for Black over yapf, we would like to push to make this change in the future.
I recommend that after the 4th July review we do a self-contained auto-formatter change where we do an injection test, run the Black auto-formatter, then re-run the injection test, to minimise any problems the reviewers might have with changing a large number of files at once.
Additionally, this is also motivated by some problems where our yapf formatter was not automatically correcting Python2.7 strings formatted with %
characters that also had line-breaks - running yapf -i --style pep8 <file>
would run successfully with no suggested alterations (i.e. silently break?) but then our gitlab runner would error when running yapf-diff. The fix was to manually add in backslashes after yapf would silently error, which is unacceptable. See pipeline history for !46 (merged).
Edit: also see this broken commit followed by this successful commit in !47 (closed).