Darker is a Python command-line tool for teams that want to adopt consistent formatting in an existing codebase without reformatting everything at once.
It compares revisions in a Git repository, or works in a plain directory, and applies formatting only to code regions that have changed. Darker is aimed at incremental style cleanup for ongoing projects, and it can also combine formatting with import sorting, syntax modernization, and other related tooling.
This is free and open source software.
Key Features
- Reformats only the modified regions of Python files instead of rewriting the whole file.
- Supports Black and the Ruff formatter for code formatting.
- Can also run isort, flynt, and pyupgrade as part of the workflow.
- Works in Git repositories and can also be used in plain directories.
- Integrates with pre-commit, GitHub Actions, and editor workflows such as PyCharm, IntelliJ IDEA, and Visual Studio Code.
- Checks that reformatted output preserves the original abstract syntax tree, helping avoid unsafe rewrites.
Website: github.com/akaihola/darker
Support:
Developer: Antti Kaihola
License: BSD 3-Clause License
Darker is written in Python. Learn Python with our recommended free books and free tutorials.
Related Software
| Python Code Formatters | |
|---|---|
| YAPF | Python formatter based on clang-format |
| Black | Uncompromising Python code formatter |
| isort | Python utility and library to sort imports |
| autopep8 | Formats Python code to conform to the PEP 8 style guide |
| blue | Somewhat less uncompromising code formatter than black |
| eradicate | Remove commented-out code from Python files |
Read our verdict in the software roundup.
Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more. Discovered a useful open source Linux program that we haven’t covered yet? Let us know by completing this form. |

