pypeline-runner 1.16.1__py3-none-any.whl → 1.18.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 +1 -1
- pypeline/bootstrap/run.py +14 -3
- pypeline/steps/create_venv.py +28 -3
- {pypeline_runner-1.16.1.dist-info → pypeline_runner-1.18.0.dist-info}/METADATA +1 -1
- {pypeline_runner-1.16.1.dist-info → pypeline_runner-1.18.0.dist-info}/RECORD +8 -8
- {pypeline_runner-1.16.1.dist-info → pypeline_runner-1.18.0.dist-info}/WHEEL +1 -1
- {pypeline_runner-1.16.1.dist-info → pypeline_runner-1.18.0.dist-info}/LICENSE +0 -0
- {pypeline_runner-1.16.1.dist-info → pypeline_runner-1.18.0.dist-info}/entry_points.txt +0 -0
pypeline/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.
|
|
1
|
+
__version__ = "1.18.0"
|
pypeline/bootstrap/run.py
CHANGED
|
@@ -298,12 +298,13 @@ class UnixVirtualEnvironment(VirtualEnvironment):
|
|
|
298
298
|
|
|
299
299
|
|
|
300
300
|
class CreateVirtualEnvironment:
|
|
301
|
-
def __init__(self, root_dir: Path, package_manager: str) -> None:
|
|
301
|
+
def __init__(self, root_dir: Path, package_manager: str, skip_venv_creation: bool = False) -> None:
|
|
302
302
|
self.root_dir = root_dir
|
|
303
303
|
self.venv_dir = self.root_dir / ".venv"
|
|
304
304
|
self.virtual_env = self.instantiate_os_specific_venv(self.venv_dir)
|
|
305
305
|
self.package_manager = package_manager.replace('"', "").replace("'", "")
|
|
306
306
|
self.execution_info_file = self.venv_dir / "virtual_env_exec_info.json"
|
|
307
|
+
self.skip_venv_creation = skip_venv_creation
|
|
307
308
|
|
|
308
309
|
@property
|
|
309
310
|
def package_manager_name(self) -> str:
|
|
@@ -320,7 +321,10 @@ class CreateVirtualEnvironment:
|
|
|
320
321
|
return "install"
|
|
321
322
|
|
|
322
323
|
def run(self) -> int:
|
|
323
|
-
self.
|
|
324
|
+
if not self.skip_venv_creation:
|
|
325
|
+
self.virtual_env.create()
|
|
326
|
+
else:
|
|
327
|
+
logger.info("Skipping virtual environment creation as requested.")
|
|
324
328
|
|
|
325
329
|
# Get the PyPi source from pyproject.toml or Pipfile if it is defined
|
|
326
330
|
pypi_source = PyPiSourceParser.from_pyproject(self.root_dir)
|
|
@@ -377,9 +381,16 @@ def main() -> int:
|
|
|
377
381
|
default=Path.cwd(),
|
|
378
382
|
help="Specify the project directory (default: current working directory).",
|
|
379
383
|
)
|
|
384
|
+
parser.add_argument(
|
|
385
|
+
"--skip-venv-creation",
|
|
386
|
+
action="store_true",
|
|
387
|
+
required=False,
|
|
388
|
+
default=False,
|
|
389
|
+
help="Skip the virtual environment creation process.",
|
|
390
|
+
)
|
|
380
391
|
args = parser.parse_args()
|
|
381
392
|
|
|
382
|
-
CreateVirtualEnvironment(args.project_dir, package_manager=args.package_manager).run()
|
|
393
|
+
CreateVirtualEnvironment(args.project_dir, package_manager=args.package_manager, skip_venv_creation=args.skip_venv_creation).run()
|
|
383
394
|
except UserNotificationException as e:
|
|
384
395
|
logger.error(e)
|
|
385
396
|
return 1
|
pypeline/steps/create_venv.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import re
|
|
2
|
+
import sys
|
|
2
3
|
from dataclasses import dataclass
|
|
3
4
|
from enum import Enum, auto
|
|
4
5
|
from pathlib import Path
|
|
@@ -41,7 +42,7 @@ class CreateVEnv(PipelineStep[ExecutionContext]):
|
|
|
41
42
|
self.bootstrap_script_type = BootstrapScriptType.CUSTOM if self.user_config.bootstrap_script else BootstrapScriptType.INTERNAL
|
|
42
43
|
super().__init__(execution_context, group_name, config)
|
|
43
44
|
self.logger = logger.bind()
|
|
44
|
-
self.
|
|
45
|
+
self.internal_bootstrap_script = get_bootstrap_script()
|
|
45
46
|
self.package_manager = self.user_config.package_manager if self.user_config.package_manager else self.DEFAULT_PACKAGE_MANAGER
|
|
46
47
|
self.python_executable = self.user_config.python_executable if self.user_config.python_executable else self.DEFAULT_PYTHON_EXECUTABLE
|
|
47
48
|
self.venv_dir = self.project_root_dir / ".venv"
|
|
@@ -62,6 +63,10 @@ class CreateVEnv(PipelineStep[ExecutionContext]):
|
|
|
62
63
|
else:
|
|
63
64
|
raise UserNotificationException(f"Could not extract the package manager name from {self.package_manager}")
|
|
64
65
|
|
|
66
|
+
@property
|
|
67
|
+
def target_internal_bootstrap_script(self) -> Path:
|
|
68
|
+
return self.project_root_dir.joinpath(".bootstrap/bootstrap.py")
|
|
69
|
+
|
|
65
70
|
def get_name(self) -> str:
|
|
66
71
|
return self.__class__.__name__
|
|
67
72
|
|
|
@@ -77,6 +82,12 @@ class CreateVEnv(PipelineStep[ExecutionContext]):
|
|
|
77
82
|
cwd=self.project_root_dir,
|
|
78
83
|
).execute()
|
|
79
84
|
else:
|
|
85
|
+
skip_venv_creation = False
|
|
86
|
+
python_executable = Path(sys.executable).absolute()
|
|
87
|
+
if python_executable.is_relative_to(self.project_root_dir):
|
|
88
|
+
self.logger.info(f"Detected that the python executable '{python_executable}' is from the virtual environment. Skip updating the virtual environment.")
|
|
89
|
+
skip_venv_creation = True
|
|
90
|
+
|
|
80
91
|
# The internal bootstrap script supports arguments.
|
|
81
92
|
bootstrap_args = [
|
|
82
93
|
"--project-dir",
|
|
@@ -84,10 +95,21 @@ class CreateVEnv(PipelineStep[ExecutionContext]):
|
|
|
84
95
|
"--package-manager",
|
|
85
96
|
f'"{self.package_manager}"',
|
|
86
97
|
]
|
|
98
|
+
if skip_venv_creation:
|
|
99
|
+
bootstrap_args.append("--skip-venv-creation")
|
|
100
|
+
|
|
101
|
+
# Copy the internal bootstrap script to the project root .bootstrap/bootstrap.py
|
|
102
|
+
self.target_internal_bootstrap_script.parent.mkdir(exist_ok=True)
|
|
103
|
+
if not self.target_internal_bootstrap_script.exists() or self.target_internal_bootstrap_script.read_text() != self.internal_bootstrap_script.read_text():
|
|
104
|
+
self.target_internal_bootstrap_script.write_text(self.internal_bootstrap_script.read_text())
|
|
105
|
+
self.logger.warning(f"Updated bootstrap script at {self.target_internal_bootstrap_script}")
|
|
106
|
+
|
|
107
|
+
# Run the copied bootstrap script
|
|
87
108
|
self.execution_context.create_process_executor(
|
|
88
|
-
[self.python_executable, self.
|
|
109
|
+
[self.python_executable, self.target_internal_bootstrap_script.as_posix(), *bootstrap_args],
|
|
89
110
|
cwd=self.project_root_dir,
|
|
90
111
|
).execute()
|
|
112
|
+
|
|
91
113
|
return 0
|
|
92
114
|
|
|
93
115
|
def get_inputs(self) -> List[Path]:
|
|
@@ -95,7 +117,10 @@ class CreateVEnv(PipelineStep[ExecutionContext]):
|
|
|
95
117
|
return [self.project_root_dir / file for file in package_manager_relevant_file]
|
|
96
118
|
|
|
97
119
|
def get_outputs(self) -> List[Path]:
|
|
98
|
-
|
|
120
|
+
outputs = [self.venv_dir]
|
|
121
|
+
if self.bootstrap_script_type == BootstrapScriptType.INTERNAL:
|
|
122
|
+
outputs.append(self.target_internal_bootstrap_script)
|
|
123
|
+
return outputs
|
|
99
124
|
|
|
100
125
|
def get_config(self) -> Optional[dict[str, str]]:
|
|
101
126
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
pypeline/__init__.py,sha256=
|
|
1
|
+
pypeline/__init__.py,sha256=eOdR8Sg_yEJg0qk8bqKXxy1LJBKxzo3fV50mKHzE9zE,23
|
|
2
2
|
pypeline/__run.py,sha256=TCdaX05Qm3g8T4QYryKB25Xxf0L5Km7hFOHe1mK9vI0,350
|
|
3
3
|
pypeline/bootstrap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
pypeline/bootstrap/run.py,sha256=
|
|
4
|
+
pypeline/bootstrap/run.py,sha256=STvSIzl6KpJj2lXbTeFr6mJnJQcjPR-BXD7enoWUlto,16436
|
|
5
5
|
pypeline/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
pypeline/domain/artifacts.py,sha256=5k7cVfHhLmvWXNuHKxXb9ca4Lxu0JytGQqazENCeKEU,1404
|
|
7
7
|
pypeline/domain/config.py,sha256=6vWdHi7B6MA7NGi9wWXQE-YhSg1COSRmc3b1ji6AdAk,2053
|
|
@@ -21,12 +21,12 @@ pypeline/main.py,sha256=2mC2BDB1OWIXhaijBXG6Y1vfT8_yMZ4Dj55w5u7g7-w,4158
|
|
|
21
21
|
pypeline/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
pypeline/pypeline.py,sha256=-mquLfFlEvESk-HORhvjRMESIzdlVAgBLPjwUDOPLqg,7452
|
|
23
23
|
pypeline/steps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
-
pypeline/steps/create_venv.py,sha256=
|
|
24
|
+
pypeline/steps/create_venv.py,sha256=ioL59vC1GbEk_EpUFMRRkWXk8W7z7QCEV-zgcho_lSg,6292
|
|
25
25
|
pypeline/steps/env_setup_script.py,sha256=u08A6pvMccFQbcnU0xruFvpU30PbDrttnbOjl1gDqog,2340
|
|
26
26
|
pypeline/steps/scoop_install.py,sha256=DDXBD-5TVaT-u6Yf7A85uWoCgBVmLvj9nPGrZ8OQCz0,3853
|
|
27
27
|
pypeline/steps/west_install.py,sha256=hPyr28ksdKsQ0tv0gMNytzupgk1IgjN9CpmaBdX5zps,1947
|
|
28
|
-
pypeline_runner-1.
|
|
29
|
-
pypeline_runner-1.
|
|
30
|
-
pypeline_runner-1.
|
|
31
|
-
pypeline_runner-1.
|
|
32
|
-
pypeline_runner-1.
|
|
28
|
+
pypeline_runner-1.18.0.dist-info/LICENSE,sha256=sKxdoqSmW9ezvPvt0ZGJbneyA0SBcm0GiqzTv2jN230,1066
|
|
29
|
+
pypeline_runner-1.18.0.dist-info/METADATA,sha256=yNndVifPIjTKD-7CI8z2ccPLVgMnP-R4BZa_vDhtFQw,7553
|
|
30
|
+
pypeline_runner-1.18.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
31
|
+
pypeline_runner-1.18.0.dist-info/entry_points.txt,sha256=pe1u0uuhPI_yeQ0KjEw6jK-EvQfPcZwBSajgbAdKz1o,47
|
|
32
|
+
pypeline_runner-1.18.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|