gpustack-runner 0.1.23.post5__tar.gz → 0.1.24__tar.gz

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.
Files changed (134) hide show
  1. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/PKG-INFO +8 -2
  2. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/README.md +7 -1
  3. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/gpustack_runner/__init__.py +10 -0
  4. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/gpustack_runner/__main__.py +2 -0
  5. gpustack_runner-0.1.24/gpustack_runner/__utils__.py +155 -0
  6. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/gpustack_runner/_version.py +2 -2
  7. gpustack_runner-0.1.24/gpustack_runner/_version_appendix.py +1 -0
  8. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/gpustack_runner/cmds/__init__.py +2 -0
  9. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/gpustack_runner/cmds/images.py +381 -99
  10. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/gpustack_runner/envs.py +19 -3
  11. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/gpustack_runner/runner.py +1 -1
  12. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/gpustack_runner/runner.py.json +22 -0
  13. gpustack_runner-0.1.24/pack/.post_operation/20251213_mindie_patch_minicpm_qwen2_v2/cann/patches.zip +0 -0
  14. gpustack_runner-0.1.24/pack/cann/mindie-atb-models_2.2.rc1_linux-amd64_py3.11_torch2.1.0-abi0.tar.gz +0 -0
  15. gpustack_runner-0.1.24/pack/cann/mindie-atb-models_2.2.rc1_linux-arm64_py3.11_torch2.1.0-abi0.tar.gz +0 -0
  16. gpustack_runner-0.1.24/pack/cann/patches/mindie.zip +0 -0
  17. gpustack_runner-0.1.24/pack/hggc/Dockerfile +389 -0
  18. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/matrix.yaml +36 -11
  19. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/musa/Dockerfile +1 -2
  20. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tests/gpustack_runner/fixtures/test_list_runners_by_backend.json +30 -0
  21. gpustack_runner-0.1.24/tests/gpustack_runner/fixtures/test_merge_image.json +25 -0
  22. gpustack_runner-0.1.24/tests/gpustack_runner/fixtures/test_replace_image_with.json +58 -0
  23. gpustack_runner-0.1.24/tests/gpustack_runner/fixtures/test_split_image.json +43 -0
  24. gpustack_runner-0.1.24/tests/gpustack_runner/test_utils.py +47 -0
  25. gpustack_runner-0.1.23.post5/gpustack_runner/_version_appendix.py +0 -1
  26. gpustack_runner-0.1.23.post5/pack/.post_operation/20251213_mindie_patch_minicpm_qwen2_v2/cann/patches.zip +0 -3
  27. gpustack_runner-0.1.23.post5/pack/cann/mindie-atb-models_2.2.rc1_linux-amd64_py3.11_torch2.1.0-abi0.tar.gz +0 -3
  28. gpustack_runner-0.1.23.post5/pack/cann/mindie-atb-models_2.2.rc1_linux-arm64_py3.11_torch2.1.0-abi0.tar.gz +0 -3
  29. gpustack_runner-0.1.23.post5/pack/cann/patches/mindie.zip +0 -3
  30. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/.codespelldict +0 -0
  31. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/.codespellrc +0 -0
  32. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/.gitattributes +0 -0
  33. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/.gitignore +0 -0
  34. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/.pre-commit-config.yaml +0 -0
  35. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/.python-version +0 -0
  36. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/LICENSE +0 -0
  37. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/Makefile +0 -0
  38. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/docs/index.md +0 -0
  39. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/docs/modules/gpustack_runner.md +0 -0
  40. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/gpustack_runner/_version.pyi +0 -0
  41. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/gpustack_runner/cmds/__types__.py +0 -0
  42. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/hatch.toml +0 -0
  43. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/mkdocs.yml +0 -0
  44. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251020_vllm_install_lmcache/cann/Dockerfile +0 -0
  45. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251020_vllm_install_lmcache/cuda/Dockerfile +0 -0
  46. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251020_vllm_install_lmcache/matrix.yaml +0 -0
  47. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251020_vllm_install_lmcache/rocm/Dockerfile +0 -0
  48. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251022_vllm_install_ray_client/cann/Dockerfile +0 -0
  49. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251022_vllm_install_ray_client/cuda/Dockerfile +0 -0
  50. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251022_vllm_install_ray_client/matrix.yaml +0 -0
  51. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251022_vllm_install_ray_client/rocm/Dockerfile +0 -0
  52. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251022_vllm_install_ray_default/cuda/Dockerfile +0 -0
  53. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251022_vllm_install_ray_default/matrix.yaml +0 -0
  54. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251022_vllm_install_ray_default/rocm/Dockerfile +0 -0
  55. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251024_vllm_install_nvidia_hpcx/cuda/Dockerfile +0 -0
  56. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251024_vllm_install_nvidia_hpcx/matrix.yaml +0 -0
  57. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251024_vllm_reinstall_lmcache/cuda/Dockerfile +0 -0
  58. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251024_vllm_reinstall_lmcache/matrix.yaml +0 -0
  59. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251029_vllm_reinstall_ray/cann/Dockerfile +0 -0
  60. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251029_vllm_reinstall_ray/matrix.yaml +0 -0
  61. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251103_mindie_refresh_entrypoint/cann/Dockerfile +0 -0
  62. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251103_mindie_refresh_entrypoint/matrix.yaml +0 -0
  63. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251105_vllm_polish_nvidia_hpcx/cuda/Dockerfile +0 -0
  64. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251105_vllm_polish_nvidia_hpcx/matrix.yaml +0 -0
  65. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251106_vllm_install_ep_kernel/cuda/Dockerfile +0 -0
  66. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251106_vllm_install_ep_kernel/matrix.yaml +0 -0
  67. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251107_vllm_reinstall_lmcache/cuda/Dockerfile +0 -0
  68. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251107_vllm_reinstall_lmcache/matrix.yaml +0 -0
  69. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251110_sglang_install_diffusion/cuda/Dockerfile +0 -0
  70. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251110_sglang_install_diffusion/matrix.yaml +0 -0
  71. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251110_sglang_install_flashattn/cuda/Dockerfile +0 -0
  72. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251110_sglang_install_flashattn/matrix.yaml +0 -0
  73. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251125_mindie_install_posix_ipc/cann/Dockerfile +0 -0
  74. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251125_mindie_install_posix_ipc/matrix.yaml +0 -0
  75. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251201_vllm_patch_qwen2_5_vl/cuda/Dockerfile +0 -0
  76. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251201_vllm_patch_qwen2_5_vl/cuda/patches/vllm_001_disable_flashatten_in_qwen2_5_vl.patch +0 -0
  77. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251201_vllm_patch_qwen2_5_vl/matrix.yaml +0 -0
  78. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251209_mindie_install_av/cann/Dockerfile +0 -0
  79. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251209_mindie_install_av/matrix.yaml +0 -0
  80. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251213_mindie_patch_minicpm_qwen2_v2/cann/Dockerfile +0 -0
  81. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251213_mindie_patch_minicpm_qwen2_v2/matrix.yaml +0 -0
  82. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251213_sglang_patch_server_args/cuda/Dockerfile +0 -0
  83. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251213_sglang_patch_server_args/cuda/patches/sglang_001_fix_server_args.patch +0 -0
  84. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251213_sglang_patch_server_args/matrix.yaml +0 -0
  85. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251214_cuda_several_patches/cuda/Dockerfile +0 -0
  86. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251214_cuda_several_patches/matrix.yaml +0 -0
  87. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251215_cann_several_patches/cann/Dockerfile +0 -0
  88. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251215_cann_several_patches/matrix.yaml +0 -0
  89. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251216_sglang_uninstall_runai_model_streamer/cuda/Dockerfile +0 -0
  90. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251216_sglang_uninstall_runai_model_streamer/matrix.yaml +0 -0
  91. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251219_rocm_install_petit_kernel/matrix.yaml +0 -0
  92. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251219_rocm_install_petit_kernel/rocm/Dockerfile +0 -0
  93. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251219_vllm_install_audio_extra/cuda/Dockerfile +0 -0
  94. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251219_vllm_install_audio_extra/matrix.yaml +0 -0
  95. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251219_vllm_install_audio_extra/rocm/Dockerfile +0 -0
  96. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251224_mindie_patch_atb_config/cann/Dockerfile +0 -0
  97. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20251224_mindie_patch_atb_config/matrix.yaml +0 -0
  98. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20260105_vllm_install_omni/cann/Dockerfile +0 -0
  99. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20260105_vllm_install_omni/cuda/Dockerfile +0 -0
  100. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20260105_vllm_install_omni/matrix.yaml +0 -0
  101. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/20260105_vllm_install_omni/rocm/Dockerfile +0 -0
  102. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/.post_operation/README.md +0 -0
  103. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/cann/Dockerfile +0 -0
  104. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/corex/Dockerfile +0 -0
  105. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/cuda/Dockerfile +0 -0
  106. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/discard_runner.sh +0 -0
  107. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/dtk/Dockerfile +0 -0
  108. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/expand_matrix.sh +0 -0
  109. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/maca/Dockerfile +0 -0
  110. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/merge_runner.sh +0 -0
  111. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/prune_runner.sh +0 -0
  112. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/rocm/Dockerfile +0 -0
  113. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pack/rocm/patches/sglang_001_wrong_vram.patch +0 -0
  114. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pyproject.toml +0 -0
  115. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/pytest.ini +0 -0
  116. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/ruff.toml +0 -0
  117. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tests/gpustack_runner/fixtures/__init__.py +0 -0
  118. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tests/gpustack_runner/fixtures/test_docker_image.json +0 -0
  119. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tests/gpustack_runner/fixtures/test_list_backend_runners.json +0 -0
  120. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tests/gpustack_runner/fixtures/test_list_runners_by_prefix.json +0 -0
  121. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tests/gpustack_runner/fixtures/test_list_service_runners.json +0 -0
  122. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tests/gpustack_runner/test_runner.py +0 -0
  123. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tools/activate +0 -0
  124. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tools/chat.sh +0 -0
  125. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tools/chat_tool_current_date_time.sh +0 -0
  126. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tools/chat_tool_get_temperature.sh +0 -0
  127. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tools/chat_tool_get_weather.sh +0 -0
  128. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tools/chat_tool_square_of_number.sh +0 -0
  129. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tools/chat_tool_square_root_of_number.sh +0 -0
  130. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tools/chat_tool_where_am_i.sh +0 -0
  131. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tools/run_runner.sh +0 -0
  132. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/tools/run_runner_cluster.sh +0 -0
  133. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/uv.lock +0 -0
  134. {gpustack_runner-0.1.23.post5 → gpustack_runner-0.1.24}/uv.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gpustack-runner
3
- Version: 0.1.23.post5
3
+ Version: 0.1.24
4
4
  Summary: GPUStack Runner is library for registering runnable accelerated backends and services in GPUStack.
5
5
  Project-URL: Homepage, https://github.com/gpustack/runner
6
6
  Project-URL: Bug Tracker, https://github.com/gpustack/gpustack/issues
@@ -101,6 +101,12 @@ The following table lists the supported accelerated backends and their correspon
101
101
  |-----------------------------|----------------------------|
102
102
  | 25.04 | `0.11.0`, `0.9.2`, `0.8.5` |
103
103
 
104
+ ### THead HGGC
105
+
106
+ | HGGC Version <br/> (Variant) | vLLM | SGLang |
107
+ |------------------------------|----------|---------|
108
+ | 12.3 | `0.11.1` | `0.5.5` |
109
+
104
110
  ### MetaX MACA
105
111
 
106
112
  | MACA Version <br/> (Variant) | vLLM |
@@ -251,7 +257,7 @@ To add support for a new accelerated backend:
251
257
 
252
258
  1. Create a new directory under `pack/` named with the new backend.
253
259
  2. Add a `Dockerfile` in the new directory following the [Dockerfile Convention](#dockerfile-convention).
254
- 3. Update [pack.yml](.github/workflows/pack.yml) to include the new backend in the build matrix.
260
+ 3. Update [pack.yml](.github/workflows/pack.yml), [discard.yml](.github/workflows/discard.yml) and [prune.yml](.github/workflows/prune.yml) to include the new backend in the build matrix.
255
261
  4. Update [matrix.yml](pack/matrix.yaml) to include the new backend and its variants.
256
262
  5. Update `_RE_DOCKER_IMAGE` in [runner.py](gpustack_runner/runner.py) to recognize the new backend.
257
263
  6. [Optional] Update [tests](tests/gpustack_runner) if necessary.
@@ -81,6 +81,12 @@ The following table lists the supported accelerated backends and their correspon
81
81
  |-----------------------------|----------------------------|
82
82
  | 25.04 | `0.11.0`, `0.9.2`, `0.8.5` |
83
83
 
84
+ ### THead HGGC
85
+
86
+ | HGGC Version <br/> (Variant) | vLLM | SGLang |
87
+ |------------------------------|----------|---------|
88
+ | 12.3 | `0.11.1` | `0.5.5` |
89
+
84
90
  ### MetaX MACA
85
91
 
86
92
  | MACA Version <br/> (Variant) | vLLM |
@@ -231,7 +237,7 @@ To add support for a new accelerated backend:
231
237
 
232
238
  1. Create a new directory under `pack/` named with the new backend.
233
239
  2. Add a `Dockerfile` in the new directory following the [Dockerfile Convention](#dockerfile-convention).
234
- 3. Update [pack.yml](.github/workflows/pack.yml) to include the new backend in the build matrix.
240
+ 3. Update [pack.yml](.github/workflows/pack.yml), [discard.yml](.github/workflows/discard.yml) and [prune.yml](.github/workflows/prune.yml) to include the new backend in the build matrix.
235
241
  4. Update [matrix.yml](pack/matrix.yaml) to include the new backend and its variants.
236
242
  5. Update `_RE_DOCKER_IMAGE` in [runner.py](gpustack_runner/runner.py) to recognize the new backend.
237
243
  6. [Optional] Update [tests](tests/gpustack_runner) if necessary.
@@ -1,5 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from .__utils__ import (
4
+ merge_image,
5
+ parse_image,
6
+ replace_image_with,
7
+ split_image,
8
+ )
3
9
  from ._version import commit_id, version, version_tuple
4
10
  from .runner import (
5
11
  BackendRunners,
@@ -21,7 +27,11 @@ __all__ = [
21
27
  "list_backend_runners",
22
28
  "list_runners",
23
29
  "list_service_runners",
30
+ "merge_image",
31
+ "parse_image",
32
+ "replace_image_with",
24
33
  "set_re_docker_image",
34
+ "split_image",
25
35
  "version",
26
36
  "version_tuple",
27
37
  ]
@@ -11,6 +11,7 @@ from .cmds import (
11
11
  CompareImagesSubCommand,
12
12
  CopyImagesSubCommand,
13
13
  ListImagesSubCommand,
14
+ LoadImagesSubCommand,
14
15
  SaveImagesSubCommand,
15
16
  )
16
17
 
@@ -35,6 +36,7 @@ def main():
35
36
  SaveImagesSubCommand.register(subcommand_parser)
36
37
  CopyImagesSubCommand.register(subcommand_parser)
37
38
  CompareImagesSubCommand.register(subcommand_parser)
39
+ LoadImagesSubCommand.register(subcommand_parser)
38
40
 
39
41
  # Autocomplete
40
42
  argcomplete.autocomplete(parser)
@@ -0,0 +1,155 @@
1
+ from __future__ import annotations
2
+
3
+ _BLANK_TAG = "latest"
4
+
5
+
6
+ def split_image(image: str, fill_blank_tag: bool = False) -> tuple:
7
+ """
8
+ Split the Docker completed image string into its image_name([registry/][namespace/]repository) and image_tag.
9
+
10
+ Args:
11
+ image:
12
+ The Docker completed image string to split.
13
+ fill_blank_tag:
14
+ If True, fill the blank tag with `latest`.
15
+
16
+ Returns:
17
+ A tuple of (image_name, image_tag).
18
+
19
+ """
20
+ parts = image.rsplit("@", maxsplit=1)
21
+ if len(parts) == 2:
22
+ return tuple(parts)
23
+ parts = image.rsplit(":", maxsplit=1)
24
+ if len(parts) == 2 and "/" not in parts[1]:
25
+ if fill_blank_tag:
26
+ parts[1] = parts[1] or _BLANK_TAG
27
+ return tuple(parts)
28
+ return image, _BLANK_TAG if fill_blank_tag else None
29
+
30
+
31
+ def merge_image(image_name: str, image_tag: str | None = None) -> str:
32
+ """
33
+ Merge the Docker image and image_tag into a single string.
34
+
35
+ Args:
36
+ image_name:
37
+ The Docker image name, in form of [registry/][namespace/]repository.
38
+ image_tag:
39
+ The Docker image tag.
40
+
41
+ Returns:
42
+ The completed Docker image string.
43
+
44
+ """
45
+ if not image_tag:
46
+ return image_name
47
+ if image_tag.startswith("sha256:"):
48
+ return f"{image_name}@{image_tag}"
49
+ return f"{image_name}:{image_tag}"
50
+
51
+
52
+ def parse_image(
53
+ image: str,
54
+ fill_blank_tag: bool = False,
55
+ ) -> tuple[str | None, str | None, str, str | None] | None:
56
+ """
57
+ Parse the Docker image string into its components:
58
+ registry, namespace, repository, and tag.
59
+
60
+ Args:
61
+ image:
62
+ The Docker image string to parse.
63
+ fill_blank_tag:
64
+ If True, fill the blank tag with `latest`.
65
+
66
+ Returns:
67
+ A tuple of (registry, namespace, repository, tag).
68
+ Registry, namespace, and tag can be None if not present.
69
+ If the image string is invalid, return None.
70
+
71
+ """
72
+ image_reg, image_ns, image_repo, image_tag = (
73
+ None,
74
+ None,
75
+ None,
76
+ None,
77
+ )
78
+ image_rest = image.strip()
79
+
80
+ # Get tag.
81
+ image_rest, image_tag = split_image(image_rest, fill_blank_tag=fill_blank_tag)
82
+ if not image_rest:
83
+ return None
84
+
85
+ # Get repository.
86
+ parts = image_rest.rsplit("/", maxsplit=1)
87
+ if len(parts) == 2:
88
+ image_rest, image_repo = parts
89
+ else:
90
+ image_rest, image_repo = None, image_rest
91
+
92
+ # Get namespace.
93
+ if image_rest:
94
+ parts = image_rest.rsplit("/", maxsplit=1)
95
+ if len(parts) == 2:
96
+ image_reg, image_ns = parts
97
+ else:
98
+ image_reg, image_ns = None, image_rest
99
+
100
+ return image_reg, image_ns, image_repo, image_tag
101
+
102
+
103
+ def replace_image_with(
104
+ image: str,
105
+ registry: str | None = None,
106
+ namespace: str | None = None,
107
+ repository: str | None = None,
108
+ ) -> str:
109
+ """
110
+ Replace the registry, namespace, and repository of a Docker image string.
111
+
112
+ The given image string is parsed into its components (registry, namespace, repository, tag),
113
+ and the specified components are replaced with the provided values.
114
+
115
+ The format of a Docker image string is:
116
+ [registry/][namespace/]repository[:tag|@digest]
117
+
118
+ Args:
119
+ image:
120
+ The original Docker image string.
121
+ registry:
122
+ The new registry to use. If None, keep the original registry.
123
+ namespace:
124
+ The new namespace to use. If None, keep the original namespace.
125
+ repository:
126
+ The new repository to use. If None, keep the original repository.
127
+
128
+ Returns:
129
+ The modified Docker image string.
130
+
131
+ """
132
+ if not image or (not registry and not namespace and not repository):
133
+ return image
134
+
135
+ registry = registry.strip() if registry else None
136
+ namespace = namespace.strip() if namespace else None
137
+ repository = repository.strip() if repository else None
138
+
139
+ image_reg, image_ns, image_repo, image_tag = parse_image(image)
140
+
141
+ registry = registry or image_reg
142
+ namespace = namespace or image_ns
143
+ repository = repository or image_repo
144
+
145
+ image_name = ""
146
+ if registry:
147
+ image_name += f"{registry}/"
148
+ if namespace:
149
+ image_name += f"{namespace}/"
150
+ elif registry:
151
+ image_name += "library/"
152
+ image_name += repository
153
+
154
+ image = merge_image(image_name, image_tag)
155
+ return image
@@ -27,8 +27,8 @@ version_tuple: VERSION_TUPLE
27
27
  __commit_id__: COMMIT_ID
28
28
  commit_id: COMMIT_ID
29
29
 
30
- __version__ = version = '0.1.23.post5'
31
- __version_tuple__ = version_tuple = (0, 1, 23, 'post5')
30
+ __version__ = version = '0.1.24'
31
+ __version_tuple__ = version_tuple = (0, 1, 24)
32
32
  try:
33
33
  from ._version_appendix import git_commit
34
34
  __commit_id__ = commit_id = git_commit
@@ -0,0 +1 @@
1
+ git_commit = "c2b7172"
@@ -4,6 +4,7 @@ from .images import (
4
4
  CompareImagesSubCommand,
5
5
  CopyImagesSubCommand,
6
6
  ListImagesSubCommand,
7
+ LoadImagesSubCommand,
7
8
  PlatformedImage,
8
9
  SaveImagesSubCommand,
9
10
  append_images,
@@ -14,6 +15,7 @@ __all__ = [
14
15
  "CompareImagesSubCommand",
15
16
  "CopyImagesSubCommand",
16
17
  "ListImagesSubCommand",
18
+ "LoadImagesSubCommand",
17
19
  "PlatformedImage",
18
20
  "SaveImagesSubCommand",
19
21
  "append_images",