pypeline-runner 1.12.0__tar.gz → 1.14.0__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 (34) hide show
  1. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/PKG-INFO +1 -1
  2. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/pyproject.toml +1 -1
  3. pypeline_runner-1.14.0/src/pypeline/__init__.py +1 -0
  4. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/domain/execution_context.py +9 -1
  5. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/main.py +5 -0
  6. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/steps/env_setup_script.py +4 -0
  7. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/steps/scoop_install.py +10 -4
  8. pypeline_runner-1.12.0/src/pypeline/__init__.py +0 -1
  9. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/LICENSE +0 -0
  10. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/README.md +0 -0
  11. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/__run.py +0 -0
  12. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/domain/__init__.py +0 -0
  13. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/domain/artifacts.py +0 -0
  14. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/domain/config.py +0 -0
  15. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/domain/pipeline.py +0 -0
  16. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/domain/project_slurper.py +0 -0
  17. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/inputs_parser.py +0 -0
  18. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/kickstart/__init__.py +0 -0
  19. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/kickstart/create.py +0 -0
  20. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/kickstart/templates/project/.gitignore +0 -0
  21. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/kickstart/templates/project/bootstrap.ps1 +0 -0
  22. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/kickstart/templates/project/bootstrap.py +0 -0
  23. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/kickstart/templates/project/poetry.toml +0 -0
  24. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/kickstart/templates/project/pypeline.ps1 +0 -0
  25. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/kickstart/templates/project/pypeline.yaml +0 -0
  26. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/kickstart/templates/project/pyproject.toml +0 -0
  27. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/kickstart/templates/project/scoopfile.json +0 -0
  28. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/kickstart/templates/project/steps/my_step.py +0 -0
  29. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/kickstart/templates/project/west.yaml +0 -0
  30. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/py.typed +0 -0
  31. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/pypeline.py +0 -0
  32. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/steps/__init__.py +0 -0
  33. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/steps/create_venv.py +0 -0
  34. {pypeline_runner-1.12.0 → pypeline_runner-1.14.0}/src/pypeline/steps/west_install.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pypeline-runner
3
- Version: 1.12.0
3
+ Version: 1.14.0
4
4
  Summary: Configure and execute pipelines with Python (similar to GitHub workflows or Jenkins pipelines).
5
5
  License: MIT
6
6
  Author: cuinixam
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pypeline-runner"
3
- version = "1.12.0"
3
+ version = "1.14.0"
4
4
  description = "Configure and execute pipelines with Python (similar to GitHub workflows or Jenkins pipelines)."
5
5
  authors = ["cuinixam <me@cuinixam.com>"]
6
6
  license = "MIT"
@@ -0,0 +1 @@
1
+ __version__ = "1.14.0"
@@ -18,13 +18,21 @@ class ExecutionContext:
18
18
  data_registry: DataRegistry = field(default_factory=DataRegistry)
19
19
  # Inputs provided for the pipeline run
20
20
  inputs: Dict[str, Any] = field(default_factory=dict)
21
+ # Environment variables to be passed to the subprocesses
22
+ env_vars: Dict[str, Any] = field(default_factory=dict)
23
+
24
+ def get_input(self, name: str) -> Optional[Any]:
25
+ return self.inputs.get(name, None)
21
26
 
22
27
  def add_install_dirs(self, install_dirs: List[Path]) -> None:
23
28
  self.install_dirs.extend(install_dirs)
24
29
 
30
+ def add_env_vars(self, env_vars: Dict[str, Any]) -> None:
31
+ self.env_vars.update(env_vars)
32
+
25
33
  def create_process_executor(self, command: List[str | Path], cwd: Optional[Path] = None) -> SubprocessExecutor:
26
- # Add the install directories to the PATH
27
34
  env = os.environ.copy()
35
+ env.update(self.env_vars)
28
36
  env["PATH"] = os.pathsep.join([path.absolute().as_posix() for path in self.install_dirs] + [env["PATH"]])
29
37
  # When started from a windows shell (e.g. cmd on Jenkins) the shell parameter must be set to True
30
38
  shell = True if os.name == "nt" else False
@@ -16,6 +16,11 @@ from pypeline.pypeline import PipelineScheduler, PipelineStepsExecutor
16
16
 
17
17
  package_name = "pypeline"
18
18
 
19
+
20
+ def package_version_file() -> Path:
21
+ return Path(__file__).parent / "__init__.py"
22
+
23
+
19
24
  app = typer.Typer(
20
25
  name=package_name, help="Configure and execute pipelines with Python (similar to GitHub workflows or Jenkins pipelines).", no_args_is_help=True, add_completion=False
21
26
  )
@@ -31,6 +31,10 @@ class GenerateEnvSetupScript(PipelineStep[ExecutionContext]):
31
31
  else:
32
32
  logger.warning(f".env file not found: {dot_env_file}")
33
33
  env_vars = {}
34
+
35
+ # Merge execution context environment variables
36
+ env_vars.update(self.execution_context.env_vars)
37
+
34
38
  # Generate the environment setup scripts
35
39
  BatEnvSetupScriptGenerator(
36
40
  install_dirs=self.execution_context.install_dirs,
@@ -1,7 +1,7 @@
1
1
  import io
2
2
  import json
3
3
  import traceback
4
- from dataclasses import dataclass
4
+ from dataclasses import dataclass, field
5
5
  from pathlib import Path
6
6
  from typing import Any, ClassVar, Dict, List, Optional
7
7
 
@@ -13,11 +13,13 @@ from py_app_dev.core.scoop_wrapper import ScoopWrapper
13
13
 
14
14
  from ..domain.execution_context import ExecutionContext
15
15
  from ..domain.pipeline import PipelineStep
16
+ from ..main import package_version_file
16
17
 
17
18
 
18
19
  @dataclass
19
20
  class ScoopInstallExecutionInfo(DataClassJSONMixin):
20
21
  install_dirs: List[Path]
22
+ env_vars: Dict[str, Any] = field(default_factory=dict)
21
23
 
22
24
  class Config(BaseConfig):
23
25
  """Base configuration for JSON serialization with omitted None values."""
@@ -72,18 +74,22 @@ class ScoopInstall(PipelineStep[ExecutionContext]):
72
74
  for app in installed_apps:
73
75
  self.logger.debug(f" - {app.name} ({app.version})")
74
76
  self.install_dirs.extend(app.get_all_required_paths())
77
+ # Collect environment variables from each app
78
+ self.execution_info.env_vars.update(app.env_vars)
75
79
  self.execution_info.to_json_file(self.execution_info_file)
76
80
  return 0
77
81
 
78
82
  def get_inputs(self) -> List[Path]:
79
- return [self.scoop_file]
83
+ return [self.scoop_file, package_version_file()]
80
84
 
81
85
  def get_outputs(self) -> List[Path]:
82
86
  return [self.execution_info_file, *self.install_dirs]
83
87
 
84
88
  def update_execution_context(self) -> None:
85
- install_dirs = ScoopInstallExecutionInfo.from_json_file(self.execution_info_file).install_dirs
89
+ execution_info = ScoopInstallExecutionInfo.from_json_file(self.execution_info_file)
86
90
  # Make the list unique and keep the order
87
- unique_paths = list(dict.fromkeys(install_dirs))
91
+ unique_paths = list(dict.fromkeys(execution_info.install_dirs))
88
92
  # Update the install directories for the subsequent steps
89
93
  self.execution_context.add_install_dirs(unique_paths)
94
+ if execution_info.env_vars:
95
+ self.execution_context.add_env_vars(execution_info.env_vars)
@@ -1 +0,0 @@
1
- __version__ = "1.12.0"