Skip to content

Commit

Permalink
fix(hyfi): improve handling of global project configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
entelecheia committed Jul 17, 2023
1 parent e87e330 commit 3e1d7ca
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/hyfi/main/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,12 @@ def task(**kwargs) -> TaskConfig:
Returns:
TaskConfig: An instance of the TaskConfig class.
"""
return TaskConfig(**kwargs)
if __global_config__.project and "project" in kwargs:
del kwargs["project"]
task = TaskConfig(**kwargs)
if __global_config__.project:
task.project = __global_config__.project
return task

@staticmethod
def workflow(**kwargs) -> WorkflowConfig:
Expand All @@ -255,8 +260,14 @@ def workflow(**kwargs) -> WorkflowConfig:
config_data=kwargs,
global_package=True,
)
return WorkflowConfig(**cfg)
return WorkflowConfig(**kwargs)
else:
cfg = kwargs
if __global_config__.project and "project" in cfg:
del cfg["project"]
wf = WorkflowConfig(**cfg)
if __global_config__.project:
wf.project = __global_config__.project
return wf

@staticmethod
def compose_as_dict(
Expand Down

0 comments on commit 3e1d7ca

Please sign in to comment.