Context: during a discussion at Infrastructure Foundations team meeting the subject of tools automatically (re)formatting Python code came up.
This task is to track the rationale for having such tools for (new) Python code and implementation.
Pros:
- Authors don't have to think about code formatting
- Code formatting comments no longer required during code reviews
- Code readability is the same across authors
Cons:
- Local setup needed: formatter installation and editor integration at least
- Similar setup needed for integration with CI to fail if code isn't formatted as required
- If/when the code formatter output changes e.g. across upgrades we'll have to adjust for that
Open questions:
- Which formatter(s) to use?
- Require standard formatting for old and new code or only new or a mix depending on the codebase?
- How much local setup is needed depending on the formatter(s) and the editor(s)?
- Likely other questions