Skip to content

Commit b526630

Browse files
committed
Add universal extension path function to sunbeamlib
1 parent 0c3f79a commit b526630

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/sunbeamlib/__init__.py

+11
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@ def get_docker_str(repo: str, user: str = "sunbeamlabs") -> str:
4242
return f"docker://{user}/{repo}:{docker_tag}"
4343

4444

45+
def get_ext_path(ext_name: str) -> Path:
46+
try:
47+
ext_path = Path(os.environ["SUNBEAM_DIR"]) / "extensions" / ext_name
48+
except KeyError:
49+
raise ValueError("SUNBEAM_DIR not set in environment.")
50+
51+
if ext_path.exists():
52+
return ext_path
53+
raise ValueError(f"Extension {ext_name} not found in {os.environ['SUNBEAM_DIR']}.")
54+
55+
4556
def load_sample_list(
4657
samplelist_fp: Path, paired_end: bool = True
4758
) -> Dict[str, Dict[str, str]]:

0 commit comments

Comments
 (0)