Skip to content

Commit

Permalink
fix(hyfi/core/config): remove run method from HyfiConfig class
Browse files Browse the repository at this point in the history
  • Loading branch information
entelecheia committed Jul 16, 2023
1 parent 66c14b3 commit d43866b
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/hyfi/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Hyfi configuration file.
"""
import os
from typing import Any, Optional, Union
from typing import Any, List, Optional, Union

from omegaconf import DictConfig
from pydantic import (
Expand All @@ -15,13 +15,11 @@
)

from hyfi.about import AboutConfig, __app_name__, __version__
from hyfi.copier import Copier
from hyfi.core import __about__, __hydra_config__
from hyfi.dotenv import DotEnvConfig
from hyfi.pipeline import PipelineConfig, PIPELINEs
from hyfi.pipeline import PipelineConfig
from hyfi.project import ProjectConfig
from hyfi.task import TaskConfig
from hyfi.utils.conf import CONFs
from hyfi.utils.envs import ENVs
from hyfi.utils.logging import LOGGING
from hyfi.utils.notebooks import NBs
Expand Down Expand Up @@ -50,6 +48,7 @@ class HyfiConfig(BaseModel):
pipeline: Optional[PipelineConfig] = None
task: Optional[TaskConfig] = None
workflow: Optional[WorkflowConfig] = None
tasks: Optional[List[str]] = None

_version_: str = PrivateAttr(__version__())
_initilized_: bool = PrivateAttr(False)
Expand Down Expand Up @@ -291,19 +290,6 @@ def print_about(self):
if pkg_name:
print(f"\nExecute `{pkg_name} --help` to see what you can do with {name}")

def run(self, target: Optional[str] = None):
"""Run the config"""
if self.workflow is not None and (target is None or target == "workflow"):
PIPELINEs.run_workflow(self.workflow)
elif self.task is not None and (target is None or target == "task"):
PIPELINEs.run_task(self.task, project=self.project)
elif self.copier is not None and (target is None or target == "copier"):
args = CONFs.to_dict(self.copier)
with Copier(**args) as worker:
worker.run_copy()
else:
self.print_about()


__global_config__ = HyfiConfig()
if __global_config__.about:
Expand Down

0 comments on commit d43866b

Please sign in to comment.