hte-cli 0.2.32__py3-none-any.whl → 0.2.33__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.
hte_cli/cli.py CHANGED
@@ -363,7 +363,7 @@ def session_join(ctx, session_id: str, force_setup: bool):
363
363
  extract_image_platforms_from_compose,
364
364
  pull_image_with_progress,
365
365
  check_image_architecture_matches_host,
366
- fix_image_architecture,
366
+ remove_image,
367
367
  get_host_docker_platform,
368
368
  is_running_in_linux_vm_on_arm,
369
369
  )
@@ -487,34 +487,69 @@ def session_join(ctx, session_id: str, force_setup: bool):
487
487
  cached_images.append(img)
488
488
  continue
489
489
  else:
490
- # Architecture mismatch detected - this is the key fix for Linux ARM64
490
+ # Architecture mismatch detected - remove and re-pull with correct arch
491
491
  console.print(
492
492
  f" [yellow]⚠[/yellow] {short_name} [yellow]architecture mismatch![/yellow]"
493
493
  )
494
494
  console.print(
495
495
  f" [dim]Cached image: {image_arch} | Host: {host_arch}[/dim]"
496
496
  )
497
- console.print(
498
- " [dim]Removing cached image and re-pulling correct architecture...[/dim]"
499
- )
500
497
 
501
- needed_fix, fix_msg = fix_image_architecture(img)
502
- if needed_fix:
498
+ # Remove the wrongly-cached image
499
+ if not remove_image(img):
500
+ console.print(
501
+ f" [red]✗[/red] {short_name} [dim](failed to remove cached image)[/dim]"
502
+ )
503
+ failed_images.append(img)
504
+ pull_errors[img] = "failed to remove cached image"
505
+ continue
506
+
507
+ # Re-pull with correct platform and progress display
508
+ last_status = ["connecting..."]
509
+ last_error = [""]
510
+
511
+ with console.status(
512
+ f"[yellow]↓[/yellow] {short_name} [dim]re-pulling for {host_arch}...[/dim]"
513
+ ) as status:
514
+
515
+ def show_progress(image: str, line: str):
516
+ if ": " in line:
517
+ parts = line.split(": ", 1)
518
+ if len(parts) == 2:
519
+ layer_id = parts[0][-8:]
520
+ layer_status = parts[1][:85]
521
+ display = f"{layer_id}: {layer_status}"
522
+ if display != last_status[0]:
523
+ last_status[0] = display
524
+ status.update(
525
+ f"[yellow]↓[/yellow] {short_name} [dim]{display}[/dim]"
526
+ )
527
+ if "error" in line.lower() or "denied" in line.lower():
528
+ last_error[0] = line
529
+
530
+ success = pull_image_with_progress(
531
+ img, platform=host_platform, on_progress=show_progress
532
+ )
533
+
534
+ if success:
503
535
  console.print(
504
- f" [green]✓[/green] {short_name} [green]fixed![/green] [dim]({fix_msg})[/dim]"
536
+ f" [green]✓[/green] {short_name} [green]fixed![/green] [dim](re-pulled as {host_platform.split('/')[-1]})[/dim]"
505
537
  )
506
538
  pulled_images.append(img)
507
539
  continue
508
- elif "failed to re-pull" in fix_msg:
509
- # No ARM variant available - this is an x86-only image
510
- # Re-pull the amd64 version and warn about QEMU
540
+ else:
541
+ # ARM re-pull failed - try without platform constraint (x86 fallback)
511
542
  console.print(
512
- " [dim]No ARM variant available - re-pulling x86 version...[/dim]"
543
+ " [dim]No ARM variant - trying x86 fallback...[/dim]"
513
544
  )
514
- success = pull_image_with_progress(img)
545
+ with console.status(
546
+ f"[yellow]↓[/yellow] {short_name} [dim]pulling x86...[/dim]"
547
+ ) as status:
548
+ success = pull_image_with_progress(img, on_progress=show_progress)
549
+
515
550
  if success:
516
551
  console.print(
517
- f" [yellow]![/yellow] {short_name} [dim](x86-only image, needs QEMU)[/dim]"
552
+ f" [yellow]![/yellow] {short_name} [dim](x86-only, needs QEMU)[/dim]"
518
553
  )
519
554
  x86_images_on_arm.append(img)
520
555
  pulled_images.append(img)
@@ -523,14 +558,11 @@ def session_join(ctx, session_id: str, force_setup: bool):
523
558
  console.print(
524
559
  f" [red]✗[/red] {short_name} [dim](failed to pull)[/dim]"
525
560
  )
561
+ if last_error[0]:
562
+ console.print(f" [dim]{last_error[0][:60]}[/dim]")
563
+ pull_errors[img] = last_error[0]
526
564
  failed_images.append(img)
527
- pull_errors[img] = "failed to pull x86 fallback"
528
565
  continue
529
- else:
530
- console.print(f" [red]✗[/red] {short_name} [dim]({fix_msg})[/dim]")
531
- failed_images.append(img)
532
- pull_errors[img] = fix_msg
533
- continue
534
566
 
535
567
  # Need to pull - show progress
536
568
  last_status = ["connecting..."]
hte_cli/image_utils.py CHANGED
@@ -222,58 +222,6 @@ def remove_image(image: str) -> bool:
222
222
  return False
223
223
 
224
224
 
225
- def fix_image_architecture(
226
- image: str,
227
- on_status: Callable[[str], None] | None = None,
228
- ) -> tuple[bool, str]:
229
- """
230
- Check if a cached image has wrong architecture and fix it if needed.
231
-
232
- For Linux ARM64 hosts (e.g., VM on Apple Silicon), this:
233
- 1. Checks if the cached image is amd64 when host is arm64
234
- 2. Removes the wrongly-cached image
235
- 3. Re-pulls with explicit --platform linux/arm64
236
-
237
- Args:
238
- image: Image name to check/fix
239
- on_status: Callback for status updates
240
-
241
- Returns:
242
- Tuple of (needed_fix, message):
243
- - needed_fix: True if image was re-pulled
244
- - message: Description of what happened
245
- """
246
- matches, image_arch, host_arch = check_image_architecture_matches_host(image)
247
-
248
- if matches:
249
- if image_arch:
250
- return (False, f"architecture OK ({image_arch})")
251
- else:
252
- return (False, "not cached")
253
-
254
- # Architecture mismatch detected
255
- host_platform = get_host_docker_platform()
256
- if not host_platform:
257
- return (False, f"unknown host architecture: {host_arch}")
258
-
259
- if on_status:
260
- on_status(f"Cached image is {image_arch}, host is {host_arch} - re-pulling...")
261
-
262
- # Remove the wrongly-cached image
263
- logger.info(f"Removing wrongly-cached {image_arch} image: {image}")
264
- if not remove_image(image):
265
- return (False, f"failed to remove cached {image_arch} image")
266
-
267
- # Re-pull with correct platform
268
- logger.info(f"Re-pulling {image} with platform {host_platform}")
269
- success = pull_image_with_progress(image, platform=host_platform)
270
-
271
- if success:
272
- return (True, f"re-pulled as {host_platform.split('/')[-1]}")
273
- else:
274
- return (False, f"failed to re-pull with platform {host_platform}")
275
-
276
-
277
225
  def pull_image_with_progress(
278
226
  image: str,
279
227
  platform: str | None = None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hte-cli
3
- Version: 0.2.32
3
+ Version: 0.2.33
4
4
  Summary: Human Time-to-Completion Evaluation CLI
5
5
  Project-URL: Homepage, https://github.com/sean-peters-au/lyptus-mono
6
6
  Author: Lyptus Research
@@ -1,15 +1,15 @@
1
1
  hte_cli/__init__.py,sha256=fDGXp-r8bIoLtlQnn5xJ_CpwMhonvk9bGjZQsjA2mDI,914
2
2
  hte_cli/__main__.py,sha256=63n0gNGfskidWDU0aAIF2N8lylVCLYKVIkrN9QiORoo,107
3
3
  hte_cli/api_client.py,sha256=VWl6xvP9X3Qj8Eki-7YOZqd_TkdgfhqJ-hB4BfSAveo,9881
4
- hte_cli/cli.py,sha256=b1n-oDpdXoRBnjwSpP_MZhv-SJ9VJRXN_6s4CGy_DzQ,45814
4
+ hte_cli/cli.py,sha256=DkBAWm8mBSXqEQatjcqEXv90pjT-Z_4oBun7wjCPnGo,47506
5
5
  hte_cli/config.py,sha256=42Xv__YMSeRLs2zhGukJkIXFKtnBtYCHnONfViGyt2g,3387
6
6
  hte_cli/errors.py,sha256=1J5PpxcUKBu6XjigMMCPOq4Zc12tnv8LhAsiaVFWLQM,2762
7
7
  hte_cli/events.py,sha256=oDKCS-a0IZ7bz7xkwQj5eM4DoDCYvnclAGohrMTWf8s,5644
8
- hte_cli/image_utils.py,sha256=LxhbfNMneVPoWjDS1owgzqfWbeGNaUdYKL-b-EKb_Lg,12920
8
+ hte_cli/image_utils.py,sha256=eiXD5wtYycLNUH36bAYANQ-t4_9PEBWht8OHt9rohuw,11160
9
9
  hte_cli/runner.py,sha256=SWl9FF4X3e9eBbZyL0ujhmmSL5OK8J6st-Ty0jD5AWM,14550
10
10
  hte_cli/scorers.py,sha256=B0ZjQ3Fh-VDkc_8CDc86yW7vpdimbV3RSqs7l-VeUIg,6629
11
11
  hte_cli/version_check.py,sha256=WVZyGy2XfAghQYdd2N9-0Qfg-7pgp9gt4761-PnmacI,1708
12
- hte_cli-0.2.32.dist-info/METADATA,sha256=-W1mbkgSK3zQTF1t5CI09KJJsXTXHP2iPhCWEzk7bs0,3820
13
- hte_cli-0.2.32.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
14
- hte_cli-0.2.32.dist-info/entry_points.txt,sha256=XbyEEi1H14DFAt0Kdl22e_IRVEGzimSzYSh5HlhKlFA,41
15
- hte_cli-0.2.32.dist-info/RECORD,,
12
+ hte_cli-0.2.33.dist-info/METADATA,sha256=kKudB7JkhFq_5ALnhXktggKQAeCwAz3lLuur8yHwzFI,3820
13
+ hte_cli-0.2.33.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
14
+ hte_cli-0.2.33.dist-info/entry_points.txt,sha256=XbyEEi1H14DFAt0Kdl22e_IRVEGzimSzYSh5HlhKlFA,41
15
+ hte_cli-0.2.33.dist-info/RECORD,,