Did some checks with black - with default configuration (the only one that really counts in black) I ran:
black $(find . -name \*.py)
2035 files reformatted, 232 files left unchanged, 6 files failed to reformat.
git diffstat for that:
2035 files changed, 124430 insertions(+), 97959 deletions(-)
so that’s a lot of churn, let’s try black but with two spaces instead (there are no configuration options in black to set the indent, so you actually have to install another tool (black) that monkey patches that into black… sigh)
2078 files reformatted, 189 files left unchanged, 6 files failed to reformat.
diff stat:
2072 files changed, 221808 insertions(+), 201602 deletions(-)
so it would seem like 4 spaces are the more common indent style in our tree.
What about the files that couldn’t be parsed? One file seems to have out right parse error:
error: cannot format llvm/utils/lit/tests/shtest-encoding.py: 'utf-8' codec can't decode byte 0xc2 in position 69: invalid continuation byte
Aha, that file has an INTENTIONAL parse error 
5 files are still using python 2 syntax:
error: cannot format polly/utils/pyscop/jscop2iscc.py: Cannot parse: 12:8: print "D :=",
Python 2 support was removed in version 22.0.
error: cannot format polly/utils/jscop2cloog.py: Cannot parse: 53:8: print template % (context, domains, schedules)
Python 2 support was removed in version 22.0.
error: cannot format compiler-rt/lib/dfsan/scripts/build-libc-list.py: Cannot parse: 92:8: print 'fun:%s=uninstrumented' % f
Python 2 support was removed in version 22.0.
error: cannot format polly/lib/External/isl/imath/tools/findthreshold.py: Cannot parse: 89:14: print "%d\t%d\t%.3f\t%.3f\t%.4f" % (prec, thresh, trec, tnorm,
Python 2 support was removed in version 22.0.
error: cannot format openmp/runtime/tools/summarizeStats.py: Cannot parse: 146:14: print "Cannot open " + fname
Python 2 support was removed in version 22.0.
So those needs to be fixed, in any case.
I also tried yapf with --style=pep8
and it seems way less picky:
1861 files changed, 75453 insertions(+), 62234 deletions(-)
Quickly looking at the files I still prefer black
over yapf
- but I don’t care that much, the important part is that we have a standard tool and that we enforce it - similar to what people have said above.