From 7e60c41a834de6df90374790bd5a79dd316a0c7e Mon Sep 17 00:00:00 2001 From: Tom Close Date: Sun, 17 Mar 2024 11:04:49 +1100 Subject: [PATCH] moved persistent hash cache within "hash_cache" subdirectory of the pydra user cache dir --- pydra/utils/__init__.py | 11 +++++++++++ pydra/utils/hash.py | 9 ++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pydra/utils/__init__.py b/pydra/utils/__init__.py index e69de29bb2..4c7dcd71be 100644 --- a/pydra/utils/__init__.py +++ b/pydra/utils/__init__.py @@ -0,0 +1,11 @@ +from pathlib import Path +import platformdirs +from pydra import __version__ + +user_cache_dir = Path( + platformdirs.user_cache_dir( + appname="pydra", + appauthor="nipype", + version=__version__, + ) +) diff --git a/pydra/utils/hash.py b/pydra/utils/hash.py index abfd908a63..81e4e773f5 100644 --- a/pydra/utils/hash.py +++ b/pydra/utils/hash.py @@ -17,10 +17,9 @@ Set, ) from filelock import SoftFileLock -import platformdirs import attrs.exceptions from fileformats.core import FileSet -from pydra._version import __version__ +from . import user_cache_dir logger = logging.getLogger("pydra") @@ -99,11 +98,7 @@ def location_default(cls): try: location = os.environ[cls.LOCATION_ENV_VAR] except KeyError: - location = platformdirs.user_cache_dir( - appname="pydra", - appauthor="nipype", - version=__version__, - ) + location = user_cache_dir / "hash_cache" return location # the default needs to be an instance method