Ignoring unmodified files¶
Black remembers files it has already formatted, unless the --diff
flag is used or
code is passed via standard input. This information is stored per-user. The exact
location of the file depends on the Black version and the system on which Black is
run. The file is non-portable. The standard location on common operating systems is:
Windows:
C:\\Users\<username>\AppData\Local\black\black\Cache\<version>\cache.<line-length>.<file-mode>.pickle
macOS:
/Users/<username>/Library/Caches/black/<version>/cache.<line-length>.<file-mode>.pickle
Linux:
/home/<username>/.cache/black/<version>/cache.<line-length>.<file-mode>.pickle
file-mode
is an int flag that determines whether the file was formatted as 3.6+ only,
as .pyi, and whether string normalization was omitted.
To override the location of these files on macOS or Linux, set the environment variable
XDG_CACHE_HOME
to your preferred location. For example, if you want to put the cache
in the directory you’re running Black from, set XDG_CACHE_HOME=.cache
. Black will
then write the above files to .cache/black/<version>/
.