Skip to content

Commit af441d1

Browse files
authored
refactor(models): respect model names/relpaths (#199)
Don't substitute path separators and "-" out of the model keys. Use the umodified relpath (respective to the root search dir) and just enforce "/" as separator. This lets consumers set up example scenario workspaces with model subdirs like root / key, such that example scenarios with multiple models, some of which expect to find outputs of previously run models by relative path, will just work.
1 parent 0ea364b commit af441d1

3 files changed

Lines changed: 580 additions & 580 deletions

File tree

modflow_devtools/make_registry.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def _find_examples_dir(p):
5959
model_path = model_path.expanduser().absolute()
6060
base_path = _find_examples_dir(model_path) if is_zip else path
6161
rel_path = model_path.relative_to(base_path)
62-
model_name = str(rel_path).replace("/", "_").replace("-", "_")
62+
model_name = "/".join(rel_path.parts)
6363
modelmap[model_name] = []
6464
if is_zip:
6565
if rel_path.parts[0] not in examples:
@@ -70,12 +70,12 @@ def _find_examples_dir(p):
7070
continue
7171
if is_zip:
7272
relpath = p.expanduser().absolute().relative_to(base_path)
73-
name = str(relpath)
73+
name = "/".join(relpath.parts)
7474
url_ = url
7575
hash = None
7676
else:
7777
relpath = p.expanduser().absolute().relative_to(base_path)
78-
name = str(relpath)
78+
name = "/".join(relpath.parts)
7979
url_ = f"{url}/{relpath!s}"
8080
hash = _sha256(p)
8181
registry[name] = {"hash": hash, "url": url_}

0 commit comments

Comments
 (0)