Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Nov 5, 2024
1 parent f632e46 commit 4e7db2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ flake8 = "^4.0.1"
flake8-bugbear = "^22.1.11"
pytest = "^7.0"
snakemake = {git="https://github.com/snakemake/snakemake.git"}
snakemake-executor-plugin-cluster-generic = {git = "https://github.com/snakemake/snakemake-executor-plugin-cluster-generic.git"}

[tool.coverage.run]
omit = [".*", "*/site-packages/*"]
Expand Down
14 changes: 10 additions & 4 deletions snakemake_interface_software_deployment_plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from abc import ABC, abstractmethod
import hashlib
from pathlib import Path
import sys
from typing import List, Optional, Self

from snakemake_interface_software_deployment_plugins.settings import SoftwareDeploymentProviderSettingsBase
Expand Down Expand Up @@ -100,19 +101,24 @@ def __init__(
name: str,
prefix: Path,
settings: Optional[SoftwareDeploymentProviderSettingsBase] = None,
parent_env: Optional[EnvBase] = None
):
self.settings = settings
self.deployment_path = prefix / name
self.archive_path = prefix / f"{name}-archive"
self.parent_env = parent_env
self.__post_init__()

def __post_init__(self): # noqa B027
"""Do stuff after object initialization, e.g. checking for availability of
commands.
"""
pass

@classmethod
@abstractmethod
def get_env_cls(cls) -> EnvBase:
...
def get_env_cls(cls):
provider = sys.modules[cls.__module__] # get module of derived class
return provider.Env

def env(self, spec: EnvSpecBase) -> EnvBase:
return self.get_env_cls()(self, spec)
return self.get_env_cls()(provider=self, spec=spec, parent_env=self.parent_env)

0 comments on commit 4e7db2c

Please sign in to comment.