# general


09/25/2019, 12:17 PM
Hey pants community, I’d like to fix a workflow pain I’ve had since started working on pants recently: The python code isn’t automatically formatted, yet our pre_commit hook complains for some formatting issues, leaving the programmer with no other option than manually formatting their code like an animal. Another minor issue I have is that our formatting isn’t very consistent across files, and even within files in some places. I think the solution for this problem is to use a tool to automatically format our code, run it now and commit that and add it to the pre_commit hook to avoid regressions in the future. This way, developers can add that tool to their text editor/IDE if they want to and never think of it again; and we all enjoy a consistently formatted codebase. Assuming everything makes sense so far, the next step is to decide which tool to use and which settings. From a bit of research, the two main contenders seem to be: • yapf ( <- quite flexible in the way it’s configured • Black ( <- more opinionated
❤️ 1