Skip to content

Commit 7962913

Browse files
feat: add source cache path attribute for mounting in e.g. containers (#33)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * New Features * Added an optional configuration to specify a source cache path during environment initialization, enabling cached sources for improved reuse. Existing behavior remains unchanged if not provided. * Tests * Expanded test coverage to include scenarios using the new source cache path, ensuring correct handling and integration in typical workflows. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 8e453b2 commit 7962913

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

snakemake_interface_software_deployment_plugins/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ def __init__(
169169
settings: Optional[SoftwareDeploymentSettingsBase],
170170
shell_executable: ShellExecutable,
171171
tempdir: Path,
172+
source_cache: Path,
172173
cache_prefix: Path,
173174
deployment_prefix: Path,
174175
pinfile_prefix: Path,
@@ -178,6 +179,7 @@ def __init__(
178179
self.settings: Optional[SoftwareDeploymentSettingsBase] = settings
179180
self.shell_executable = shell_executable
180181
self.tempdir = tempdir
182+
self.source_cache: Path = source_cache
181183
self._deployment_prefix: Path = deployment_prefix
182184
self._cache_prefix: Path = cache_prefix
183185
self._pinfile_prefix: Path = pinfile_prefix

snakemake_interface_software_deployment_plugins/tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,20 @@ def _get_env(self, tmp_path) -> EnvBase:
152152
deployment_prefix = tmp_path / "deployments"
153153
cache_prefix = tmp_path / "cache"
154154
pinfile_prefix = tmp_path / "pinfiles"
155+
source_cache = tmp_path / "source_cache"
155156
tempdir.mkdir(parents=True, exist_ok=True)
156157
deployment_prefix.mkdir(parents=True, exist_ok=True)
157158
cache_prefix.mkdir(parents=True, exist_ok=True)
158159
pinfile_prefix.mkdir(parents=True, exist_ok=True)
160+
source_cache.mkdir(parents=True, exist_ok=True)
159161

160162
return env_cls(
161163
spec=spec,
162164
within=None,
163165
settings=self.get_settings(),
164166
shell_executable=self.shell_executable,
165167
tempdir=tempdir,
168+
source_cache=source_cache,
166169
deployment_prefix=deployment_prefix,
167170
cache_prefix=cache_prefix,
168171
pinfile_prefix=pinfile_prefix,

0 commit comments

Comments
 (0)