DEV Community

Robert Rees for We Got POP

Posted on

1

Getting Black and isort to agree on formatting

We have been using Black for a while to standardise our code formatting and reduce unproductive time in code reviews discussing syntax.

When we introduced it we had disabled our isort formatting due to an issue but when it came time to reintroduce it I found that black and isort were engaged in a formatting war both trying to change the formatting of a few files whenever they were run.

isort now has some advice on compatibility that wasn't available at the time (and which as a result I haven't tried).

This is the configuration file I ended up using for our code.

[settings]
line_length=88
multi_line_output=3
include_trailing_comma=True
use_parentheses=True
view raw isort.cfg hosted with ❤ by GitHub

Automated code formatting has been a massively time saver in terms of code review and consistency across the codebase. If you're not already doing it then it is definitely one of the better new year resolutions you could make.

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay