DEV Community

Iacopo Spalletti
Iacopo Spalletti

Posted on • Originally published at sleepy.yaks.industries

TIL - 🧹 unimport linter formatter

Thanks to this Jeff Triplets tweet I discovered unimport, which is an interesting tool to detect unused imports (like flake8 would do) and to remove them from the code.

And the cherry on top it's that it can scan the requirements file and detect unused dependencies (which is probably even more important).

Historically this has not been a problem for me (or Nephila team), as flake8 is already well ingrained in our workflow, so we are used to handle code cleanup before committing.

But as I sometimes inherit a large codebase with messy code, and it's awesome how much you can achieve with the right tools.

Currently isort + black + pyupgrade already do a really good job, but adding unimport to the equation is πŸ’₯: a much nicer codebase with zero effort

I will surely give it a more in depth test, and I might add to my linting reference toolbox.

Shootout to Hakan Γ‡elik for this package, and its awesome documentation.

Top comments (0)