--- id: darker version: "3.0.0" license: BSD license_treatment: permissive maintenance: aging --- # darker — Apply Black formatting only in regions changed since last commit License: permissive · Maintenance: aging · Downloads: 219.7K/mo ## What it is and what it does Darker is a Git-aware Python code formatter that applies reformatting selectively to only the lines you've changed since a prior commit or revision. It sits between your version control system and formatters like Black or Ruff, solving the problem of introducing formatting-only commits that clutter history and blame attribution. Instead of reformatting an entire codebase in one giant commit, you can reformat incrementally as you touch code for other reasons—useful when adopting a new style in an existing project or contributing to upstream codebases you don't fully control. The package wraps multiple formatting tools (Black, Ruff formatter, isort for imports, flynt for f-string conversion, and pyupgrade for syntax upgrades) and applies them only to Git-detected changes. It compares the working tree against a baseline revision, identifies which lines have been modified, and reformats only those regions. As of version 3.0.0, Black is no longer bundled by default; you install formatters as optional dependencies. The tool runs as a command-line utility or Python module and integrates with pre-commit hooks and pytest plugins. Use it for: - Gradually adopt Black or Ruff formatting in an existing codebase without a single massive reformatting commit. - Contribute to upstream projects with different style standards by formatting only your own changes. - Combine import sorting (isort) and f-string conversion (flynt) with selective code formatting on modified lines. - Integrate formatting into CI/CD to enforce style only on new or changed code, not the entire repository. - Use as a pre-commit hook to automatically format only the lines you've edited before committing. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Darker reformats Python source code in Git repositories, but only applies changes to regions that have been modified since a specified revision, using Black, Ruff, isort, flynt, or pyupgrade as the underlying formatter. Yes, if you need selective code formatting in a Git workflow. The low install friction, permissive license, and stable maintenance make it a practical choice for teams adopting formatters incrementally. Skip it if you prefer whole-codebase reformatting or are starting a project from scratch—use Black or Ruff directly instead. The 347-day gap since last release is not a red flag given the repository's continued activity and clear scope, but verify that the aging status doesn't signal reduced support for your specific use case. ## Install pip install darker uv add darker poetry add darker ## Installing darker Before you install: Low friction install with three lightweight runtime dependencies (darkgraylib, toml, typing_extensions). The package is aging—last release was 347 days ago—but the repository remains active and well-starred (685 stars), suggesting stable maintenance rather than abandonment. License in practice: BSD permissive license places no restrictions on use, modification, or distribution in commercial or proprietary projects. Quickstart: pip install darker # In a Git repository with modified Python files: darkr our_file.py # Or with a specific formatter: python -m darker --formatter=ruff our_file.py Requires a Git repository; Black is no longer installed by default as of version 3.0.0, so you must install an optional formatter (black, ruff, pyupgrade, or none) separately if you want code reformatting beyond import sorting or string conversion. Verify before relying: - Whether the aging maintenance status (347 days since last release) signals reduced development or stable maturity for this use case. - Performance characteristics when run on large codebases with many modified regions. ## Package facts - License: BSD (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 219.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags partial code formatting git, reformat only changed lines, black on modified code, selective python formatting, git-aware code reformatter, format changed regions only, incremental code style, git-aware, incremental-formatting, code-quality [View on SkillFed](https://skillfed.io/packages/darker) · [View on PyPI](https://pypi.org/project/darker/)