When you work in the team, everyone has slightly different way to format their code. Setting up code standards from the beginning and enforcing them through automatic code formatting provides clarity of code, reduced source control diffs and makes code reviews more efficient.

I typically use Black code formatter but there are other ones, like yapf and autopep8. All of them integrate with most of IDEs and can be run as pre-commit and in the CI/CD pipeline. They also can be configured to your team’s preferences, if for example you don’t like each line to be at most 80 characters.


If you like what I write, consider subscribing to my newsletter, where I share weekly practical AI tips, write my about thoughts on AI and experiments.


This article reflects my personal views and opinions only, which may be different from the companies and employers that I am associated with.