Skip to content

Commit b9213e8

Browse files
committed
🚸 Improve checks for offline cache directory specification
1 parent 0778593 commit b9213e8

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Improves handling of Conda based environments in metadata collection.
66
- Adds additional options to `Client.get_runs`.
77
- Added ability to include environment variables within metadata for runs.
8+
- Improves checks on `offline.cache` directory specification in config file.
89

910
## [v2.1.2](https://github.com/simvue-io/client/releases/tag/v2.1.2) - 2025-06-25
1011

‎simvue/config/parameters.py‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"""
88

99
import logging
10-
import re
10+
import os
1111
import time
1212
import pydantic
1313
import typing
@@ -53,10 +53,12 @@ class OfflineSpecifications(pydantic.BaseModel):
5353
@pydantic.field_validator("cache")
5454
@classmethod
5555
def check_valid_cache_path(cls, cache: pathlib.Path) -> pathlib.Path:
56-
if not re.fullmatch(
57-
r"^(\/|([a-zA-Z]:\\))?([\w\s.-]+[\\/])*[\w\s.-]*$", f"{cache}"
58-
):
59-
raise AssertionError(f"Value '{cache}' is not a valid cache path.")
56+
if not cache.parent.exists():
57+
raise FileNotFoundError(f"No such directory '{cache.parent}'.")
58+
if not cache.parent.is_dir():
59+
raise FileNotFoundError(f"'{cache.parent}' is not a directory.")
60+
if not os.access(cache.parent, os.W_OK):
61+
raise AssertionError(f"'{cache.parent}' is not a writable location.")
6062
return cache
6163

6264

0 commit comments

Comments
 (0)