|
2 | 2 |
|
3 | 3 | import os |
4 | 4 | from pathlib import Path |
5 | | -from rich.progress import Progress |
6 | | -from rich.progress import SpinnerColumn |
7 | | -from rich.progress import TextColumn |
| 5 | + |
8 | 6 | from rich import print |
| 7 | +from rich.progress import Progress, SpinnerColumn, TextColumn |
9 | 8 |
|
10 | | -from .environment import NEXUS_SOURCE_NAME |
11 | 9 | from ssb_project_cli.ssb_project.util import execute_command |
12 | | -from .environment import JUPYTER_IMAGE_SPEC |
13 | | -from .environment import PIP_INDEX_URL |
14 | | -from .environment import running_onprem |
| 10 | + |
| 11 | +from .environment import ( |
| 12 | + JUPYTER_IMAGE_SPEC, |
| 13 | + NEXUS_SOURCE_NAME, |
| 14 | + running_onprem, |
| 15 | +) |
15 | 16 |
|
16 | 17 |
|
17 | 18 | def poetry_install(project_directory: Path) -> None: |
@@ -136,14 +137,14 @@ def poetry_source_add( |
136 | 137 |
|
137 | 138 |
|
138 | 139 | def update_lock(cwd: Path) -> None: |
139 | | - """Runs poetry lock --no-update command in CWD. |
| 140 | + """Runs poetry lock command in CWD. |
140 | 141 |
|
141 | 142 | Args: |
142 | 143 | cwd: Path of project to add source to. |
143 | 144 | """ |
144 | 145 | print("Refreshing lock file...") |
145 | 146 | execute_command( |
146 | | - "poetry lock --no-update".split(" "), |
| 147 | + "poetry lock".split(" "), |
147 | 148 | "update_lock", |
148 | 149 | "Poetry successfully refreshed lock file!", |
149 | 150 | "Poetry failed to refresh lock file.", |
@@ -197,21 +198,15 @@ def install_ipykernel(project_directory: Path, project_name: str) -> None: |
197 | 198 | ) |
198 | 199 |
|
199 | 200 |
|
200 | | -def check_and_fix_onprem_source(project_root: Path) -> None: |
| 201 | +def check_and_remove_onprem_source(project_root: Path) -> None: |
201 | 202 | """Check if running onprem and fix source in pyproject.toml if so. |
202 | 203 |
|
203 | 204 | Args: |
204 | 205 | project_root: Path to the root of the project |
205 | 206 | """ |
206 | | - if running_onprem(JUPYTER_IMAGE_SPEC): |
207 | | - print( |
208 | | - ":twisted_rightwards_arrows:\tDetected onprem environment, using proxy for package installation" |
209 | | - ) |
210 | | - if poetry_source_includes_source_name(project_root): |
211 | | - poetry_source_remove(project_root, lock_update=False) |
212 | | - poetry_source_add(PIP_INDEX_URL, project_root) |
213 | | - elif poetry_source_includes_source_name(project_root): |
214 | | - print( |
215 | | - ":twisted_rightwards_arrows:\tDetected non-onprem environment, removing proxy for package installation" |
216 | | - ) |
| 207 | + if poetry_source_includes_source_name(project_root): |
| 208 | + if running_onprem(JUPYTER_IMAGE_SPEC): |
| 209 | + print( |
| 210 | + ":twisted_rightwards_arrows:\tRemoving proxy, it is no longer needed onprem" |
| 211 | + ) |
217 | 212 | poetry_source_remove(project_root) |
0 commit comments