Configurable Indent Levels? #378
Description
before lobbing a PR over, I wanted to spin up a quick discussion around adding an option to black to permit smoother interop with 2-space indent code bases.
At Twitter, we would like to experiment with adopting black as autofmt tooling in a few of our open source projects and potentially more widely across our internal monorepo. Our python code style is currently defined as such:
Python code style at Twitter closely follows PEP-8 and PEP-257 with the following modifications:
- Indent using two spaces (instead of four).
- Break lines at 100 characters or less.
we have on the order of many millions of lines of code that currently adopt this style and generally feel like it's a net improvement over 4 space indent (nested blocks can fit more code per line, etc etc). pants and pex are good concrete examples of projects that started at Twitter and were later open sourced with a continuation of this python code style.
I realize black is intended to be opinionated and have little to no config - but to me, line length and indent level both seem like a fairly fundamental configurable for most shops, so I'd put this in a very similar category as the existing --line-length option:
-l, --line-length INTEGER Where to wrap around. [default: 88]
with that said, how would folks feel about adding a new --indent-level={2|4} flag to black to permit easier interop for code bases that take this fundamental stance? I would be happy to cut a PR that implements this as long as there's consensus that this would be reasonable.