pypeline-runner 1.14.0__py3-none-any.whl → 1.15.1__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/inputs_parser.py CHANGED
@@ -1,5 +1,4 @@
1
1
  import argparse
2
- import distutils.util
3
2
  from typing import Any, Dict, List
4
3
 
5
4
  from py_app_dev.core.exceptions import UserNotificationException
@@ -13,7 +12,7 @@ def _map_type_for_argparse(input_type: InputType) -> Any:
13
12
  elif input_type == "integer":
14
13
  return int
15
14
  elif input_type == "boolean":
16
- return lambda x: bool(distutils.util.strtobool(x))
15
+ return argparse.BooleanOptionalAction # Use BooleanOptionalAction for boolean arguments
17
16
  else:
18
17
  raise ValueError(f"Unsupported input type specified: {input_type}")
19
18
 
@@ -37,14 +36,23 @@ def create_argument_parser_from_definitions(
37
36
  help_text += f", Default: {definition.default}"
38
37
  help_text += ")"
39
38
 
40
- parser.add_argument(
41
- f"--{name}",
42
- dest=name, # Attribute name in the parsed namespace
43
- help=help_text,
44
- type=arg_type, # Type conversion function
45
- required=definition.required,
46
- default=definition.default,
47
- )
39
+ if definition.type == "boolean":
40
+ parser.add_argument(
41
+ f"--{name}",
42
+ dest=name, # Attribute name in the parsed namespace
43
+ help=help_text,
44
+ action=arg_type, # Use BooleanOptionalAction for boolean arguments
45
+ default=definition.default or False,
46
+ )
47
+ else:
48
+ parser.add_argument(
49
+ f"--{name}",
50
+ dest=name,
51
+ help=help_text,
52
+ type=arg_type,
53
+ required=definition.required,
54
+ default=definition.default,
55
+ )
48
56
 
49
57
  return parser
50
58
 
@@ -69,11 +77,13 @@ class InputsParser:
69
77
  try:
70
78
  args = []
71
79
  for item in inputs:
72
- if "=" not in item:
73
- raise UserNotificationException(f"Invalid input format: '{item}', expected 'name=value'")
74
- name, value = item.split("=", 1)
75
- args.append(f"--{name}")
76
- args.append(value)
80
+ if "=" in item:
81
+ name, value = item.split("=", 1)
82
+ args.append(f"--{name}")
83
+ if value:
84
+ args.append(value)
85
+ else:
86
+ args.append(f"--{item}")
77
87
 
78
88
  parsed_namespace = self.parser.parse_args(args)
79
89
  return vars(parsed_namespace)
@@ -8,7 +8,8 @@ pipeline:
8
8
  - step: CreateVEnv
9
9
  module: pypeline.steps.create_venv
10
10
  config:
11
- bootstrap_script: .bootstrap/bootstrap.py
11
+ package_manager: uv>=0.6
12
+ python_executable: python3
12
13
  - step: WestInstall
13
14
  module: pypeline.steps.west_install
14
15
  description: Download external modules
@@ -1,11 +1,13 @@
1
- [tool.poetry]
2
- name = "Hello Pypeline"
1
+ [project]
2
+ name = "hello-pypeline"
3
3
  version = "0.0.1"
4
4
  description = "A simple generated project to get you started"
5
- authors = ["Your Name"]
6
- package-mode = false
7
-
8
- [tool.poetry.dependencies]
9
- python = ">=3.10,<4.0"
10
- pypeline-runner = "*"
11
- west = "*"
5
+ authors = [
6
+ {name = "Your Name"},
7
+ ]
8
+ requires-python = "<4.0,>=3.10"
9
+ dependencies = [
10
+ "pypeline-runner>=1,<2",
11
+ "west>=1,<2",
12
+ "wrapt>=1,<2",
13
+ ]
@@ -12,6 +12,7 @@ class MyStep(PipelineStep[ExecutionContext]):
12
12
  logger.info(f"Run {self.get_name()} found install dirs:")
13
13
  for install_dir in self.execution_context.install_dirs:
14
14
  logger.info(f" {install_dir}")
15
+ logger.info(f"my_input: {self.execution_context.get_input('my_input')}")
15
16
 
16
17
  def get_inputs(self) -> List[Path]:
17
18
  return []
@@ -3,18 +3,19 @@ from pathlib import Path
3
3
  from typing import Any, Dict, List, Optional
4
4
 
5
5
  from mashumaro import DataClassDictMixin
6
- from py_app_dev.core.exceptions import UserNotificationException
7
6
  from py_app_dev.core.logging import logger
8
7
 
8
+ from pypeline.bootstrap.run import get_bootstrap_script
9
+
9
10
  from ..domain.execution_context import ExecutionContext
10
11
  from ..domain.pipeline import PipelineStep
11
12
 
12
- DEFAULT_BOOTSTRAP_SCRIPT = "bootstrap.py"
13
-
14
13
 
15
14
  @dataclass
16
15
  class CreateVEnvConfig(DataClassDictMixin):
17
- bootstrap_script: str = DEFAULT_BOOTSTRAP_SCRIPT
16
+ bootstrap_script: str = "bootstrap.py"
17
+ python_executable: str = "python3"
18
+ package_manager: Optional[str] = None
18
19
 
19
20
 
20
21
  class CreateVEnv(PipelineStep[ExecutionContext]):
@@ -33,15 +34,16 @@ class CreateVEnv(PipelineStep[ExecutionContext]):
33
34
  self.logger.debug(f"Run {self.get_name()} step. Output dir: {self.output_dir}")
34
35
  config = CreateVEnvConfig.from_dict(self.config) if self.config else CreateVEnvConfig()
35
36
  bootstrap_script = self.project_root_dir / config.bootstrap_script
37
+ bootstrap_args = []
36
38
  if not bootstrap_script.exists():
37
- if config.bootstrap_script == DEFAULT_BOOTSTRAP_SCRIPT:
38
- raise UserNotificationException(f"Failed to find bootstrap script '{config.bootstrap_script}'. Make sure that the project is initialized correctly.")
39
- else: # Fallback to default bootstrap script
40
- bootstrap_script = self.project_root_dir / DEFAULT_BOOTSTRAP_SCRIPT
41
- if not bootstrap_script.exists():
42
- raise UserNotificationException("Failed to find bootstrap script. Make sure that the project is initialized correctly.")
39
+ self.logger.warning(f"Bootstrap script {bootstrap_script} does not exist. Use pypeline internal `bootstrap.py`.")
40
+ bootstrap_script = get_bootstrap_script()
41
+ # Only the internal bootstrap.py script supports arguments.
42
+ bootstrap_args = ["--project-dir", self.project_root_dir.as_posix()]
43
+ if config.package_manager:
44
+ bootstrap_args.extend(["--package-manager", f'"{config.package_manager}"'])
43
45
  self.execution_context.create_process_executor(
44
- ["python3", bootstrap_script.as_posix()],
46
+ [config.python_executable, bootstrap_script.as_posix(), *bootstrap_args],
45
47
  cwd=self.project_root_dir,
46
48
  ).execute()
47
49
  self.execution_context.add_install_dirs(self.install_dirs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pypeline-runner
3
- Version: 1.14.0
3
+ Version: 1.15.1
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,34 +1,32 @@
1
- pypeline/__init__.py,sha256=oitamisYLp3lrFI3uGv-5ZCJIeYOT9gZLcszUmVNhw8,23
1
+ pypeline/__init__.py,sha256=lJTHPTq_lku8cPevlR7mFSxJNTqHgZJVZuDdqSiDNeM,23
2
2
  pypeline/__run.py,sha256=TCdaX05Qm3g8T4QYryKB25Xxf0L5Km7hFOHe1mK9vI0,350
3
+ pypeline/bootstrap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ pypeline/bootstrap/run.py,sha256=VqBZI9eioGXpWI87GrGrQZaA6Zd-qtf1pi3efyGZezk,20201
3
5
  pypeline/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
6
  pypeline/domain/artifacts.py,sha256=5k7cVfHhLmvWXNuHKxXb9ca4Lxu0JytGQqazENCeKEU,1404
5
7
  pypeline/domain/config.py,sha256=6vWdHi7B6MA7NGi9wWXQE-YhSg1COSRmc3b1ji6AdAk,2053
6
8
  pypeline/domain/execution_context.py,sha256=cDdUOU32hKg2Mv6FNXCG1co8GUrBf5QOVKhaKO-xVxI,1848
7
9
  pypeline/domain/pipeline.py,sha256=2BsN2lw2znUxLH--Novyqe6SubVKs6XeHQSQf9yxirw,7788
8
10
  pypeline/domain/project_slurper.py,sha256=64aqgVsrLgAK-c5QOM2N0wGCkOM1uNMio8yKjO2zDLU,1069
9
- pypeline/inputs_parser.py,sha256=8WJnWbACNmw_iYLhbAwcgGohCZWult8HtiJC9KiG3R0,3389
11
+ pypeline/inputs_parser.py,sha256=tGQRfZMsDAXbir455kxNXPNLN_hwGmSisS41GqYrh1A,3745
10
12
  pypeline/kickstart/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
13
  pypeline/kickstart/create.py,sha256=iaB8MMC7PinpPBwRmz3rWZuE-DRbsLh2NtvczYaVgi0,2133
12
14
  pypeline/kickstart/templates/project/.gitignore,sha256=y8GJoVvRPez1LBokf1NaDOt2X1XtGwKFMF5yjA8AVS0,24
13
- pypeline/kickstart/templates/project/bootstrap.ps1,sha256=eR8cyIJwDVt-bA2H3GWmxUew3igJaKYKv4rtg7MqhsY,766
14
- pypeline/kickstart/templates/project/bootstrap.py,sha256=9cJp_sbU0SKvDjJluvyQfh0_xIsf6E1ct7sa7rRecNU,17244
15
- pypeline/kickstart/templates/project/poetry.toml,sha256=qgVxBdPcJZOHdHCTOBoZYna3cke4VGgRkNZ0bKgN6rs,32
16
15
  pypeline/kickstart/templates/project/pypeline.ps1,sha256=PjCJULG8XA3AHKbNt3oHrIgD04huvvpIue_gjSo3PMA,104
17
- pypeline/kickstart/templates/project/pypeline.yaml,sha256=dyzn8vmHugpINVyB9l0QujK0J-oi--JQXunjUj9n3_k,385
18
- pypeline/kickstart/templates/project/pyproject.toml,sha256=A60HZ6Aqf8KTFLoC35SexuJ2Ze1I-khuYmYUKhphfNY,247
19
- pypeline/kickstart/templates/project/scoopfile.json,sha256=DcfZ8jYf9hmPHM-AWwnPKQJCzRG3fCuYtMeoY01nkag,219
20
- pypeline/kickstart/templates/project/steps/my_step.py,sha256=iZYTzWtL-qxEW_t7q079d-xpnRST_tumSzxqiQDW7sM,707
16
+ pypeline/kickstart/templates/project/pypeline.yaml,sha256=ZyhMs0o7NRwiOHagePsyC2Sk8Eotzun7QXeyBCrcUdQ,401
17
+ pypeline/kickstart/templates/project/pyproject.toml,sha256=nlsHIbt1XG7sCRwb4W5ePGgxsMm1e_hNACF2LtZ5yAw,271
18
+ pypeline/kickstart/templates/project/steps/my_step.py,sha256=b-JEwF9EyF4G6lgvkk3I2aT2wpD_zQ2fTiQrR6lWhs4,788
21
19
  pypeline/kickstart/templates/project/west.yaml,sha256=ZfVym7M4yzzC-Nm0vESdhqNYs6EaJuMQWGJBht_i0b4,188
22
20
  pypeline/main.py,sha256=2mC2BDB1OWIXhaijBXG6Y1vfT8_yMZ4Dj55w5u7g7-w,4158
23
21
  pypeline/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
22
  pypeline/pypeline.py,sha256=-mquLfFlEvESk-HORhvjRMESIzdlVAgBLPjwUDOPLqg,7452
25
23
  pypeline/steps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
- pypeline/steps/create_venv.py,sha256=sajEl43Yqcd1f0BN9lZOhm93UIRXj4Qx4TdAOSxLkTU,2509
24
+ pypeline/steps/create_venv.py,sha256=oNdgBvfYDI0obqgI-I9-vfJYjS6OsDmWOuYq1py9NGk,2488
27
25
  pypeline/steps/env_setup_script.py,sha256=u08A6pvMccFQbcnU0xruFvpU30PbDrttnbOjl1gDqog,2340
28
26
  pypeline/steps/scoop_install.py,sha256=DDXBD-5TVaT-u6Yf7A85uWoCgBVmLvj9nPGrZ8OQCz0,3853
29
27
  pypeline/steps/west_install.py,sha256=hPyr28ksdKsQ0tv0gMNytzupgk1IgjN9CpmaBdX5zps,1947
30
- pypeline_runner-1.14.0.dist-info/LICENSE,sha256=sKxdoqSmW9ezvPvt0ZGJbneyA0SBcm0GiqzTv2jN230,1066
31
- pypeline_runner-1.14.0.dist-info/METADATA,sha256=FgmQ8o6AHWwEtCxGeIYXc5TXxT6KJklRZoIELvMcMTc,7553
32
- pypeline_runner-1.14.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
33
- pypeline_runner-1.14.0.dist-info/entry_points.txt,sha256=pe1u0uuhPI_yeQ0KjEw6jK-EvQfPcZwBSajgbAdKz1o,47
34
- pypeline_runner-1.14.0.dist-info/RECORD,,
28
+ pypeline_runner-1.15.1.dist-info/LICENSE,sha256=sKxdoqSmW9ezvPvt0ZGJbneyA0SBcm0GiqzTv2jN230,1066
29
+ pypeline_runner-1.15.1.dist-info/METADATA,sha256=7EXTte2u8T8ZQDDOho7VbKAqqvOz7d_zEWsjKOw_b34,7553
30
+ pypeline_runner-1.15.1.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
31
+ pypeline_runner-1.15.1.dist-info/entry_points.txt,sha256=pe1u0uuhPI_yeQ0KjEw6jK-EvQfPcZwBSajgbAdKz1o,47
32
+ pypeline_runner-1.15.1.dist-info/RECORD,,
@@ -1,31 +0,0 @@
1
- <#
2
- .DESCRIPTION
3
- Wrapper for installing dependencies
4
- #>
5
-
6
- function Invoke-Bootstrap {
7
- # Download bootstrap scripts from external repository
8
- Invoke-RestMethod https://raw.githubusercontent.com/avengineers/bootstrap-installer/v1.15.1/install.ps1 | Invoke-Expression
9
- # Execute bootstrap script
10
- . .\.bootstrap\bootstrap.ps1
11
- }
12
-
13
- ## start of script
14
- # Always set the $InformationPreference variable to "Continue" globally,
15
- # this way it gets printed on execution and continues execution afterwards.
16
- $InformationPreference = "Continue"
17
-
18
- # Stop on first error
19
- $ErrorActionPreference = "Stop"
20
-
21
- Push-Location $PSScriptRoot
22
- Write-Output "Running in ${pwd}"
23
-
24
- try {
25
- # bootstrap environment
26
- Invoke-Bootstrap
27
- }
28
- finally {
29
- Pop-Location
30
- }
31
- ## end of script
@@ -1,2 +0,0 @@
1
- [virtualenvs]
2
- in-project = true
@@ -1,14 +0,0 @@
1
- {
2
- "buckets": [
3
- {
4
- "Name": "versions",
5
- "Source": "https://github.com/ScoopInstaller/Versions"
6
- }
7
- ],
8
- "apps": [
9
- {
10
- "Source": "versions",
11
- "Name": "mingw-winlibs-llvm-ucrt"
12
- }
13
- ]
14
- }