pypeline-runner 1.12.0__py3-none-any.whl → 1.13.0__py3-none-any.whl

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.
pypeline/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.12.0"
1
+ __version__ = "1.13.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
@@ -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
 
@@ -18,6 +18,7 @@ from ..domain.pipeline import PipelineStep
18
18
  @dataclass
19
19
  class ScoopInstallExecutionInfo(DataClassJSONMixin):
20
20
  install_dirs: List[Path]
21
+ env_vars: Dict[str, Any] = field(default_factory=dict)
21
22
 
22
23
  class Config(BaseConfig):
23
24
  """Base configuration for JSON serialization with omitted None values."""
@@ -72,6 +73,8 @@ class ScoopInstall(PipelineStep[ExecutionContext]):
72
73
  for app in installed_apps:
73
74
  self.logger.debug(f" - {app.name} ({app.version})")
74
75
  self.install_dirs.extend(app.get_all_required_paths())
76
+ # Collect environment variables from each app
77
+ self.execution_info.env_vars.update(app.env_vars)
75
78
  self.execution_info.to_json_file(self.execution_info_file)
76
79
  return 0
77
80
 
@@ -82,8 +85,10 @@ class ScoopInstall(PipelineStep[ExecutionContext]):
82
85
  return [self.execution_info_file, *self.install_dirs]
83
86
 
84
87
  def update_execution_context(self) -> None:
85
- install_dirs = ScoopInstallExecutionInfo.from_json_file(self.execution_info_file).install_dirs
88
+ execution_info = ScoopInstallExecutionInfo.from_json_file(self.execution_info_file)
86
89
  # Make the list unique and keep the order
87
- unique_paths = list(dict.fromkeys(install_dirs))
90
+ unique_paths = list(dict.fromkeys(execution_info.install_dirs))
88
91
  # Update the install directories for the subsequent steps
89
92
  self.execution_context.add_install_dirs(unique_paths)
93
+ if execution_info.env_vars:
94
+ self.execution_context.add_env_vars(execution_info.env_vars)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pypeline-runner
3
- Version: 1.12.0
3
+ Version: 1.13.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,9 +1,9 @@
1
- pypeline/__init__.py,sha256=ojUczZNOmgkgAYXRdDJ_bo8gdfmTPU5zTYbNMYMWPLg,23
1
+ pypeline/__init__.py,sha256=qyRV1Az4m5yhA_Nx1r_oZmIwZAZJpLTJdDw9oDJaqr8,23
2
2
  pypeline/__run.py,sha256=TCdaX05Qm3g8T4QYryKB25Xxf0L5Km7hFOHe1mK9vI0,350
3
3
  pypeline/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  pypeline/domain/artifacts.py,sha256=5k7cVfHhLmvWXNuHKxXb9ca4Lxu0JytGQqazENCeKEU,1404
5
5
  pypeline/domain/config.py,sha256=6vWdHi7B6MA7NGi9wWXQE-YhSg1COSRmc3b1ji6AdAk,2053
6
- pypeline/domain/execution_context.py,sha256=-YErMvP5jdXHqJnPCD5ePoU2XMhdp-Zpr4eJaRPKXYY,1537
6
+ pypeline/domain/execution_context.py,sha256=cDdUOU32hKg2Mv6FNXCG1co8GUrBf5QOVKhaKO-xVxI,1848
7
7
  pypeline/domain/pipeline.py,sha256=2BsN2lw2znUxLH--Novyqe6SubVKs6XeHQSQf9yxirw,7788
8
8
  pypeline/domain/project_slurper.py,sha256=64aqgVsrLgAK-c5QOM2N0wGCkOM1uNMio8yKjO2zDLU,1069
9
9
  pypeline/inputs_parser.py,sha256=8WJnWbACNmw_iYLhbAwcgGohCZWult8HtiJC9KiG3R0,3389
@@ -24,11 +24,11 @@ pypeline/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  pypeline/pypeline.py,sha256=-mquLfFlEvESk-HORhvjRMESIzdlVAgBLPjwUDOPLqg,7452
25
25
  pypeline/steps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  pypeline/steps/create_venv.py,sha256=sajEl43Yqcd1f0BN9lZOhm93UIRXj4Qx4TdAOSxLkTU,2509
27
- pypeline/steps/env_setup_script.py,sha256=j6wrrnZSXXu1fq01zUdgiFBTTlpR4XXl_uMWwVCcQSI,2221
28
- pypeline/steps/scoop_install.py,sha256=TIrU2hPCS3SzHc2_L2A2EgGFkTQIGdrconDUeNkMx64,3484
27
+ pypeline/steps/env_setup_script.py,sha256=u08A6pvMccFQbcnU0xruFvpU30PbDrttnbOjl1gDqog,2340
28
+ pypeline/steps/scoop_install.py,sha256=E9wd5ygxRCuF2LD4X3wwTTnKa4XDmZ5fqeiH4dO0vjE,3788
29
29
  pypeline/steps/west_install.py,sha256=hPyr28ksdKsQ0tv0gMNytzupgk1IgjN9CpmaBdX5zps,1947
30
- pypeline_runner-1.12.0.dist-info/LICENSE,sha256=sKxdoqSmW9ezvPvt0ZGJbneyA0SBcm0GiqzTv2jN230,1066
31
- pypeline_runner-1.12.0.dist-info/METADATA,sha256=Z4LtZX3fUUXeeyZDd85HNjUru7uPFQ6diDSz8XKyySk,7553
32
- pypeline_runner-1.12.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
33
- pypeline_runner-1.12.0.dist-info/entry_points.txt,sha256=pe1u0uuhPI_yeQ0KjEw6jK-EvQfPcZwBSajgbAdKz1o,47
34
- pypeline_runner-1.12.0.dist-info/RECORD,,
30
+ pypeline_runner-1.13.0.dist-info/LICENSE,sha256=sKxdoqSmW9ezvPvt0ZGJbneyA0SBcm0GiqzTv2jN230,1066
31
+ pypeline_runner-1.13.0.dist-info/METADATA,sha256=mXar7ok3VkWZqyqsiDqIOCyv-sw_t-LenSKDphG8Q8M,7553
32
+ pypeline_runner-1.13.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
33
+ pypeline_runner-1.13.0.dist-info/entry_points.txt,sha256=pe1u0uuhPI_yeQ0KjEw6jK-EvQfPcZwBSajgbAdKz1o,47
34
+ pypeline_runner-1.13.0.dist-info/RECORD,,