Skip to content

Commit e90df2c

Browse files
lukaspielukaspie
andauthored
use nomad.config.fs.tmp for package storage (#726)
Co-authored-by: lukaspie <lukaspie@github.com>
1 parent 7f381da commit e90df2c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ dependencies = [
3939
"cachetools",
4040
"structlog",
4141
"orjson",
42-
"platformdirs"
4342
]
4443

4544
[project.urls]

src/pynxtools/nomad/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
from typing import Optional
2222

2323
import numpy as np
24-
from platformdirs import user_cache_dir
2524

2625
from pynxtools import get_nexus_version
2726

2827
try:
28+
from nomad import config
2929
from nomad.metainfo.data_type import (
3030
Bytes,
3131
Datetime,
@@ -136,8 +136,7 @@ def get_quantity_base_name(quantity_name):
136136

137137

138138
PACKAGE_DIR = Path(__file__).resolve().parent
139-
CACHE_DIR = Path(user_cache_dir("pynxtools")) / "metainfo"
140-
CACHE_DIR.mkdir(parents=True, exist_ok=True)
139+
CACHE_DIR = Path(config.fs.tmp) / "pynxtools"
141140

142141

143142
def get_package_filepath() -> Path:
@@ -166,4 +165,6 @@ def get_package_filepath() -> Path:
166165
return packaged
167166

168167
# 3. Otherwise store in cache dir
168+
# create parent directory only if we need to write
169+
CACHE_DIR.mkdir(parents=True, exist_ok=True)
169170
return CACHE_DIR / filename

0 commit comments

Comments
 (0)