snakemake-interface-software-deployment-plugins 0.21.2__tar.gz → 0.21.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/CHANGELOG.md +8 -0
  2. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/PKG-INFO +1 -1
  3. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/pyproject.toml +1 -1
  4. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/snakemake_interface_software_deployment_plugins/__init__.py +12 -6
  5. snakemake_interface_software_deployment_plugins-0.21.3/tests/test_interface.py +92 -0
  6. snakemake_interface_software_deployment_plugins-0.21.2/tests/test_interface.py +0 -37
  7. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/.github/workflows/conventional-prs.yml +0 -0
  8. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/.github/workflows/release-please.yml +0 -0
  9. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/.github/workflows/test.yml +0 -0
  10. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/.gitignore +0 -0
  11. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/LICENSE +0 -0
  12. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/README.md +0 -0
  13. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/snakemake_interface_software_deployment_plugins/_common.py +0 -0
  14. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/snakemake_interface_software_deployment_plugins/registry/__init__.py +0 -0
  15. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/snakemake_interface_software_deployment_plugins/registry/plugin.py +0 -0
  16. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/snakemake_interface_software_deployment_plugins/settings.py +0 -0
  17. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/snakemake_interface_software_deployment_plugins/tests.py +0 -0
  18. {snakemake_interface_software_deployment_plugins-0.21.2 → snakemake_interface_software_deployment_plugins-0.21.3}/tests/test_py37.py +0 -0
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.21.3](https://github.com/snakemake/snakemake-interface-software-deployment-plugins/compare/v0.21.2...v0.21.3) (2026-12-04)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * avoid race conditions when downloading assets ([#76](https://github.com/snakemake/snakemake-interface-software-deployment-plugins/issues/76)) ([bc68dc9](https://github.com/snakemake/snakemake-interface-software-deployment-plugins/commit/bc68dc9cefce219e577a5ac2e09822c455a54f5a))
9
+ * improved error formatting including class name ([6313060](https://github.com/snakemake/snakemake-interface-software-deployment-plugins/commit/6313060c35c23cdedd509636ad29d07ca69bbf7a))
10
+
3
11
  ## [0.21.2](https://github.com/snakemake/snakemake-interface-software-deployment-plugins/compare/v0.21.1...v0.21.2) (2026-09-21)
4
12
 
5
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: snakemake-interface-software-deployment-plugins
3
- Version: 0.21.2
3
+ Version: 0.21.3
4
4
  Summary: This package provides a stable interface for interactions between Snakemake and its software deployment plugins.
5
5
  Project-URL: repository, https://github.com/snakemake/snakemake-interface-software-deployment-plugins
6
6
  Project-URL: homepage, https://snakemake.github.io
@@ -6,7 +6,7 @@ description = "This package provides a stable interface for interactions between
6
6
  license = "MIT"
7
7
  name = "snakemake-interface-software-deployment-plugins"
8
8
  readme = "README.md"
9
- version = "0.21.2"
9
+ version = "0.21.3"
10
10
  requires-python = ">=3.11,<4.0"
11
11
  dependencies = [
12
12
  "argparse-dataclass >=2.0.0,<3.0",
@@ -377,7 +377,7 @@ class PinnableEnvBase(EnvBase, ABC):
377
377
  self.pinfile.unlink()
378
378
  except Exception as e:
379
379
  raise WorkflowError(
380
- f"Removal of pinfile {self.pinfile} failed: {e}"
380
+ f"Removal of pinfile {self.pinfile} failed", e
381
381
  ) from e
382
382
 
383
383
 
@@ -402,14 +402,20 @@ class CacheableEnvBase(EnvBase, ABC):
402
402
  cache_path = self.get_cache_asset_path(asset)
403
403
  try:
404
404
  await self.cache_asset(asset, tmp_cache_path)
405
- os.replace(tmp_cache_path, cache_path)
405
+ try:
406
+ os.replace(tmp_cache_path, cache_path)
407
+ except FileExistsError:
408
+ try:
409
+ tmp_cache_path.unlink()
410
+ except Exception:
411
+ pass
406
412
  except Exception as e:
407
413
  if tmp_cache_path.exists():
408
414
  try:
409
415
  tmp_cache_path.unlink()
410
416
  except Exception:
411
417
  pass
412
- raise WorkflowError(f"Caching of {self.spec} failed: {e}") from e
418
+ raise WorkflowError(f"Caching of {self.spec} failed", e) from e
413
419
 
414
420
  @property
415
421
  def cache_path(self) -> Path:
@@ -433,7 +439,7 @@ class CacheableEnvBase(EnvBase, ABC):
433
439
  asset_path.unlink()
434
440
  except Exception as e:
435
441
  raise WorkflowError(
436
- f"Removal of cache asset {asset_path} for {self.spec} failed: {e}"
442
+ f"Removal of cache asset {asset_path} for {self.spec} failed", e
437
443
  ) from e
438
444
 
439
445
 
@@ -479,13 +485,13 @@ class DeployableEnvBase(EnvBase, ABC):
479
485
  try:
480
486
  self.remove()
481
487
  except Exception as e:
482
- raise WorkflowError(f"Removal of {self.spec} failed: {e}") from e
488
+ raise WorkflowError(f"Removal of {self.spec} failed", e) from e
483
489
 
484
490
  async def managed_deploy(self) -> None:
485
491
  try:
486
492
  await self.deploy()
487
493
  except Exception as e:
488
- raise WorkflowError(f"Deployment of {self.spec} failed: {e}") from e
494
+ raise WorkflowError(f"Deployment of {self.spec} failed", e) from e
489
495
 
490
496
  def deployment_hash(self) -> str:
491
497
  return self._managed_generic_hash("deployment_hash")
@@ -0,0 +1,92 @@
1
+ from snakemake_interface_software_deployment_plugins import EnvSpecSourceFile
2
+ from pathlib import Path
3
+ import asyncio
4
+ import pytest
5
+ from typing import List
6
+ from snakemake_interface_software_deployment_plugins.registry import (
7
+ SoftwareDeploymentPluginRegistry,
8
+ )
9
+ from snakemake_interface_common.plugin_registry.tests import TestRegistryBase
10
+ from snakemake_interface_common.plugin_registry.plugin import PluginBase, SettingsBase
11
+ from snakemake_interface_common.plugin_registry import PluginRegistryBase
12
+ import snakemake_interface_software_deployment_plugins as interface
13
+ from snakemake_interface_common.exceptions import WorkflowError
14
+
15
+
16
+ class TestRegistry(TestRegistryBase):
17
+ __test__ = True
18
+
19
+ def get_registry(self) -> PluginRegistryBase:
20
+ # ensure that the singleton is reset
21
+ SoftwareDeploymentPluginRegistry._instance = None
22
+ return SoftwareDeploymentPluginRegistry()
23
+
24
+ def get_test_plugin_name(self) -> str:
25
+ return "envmodules"
26
+
27
+ def validate_plugin(self, plugin: PluginBase):
28
+ assert plugin.settings_cls is None
29
+ assert plugin.env_cls is not None # pyrefly: ignore[missing-attribute]
30
+ assert plugin.env_spec_cls is not None # pyrefly: ignore[missing-attribute]
31
+
32
+ def validate_settings(self, settings: SettingsBase, plugin: PluginBase):
33
+ # assert isinstance(settings, plugin.settings_cls)
34
+ pass
35
+
36
+ def get_example_args(self) -> List[str]:
37
+ return []
38
+
39
+
40
+ def test_env_spec_source_file():
41
+ EnvSpecSourceFile(path_or_uri="test.yaml", cached=Path("test.yaml"))
42
+
43
+
44
+ class CacheableEnv(interface.CacheableEnvBase):
45
+ async def cache_asset(self, asset, to_path):
46
+ to_path.write_text("new")
47
+
48
+ def decorate_shellcmd(self, cmd):
49
+ return cmd
50
+
51
+ def contains_executable(self, executable):
52
+ return False
53
+
54
+ def record_hash(self, hash_object):
55
+ pass
56
+
57
+ def report_software(self):
58
+ return ()
59
+
60
+
61
+ def _env(cache_path):
62
+ env = object.__new__(CacheableEnv)
63
+ env._cache_prefix = cache_path
64
+ env.spec = "test"
65
+ return env
66
+
67
+
68
+ def test_managed_cache_asset_ignores_replace_error_when_cached(tmp_path, monkeypatch):
69
+ cache_path = tmp_path / "asset"
70
+ cache_path.write_text("cached")
71
+
72
+ def raise_file_exists_error(src, dst):
73
+ raise FileExistsError("already exists")
74
+
75
+ monkeypatch.setattr(interface.os, "replace", raise_file_exists_error)
76
+
77
+ asyncio.run(_env(tmp_path).managed_cache_asset("asset"))
78
+
79
+ assert cache_path.read_text() == "cached"
80
+ assert not list(tmp_path.glob("asset*.part"))
81
+
82
+
83
+ def test_managed_cache_asset_does_not_ignore_other_replace_errors(
84
+ tmp_path, monkeypatch
85
+ ):
86
+ def raise_permission_error(src, dst):
87
+ raise PermissionError("replace failed")
88
+
89
+ monkeypatch.setattr(interface.os, "replace", raise_permission_error)
90
+
91
+ with pytest.raises(WorkflowError):
92
+ asyncio.run(_env(tmp_path).managed_cache_asset("asset"))
@@ -1,37 +0,0 @@
1
- from snakemake_interface_software_deployment_plugins import EnvSpecSourceFile
2
- from pathlib import Path
3
- from typing import List
4
- from snakemake_interface_software_deployment_plugins.registry import (
5
- SoftwareDeploymentPluginRegistry,
6
- )
7
- from snakemake_interface_common.plugin_registry.tests import TestRegistryBase
8
- from snakemake_interface_common.plugin_registry.plugin import PluginBase, SettingsBase
9
- from snakemake_interface_common.plugin_registry import PluginRegistryBase
10
-
11
-
12
- class TestRegistry(TestRegistryBase):
13
- __test__ = True
14
-
15
- def get_registry(self) -> PluginRegistryBase:
16
- # ensure that the singleton is reset
17
- SoftwareDeploymentPluginRegistry._instance = None
18
- return SoftwareDeploymentPluginRegistry()
19
-
20
- def get_test_plugin_name(self) -> str:
21
- return "envmodules"
22
-
23
- def validate_plugin(self, plugin: PluginBase):
24
- assert plugin.settings_cls is None
25
- assert plugin.env_cls is not None # pyrefly: ignore[missing-attribute]
26
- assert plugin.env_spec_cls is not None # pyrefly: ignore[missing-attribute]
27
-
28
- def validate_settings(self, settings: SettingsBase, plugin: PluginBase):
29
- # assert isinstance(settings, plugin.settings_cls)
30
- pass
31
-
32
- def get_example_args(self) -> List[str]:
33
- return []
34
-
35
-
36
- def test_env_spec_source_file():
37
- EnvSpecSourceFile(path_or_uri="test.yaml", cached=Path("test.yaml"))