From 649ee67e4bb646f80fa0191d3ea047cc644d38f9 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sun, 2 Apr 2023 23:32:48 +0300 Subject: [PATCH] config: introduce core.site_cache_dir --- dvc/config_schema.py | 1 + dvc/repo/__init__.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dvc/config_schema.py b/dvc/config_schema.py index 65feb931db..e06caa31aa 100644 --- a/dvc/config_schema.py +++ b/dvc/config_schema.py @@ -150,6 +150,7 @@ def __call__(self, data): Optional("autostage", default=False): Bool, Optional("experiments"): Bool, # obsoleted Optional("check_update", default=True): Bool, + "site_cache_dir": str, "machine": Lower, }, "cache": { diff --git a/dvc/repo/__init__.py b/dvc/repo/__init__.py index f58bc2cc2d..ac6f28e298 100644 --- a/dvc/repo/__init__.py +++ b/dvc/repo/__init__.py @@ -565,7 +565,8 @@ def site_cache_dir(self) -> str: from dvc.fs import GitFileSystem - cache_dir = platformdirs.site_cache_dir("dvc", "iterative", opinion=True) + default = platformdirs.site_cache_dir("dvc", "iterative", opinion=True) + cache_dir = self.config["core"].get("site_cache_dir") or default if isinstance(self.fs, GitFileSystem): relparts = ()