Archive for May, 2021

Black – the code formatter

Posted on: May 25th, 2021 by Olu No Comments

Hi folks,

In this post I’ll talk about a very interesting tool called Black. Once upon a time, I was tasked with writing Python software with a few other developers. We came from different backgrounds and thus had very different styles of writing code. There was a broad mix of code writing styles and believe me, the code was a thing to behold. But we decided to just play along and let everyone be and allow “diversity” of code styles. It wasn’t very pretty but we lived with it.

Some months later I found myself reading through the codebase of a Python project and discovered a very interesting tool called Black. The software is described by its authors as The Uncompromising Code Formatter. Once I discovered what it does I realized that this is a tool that would have solved the problem I described earlier. Black formats Python code so that it looks neat consistent. That way, developers don’t have to bicker over poor code format. This also allows developers to focus more on content and less on formatting.

I highly recommend using Black as a code formatter if working on Python in a team setting. You can install Black from PyPi using pip. Click here to go to the project’s Github home page.

That’s all for now. Happy software development.