hello,
It would be nice to make cache loccation configurable by cli argument.
Here's my use case: We use bitbucket pipelines, and in their workflow I can only cache/restore directories relative to the project's path.
So, if you could please make the cache location configurable, i could add black --check --cache-dir=./black_cache on bitbucket pipeline, cache that directory, and make black execution really really fast 馃樃
Thanks, awesome project!!
Black uses appdirs for locating the folder where it should write the cache to. On Linux/Unix systems it's ~/.cache/black.
Looking at the source code for appdirs, we can see that we can change the path it gives Black by setting an environment variable:
https://github.com/ActiveState/appdirs/blob/0a7725ce30fbe6b7a6992458b0ba55f998195a6f/appdirs.py#L314
So if you set XDG_CACHE_HOME=.cache as an environment variable before you run Black, it will instead write the cache to the .cache/black folder.
We should document XDG_CACHE_HOME.