These features will be included in the next release:
- Add a CI workflow which verifies that the
darker --help
output inREADME.rst
is up to date. - Only run linters, security checks and package builds once in the CI build.
- Small simplification: It doesn't matter whether
isort
was run or not, only whether changes were made. - Refactor Black and
isort
file exclusions into one data structure.
darker --revision=a..b .
now works since the repository root is now always considered to have existed in all historical commits.- Ignore linter lines which refer to files outside the common root of paths on the
command line. Fixes a failure when Pylint notifies about obsolete options in
.pylintrc
. - For linting Darker's own code base, require Pylint 2.6.0 or newer. This avoids the
need to skip the obsolete
bad-continuation
check now removed from Pylint. - Fix linter output parsing for full Windows paths which include a drive letter.
1.5.0 - 2022-04-23
- The
--workers
/-W
option now specifies how many Darker jobs are used to process files in parallel to complete reformatting/linting faster. - Linters can now be installed and run in the GitHub Action using the
lint:
option. - Sort imports only if the range of modified lines overlaps with changes resulting from sorting the imports.
- Allow force enabling/disabling of syntax highlighting using the
color
option inpyproject.toml
, thePY_COLORS
andNO_COLOR
environment variables, and the--color
/--no-color
command line options. - Syntax highlighting is now enabled by default in the GitHub Action.
pytest>=6.2.0
now required for the test suite due to type hinting issues.
- Avoid memory leak from using
@lru_cache
on a method. - Handle files encoded with an encoding other than UTF-8 without an exception.
- The GitHub Action now handles missing
revision:
correctly. - Update
cachix/install-nix-action
tov17
to fix macOS build error. - Downgrade Python from 3.10 to 3.9 in the macOS NixOS build on GitHub due to a build error with Python 3.10.
- Darker now reads its own configuration from the file specified using
-c
/--config
, or in case a directory is specified, frompyproject.toml
inside that directory.
1.4.2 - 2022-03-12
- Document
isort
's requirement to be run in the same environment as the modules which are processed. - Document VSCode and
--lint
/-L
incompatibility in the README. - Guard against breaking changes in
isort
by testing against itsmain
branch in thetest-future
GitHub Workflow. release_tools/bump_version.py
script for incrementing version numbers and milestone numbers in various files when releasing.
- Fix NixOS builds when
pytest-darker
callspylint
. Needed to activate the virtualenv. - Allow more time to pass when checking file modification times in a unit test. Windows tests on GitHub are sometimes really slow.
- Multiline strings are now always reformatted completely even if just a part was modified by the user and reformatted by Black. This prevents the "back-and-forth indent" symptom.
1.4.1 - 2022-02-17
- Run tests on CI against Black
main
branch to get an early warning of incompatible changes which would break Darker. - Determine the commit range to check automatically in the GitHub Action.
- Improve GitHub Action documentation.
- Add Nix CI builds on Linux and macOS.
- Add a YAML linting workflow to the Darker repository.
- Updated Mypy to version 0.931.
- Guard against breaking changes in Black by testing against its
main
branch in thetest-future
GitHub Workflow.
- Consider
.py.tmp
as files which should be reformatted. This enables VSCode Format On Save. - Use the latest release of Darker instead of 1.3.2 in the GitHub Action.
1.4.0 - 2022-02-08
- Experimental GitHub Actions integration
- Consecutive lines of linter output are now separated by a blank line.
- Highlight linter output if Pygments is installed.
- Allow running Darker on plain directories in addition to Git repositories.
regex
module now always available for unit tests- Compatibility with NixOS. Keep
$PATH
intact so Git can be called. - Updated tests to pass on new Pygments versions
- Compatibility with Black 22.1
- Removed additional newline at the end of the file with the
--stdout
flag compared to without. - Handle isort file skip comment
#isort:file_skip
without an exception. - Fix compatibility with Pygments 2.11.2.
- Drop support for Python 3.6 which has reached end of life.
1.3.2 - 2021-10-28
- Linter failures now result in an exit value of 1, regardless of whether
--check
was used or not. This makes linting in Darker compatible withpre-commit
. - Declare Python 3.9 and 3.10 as supported in package metadata
- Run test build in a Python 3.10 environment on GitHub Actions
- Explanation in README about how to use
args:
in pre-commit configuration
.py.<hash>.tmp
files from VSCode are now correctly compared to corresponding.py
files in earlier revisions of the Git reposiotry- Honor exclusion patterns from Black configuration when choosing files to reformat.
This only applies when recursing directories specified on the command line, and only
affects Black reformatting, not
isort
or linters. --revision rev1...rev2
now actually applies reformatting and filters linter output to only lines modified compared to the common ancestor ofrev1
andrev2
- Relative paths are now resolved correctly when using the
--stdout
option - Downgrade to Flake8 version 3.x for Pytest compatibility. See tholo/pytest-flake8#81
1.3.1 - 2021-10-05
- Empty and all-whitespace files are now reformatted properly
- Darker now allows itself to modify files when called with
pre-commit -o HEAD
, but also emits a warning about this being an experimental feature - Mention Black's possible new line range formatting support in README
- Darker can now be used in a plain directory tree in addition to Git repositories
/foo $ darker --diff /bar/my-repo
now works: the current working directory can be in a different part of the directory hierarchy- An incompatible
isort
version now causes a short user-friendly error message - Improve bisect performance by not recomputing invariant data within bisect loop
1.3.0 - 2021-09-04
- Support for Black's
--skip-magic-trailing-comma
option darker --diff
output is now identical to that ofblack --diff
- The
-d
/--stdout
option outputs the reformatted contents of the single Python file provided on the command line. - Terminate with an error if non-existing files or directories are passed on the command
line. This also improves the error from misquoted parameters like
"--lint pylint"
. - Allow Git test case to run slower when checking file timestamps. CI can be slow.
- Fix compatibility with Black >= 21.7b1.dev9
- Show a simple one-line error instead of full traceback on some unexpected failures
- Skip reformatting files set to be excluded by Black in configuration files
- Ensure a full revision range
--revision <COMMIT_A>..<COMMIT_B>
where COMMIT_B is not:WORKTREE:
works too. - Hide fatal error from Git on stderr when
git show
doesn't find the file in rev1. This isn't fatal from Darker's point of view since it's a newly created file. - Use forward slash as the path separator when calling Git in Windows. At least
git show
andgit cat-file
fail when using backslashes.
1.2.4 - 2021-06-27
- Upgrade to and satisfy MyPy 0.910 by adding
types-toml
as a test dependency, andtypes-dataclasses
as well if running on Python 3.6. - Installation instructions in a Conda environment.
- Git-related commands in the test suite now ignore the user's
~/.gitconfig
. - Now works again even if
isort
isn't installed - AST verification no longer erroneously fails when using
--isort
- Historical comparisons like
darker --diff --revision=v1.0..v1.1
now actually compare the second revision and not the working tree files on disk. - Ensure identical Black formatting on Unix and Windows by always passing Unix newlines to Black
1.2.3 - 2021-05-02
- A unified
TextDocument
class to represent source code file contents - Move help texts into the separate
darker.help
module - If AST differs with zero context lines, search for the lowest successful number of context lines using a binary search to improve performance
- Return an exit value of 1 also if there are failures from any of the linters on modified lines
- Run GitHub Actions for the test build also on Windows and macOS
- Compatibility with MyPy 0.812
- Keep newline character sequence and text encoding intact when modifying files
- Installation now works on Windows
- Improve compatibility with pre-commit. Fallback to compare against HEAD if
--revision :PRE-COMMIT:
is set, butPRE_COMMIT_FROM_REF
orPRE_COMMIT_TO_REF
are not set.
1.2.2 - 2020-12-30
- Get revision range from pre-commit's
PRE_COMMIT_FROM_REF
andPRE_COMMIT_TO_REF
environment variables when using the--revision :PRE-COMMIT:
option - Configure a pre-commit hook for Darker itself
- Add a Darker package to conda-forge.
<commit>...
now compares always correctly to the latest common ancestor- Migrate from Travis CI to GitHub Actions
1.2.1 - 2020-11-30
- Travis CI now runs Pylint on modified lines via pytest-darker
- Darker can now be used as a pre-commit hook (see pre-commit)
- Document integration with Vim
- Thank all contributors right in the
README
RevisionRange
class and Git repository test fixture improvements in preparation for a larger refactoring coming in #80
- Improve example in
README
and clarify that path argument can also be a directory
1.2.0 - 2020-09-09
- Configuration for Darker can now be done in
pyproject.toml
. - The formatting of the Darker code base itself is now checked using Darker itself and pytest-darker. Currently the formatting is a mix of Black 19.10 and Black 20.8 rules, and Travis CI only requires Black 20.8 formatting for lines modified in merge requests. In a way, Darker is now eating its own dogfood.
- Support commit ranges for
-r
/--revision
. Useful for comparing to the best common ancestor, e.g.master...
. - Configure Flake8 verification for Darker's own source code
1.1.0 - 2020-08-15
-L
/--lint
option for running a linter for modified lines.--check
returns1
from the process but leaves files untouched if any file would require reformatting- Untracked Python files – e.g. those added recently – are now also reformatted
-r <rev>
/--revision <rev>
can be used to specify the Git revision to compare against when finding out modified lines. Defaults toHEAD
as before.--no-skip-string-normalization
flag to overrideskip_string_normalization = true
from a configuration file- The
--diff
and--lint
options will highlight syntax on screen if the pygments package is available.
- Paths from
--diff
are now relative to current working directory, similar to output fromblack --diff
, and blank lines after the lines markers (@@ ... @@
) have been removed.
1.0.0 - 2020-07-15
- Support for black config
- Support for
-l
/--line-length
and-S
/--skip-string-normalization
--diff
outputs a diff for each file on standard output- Require
isort
>= 5.0.1 and be compatible with it - Allow to configure
isort
throughpyproject.toml
0.2.0 - 2020-03-11
- Retry with a larger
git diff -U<context_lines>
option after producing a re-formatted Python file which fails to result in an identical AST
- Run isort first, and only then do the detailed
git diff
for Black
0.1.1 - 2020-02-17
- logic for choosing original/formatted chunks
0.1.0 - 2020-02-17
- Initial implementation