hugpy-wrapper 0.1.211__tar.gz → 0.2.0__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 (293) hide show
  1. hugpy_wrapper-0.2.0/PKG-INFO +49 -0
  2. hugpy_wrapper-0.2.0/README.md +35 -0
  3. hugpy_wrapper-0.2.0/pyproject.toml +26 -0
  4. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/__init__.py +9 -8
  5. hugpy_wrapper-0.2.0/src/hugpy_wrapper/__main__.py +7 -0
  6. hugpy_wrapper-0.2.0/src/hugpy_wrapper/cli.py +152 -0
  7. hugpy_wrapper-0.2.0/src/hugpy_wrapper/discovery/__init__.py +13 -0
  8. hugpy_wrapper-0.2.0/src/hugpy_wrapper/discovery/accommodate.py +47 -0
  9. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/discovery/client.py +73 -42
  10. hugpy_wrapper-0.2.0/src/hugpy_wrapper/engine/__init__.py +5 -0
  11. hugpy_wrapper-0.2.0/src/hugpy_wrapper/engine/client.py +237 -0
  12. hugpy_wrapper-0.2.0/src/hugpy_wrapper/engine/progress.py +63 -0
  13. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/engines/__init__.py +3 -2
  14. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/engines/llama.py +250 -141
  15. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/engines/loadfit.py +8 -9
  16. hugpy_wrapper-0.2.0/src/hugpy_wrapper/fleet_update.py +219 -0
  17. hugpy_wrapper-0.2.0/src/hugpy_wrapper/imports/__init__.py +15 -0
  18. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/imports/constants.py +141 -69
  19. hugpy_wrapper-0.2.0/src/hugpy_wrapper/imports/functions/__init__.py +5 -0
  20. hugpy_wrapper-0.2.0/src/hugpy_wrapper/imports/functions/front_door.py +39 -0
  21. hugpy_wrapper-0.2.0/src/hugpy_wrapper/imports/functions/units.py +7 -0
  22. hugpy_wrapper-0.2.0/src/hugpy_wrapper/imports/init_imports.py +111 -0
  23. hugpy_wrapper-0.2.0/src/hugpy_wrapper/imports/module_imports.py +80 -0
  24. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/queue/central.py +28 -44
  25. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/queue/dashboard.py +18 -11
  26. hugpy_wrapper-0.2.0/src/hugpy_wrapper/queue/forward.py +139 -0
  27. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/queue/groups.py +64 -28
  28. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/queue/link.py +34 -9
  29. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/queue/options.py +290 -33
  30. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/queue/plan.py +10 -3
  31. hugpy_wrapper-0.2.0/src/hugpy_wrapper/queue/presence.py +58 -0
  32. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/queue/rows.py +118 -28
  33. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/queue/run.py +1024 -223
  34. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/queue/serve.py +355 -171
  35. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/queue/storage.py +9 -6
  36. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/queue/telemetry.py +241 -17
  37. hugpy_wrapper-0.2.0/src/hugpy_wrapper/queue/templates.py +251 -0
  38. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/resources/__init__.py +6 -5
  39. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/resources/collect.py +8 -2
  40. hugpy_wrapper-0.2.0/src/hugpy_wrapper/resources/fit.py +472 -0
  41. hugpy_wrapper-0.2.0/src/hugpy_wrapper/resources/placement.py +289 -0
  42. hugpy_wrapper-0.2.0/src/hugpy_wrapper/sql/__init__.py +45 -0
  43. {hugpy_wrapper-0.1.211/src/hugpy_wrapper/imports → hugpy_wrapper-0.2.0/src/hugpy_wrapper/sql}/browser.py +7 -6
  44. hugpy_wrapper-0.1.211/src/hugpy_wrapper/imports/functions.py → hugpy_wrapper-0.2.0/src/hugpy_wrapper/sql/connections.py +11 -12
  45. hugpy_wrapper-0.1.211/src/hugpy_wrapper/discovery/query.py → hugpy_wrapper-0.2.0/src/hugpy_wrapper/sql/discovery.py +31 -15
  46. hugpy_wrapper-0.2.0/src/hugpy_wrapper/sql/engines_table.py +81 -0
  47. hugpy_wrapper-0.2.0/src/hugpy_wrapper/sql/feasibility.py +431 -0
  48. hugpy_wrapper-0.2.0/src/hugpy_wrapper/sql/feasibility_read.py +50 -0
  49. hugpy_wrapper-0.2.0/src/hugpy_wrapper/sql/fleet_status.py +41 -0
  50. hugpy_wrapper-0.1.211/src/hugpy_wrapper/resources/store.py → hugpy_wrapper-0.2.0/src/hugpy_wrapper/sql/kernel_log.py +66 -2
  51. hugpy_wrapper-0.1.211/src/hugpy_wrapper/resources/read.py → hugpy_wrapper-0.2.0/src/hugpy_wrapper/sql/kernel_read.py +11 -1
  52. hugpy_wrapper-0.2.0/src/hugpy_wrapper/sql/servable.py +159 -0
  53. hugpy_wrapper-0.1.211/src/hugpy_wrapper/imports/sql.py → hugpy_wrapper-0.2.0/src/hugpy_wrapper/sql/statements.py +231 -124
  54. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/db.py → hugpy_wrapper-0.2.0/src/hugpy_wrapper/sql/wrapper.py +123 -34
  55. hugpy_wrapper-0.2.0/src/hugpy_wrapper/system/__init__.py +18 -0
  56. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/system/__main__.py +3 -1
  57. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/system/core_link.py +10 -5
  58. hugpy_wrapper-0.2.0/src/hugpy_wrapper/system/engines.py +95 -0
  59. hugpy_wrapper-0.2.0/src/hugpy_wrapper/system/install.py +610 -0
  60. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/tools/feasibility.py +7 -3
  61. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/tools/resource_db.py +10 -6
  62. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/tools/resource_read.py +6 -3
  63. hugpy_wrapper-0.2.0/src/hugpy_wrapper.egg-info/PKG-INFO +49 -0
  64. hugpy_wrapper-0.2.0/src/hugpy_wrapper.egg-info/SOURCES.txt +70 -0
  65. hugpy_wrapper-0.2.0/src/hugpy_wrapper.egg-info/entry_points.txt +2 -0
  66. hugpy_wrapper-0.2.0/src/hugpy_wrapper.egg-info/requires.txt +7 -0
  67. hugpy_wrapper-0.1.211/PKG-INFO +0 -151
  68. hugpy_wrapper-0.1.211/README.md +0 -137
  69. hugpy_wrapper-0.1.211/pyproject.toml +0 -34
  70. hugpy_wrapper-0.1.211/src/hugpy_wrapper/cli.py +0 -54
  71. hugpy_wrapper-0.1.211/src/hugpy_wrapper/discovery/__init__.py +0 -13
  72. hugpy_wrapper-0.1.211/src/hugpy_wrapper/discovery/accommodate.py +0 -63
  73. hugpy_wrapper-0.1.211/src/hugpy_wrapper/discovery/snapshot.py +0 -46
  74. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/central-offers.json +0 -1
  75. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/feasibility.py +0 -181
  76. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/profiles.json +0 -184
  77. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/profiles.py +0 -165
  78. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/registry.lock.json +0 -86
  79. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/registry.py +0 -160
  80. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/registry_compile.py +0 -222
  81. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/3d/0-mesh3d.json +0 -19
  82. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/3d/profile-mesh3d.json +0 -11
  83. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/_categories.json +0 -23
  84. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/_shared/profile-compressed.json +0 -7
  85. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/_shared/profile-gptq.json +0 -12
  86. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/_shared/profile-sglang.json +0 -8
  87. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/_shared/profile-transformers.json +0 -9
  88. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/_shared/profile-vision.json +0 -8
  89. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/_shared/profile-vllm.json +0 -8
  90. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/audio/0-tts.json +0 -33
  91. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/audio/1-tts_kokoro.json +0 -24
  92. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/audio/2-tts_dia.json +0 -23
  93. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/audio/3-tts_parler.json +0 -24
  94. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/audio/4-automatic-speech-recognition.json +0 -28
  95. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/audio/profile-asr.json +0 -8
  96. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/audio/profile-tts.json +0 -8
  97. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/audio/profile-tts_dia.json +0 -5
  98. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/audio/profile-tts_kokoro.json +0 -9
  99. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/audio/profile-tts_parler.json +0 -10
  100. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/embeddings/0-embeddings.json +0 -37
  101. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/embeddings/profile-embed.json +0 -7
  102. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/images/0-imagegen.json +0 -29
  103. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/images/1-comfy.json +0 -23
  104. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/images/profile-comfy.json +0 -39
  105. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/images/profile-imagegen.json +0 -13
  106. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/keywords/0-keywords.json +0 -21
  107. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/keywords/profile-keywords.json +0 -8
  108. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/summarize/0-summarize.json +0 -27
  109. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/videos/0-videointerp.json +0 -21
  110. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/videos/1-videoupres.json +0 -23
  111. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/videos/2-videogen.json +0 -42
  112. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/videos/4-char360.json +0 -22
  113. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/videos/profile-char360.json +0 -14
  114. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner/videos/profile-videogen.json +0 -16
  115. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runner_specs.json +0 -583
  116. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/PROVENANCE.md +0 -218
  117. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/__init__.py +0 -7
  118. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/cli/__init__.py +0 -2
  119. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/cli/scout_evidence.py +0 -343
  120. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/__init__.py +0 -1
  121. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/backends.py +0 -166
  122. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/bnb4_convert.py +0 -160
  123. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/comfy_families.py +0 -185
  124. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/dequant.py +0 -309
  125. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/discovery.py +0 -231
  126. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/moe_split.py +0 -41
  127. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/placement.py +0 -64
  128. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/profiles.py +0 -603
  129. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/RIFE_LICENSE.txt +0 -21
  130. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/__init__.py +0 -489
  131. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/asr.py +0 -351
  132. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/char360.py +0 -437
  133. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/comfy.py +0 -554
  134. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/embed.py +0 -173
  135. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/imagegen.py +0 -618
  136. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/keywords.py +0 -209
  137. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/mesh3d.py +0 -501
  138. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/rife_network.py +0 -173
  139. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/rife_warp.py +0 -17
  140. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/summarize.py +0 -384
  141. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/tts.py +0 -690
  142. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/videogen.py +0 -1707
  143. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/videointerp.py +0 -156
  144. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/runners/videoupres.py +0 -297
  145. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/shared.py +0 -284
  146. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/task_child.py +0 -562
  147. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/tf_child.py +0 -569
  148. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/engines/vision_child.py +0 -569
  149. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/__init__.py +0 -33
  150. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/classes/__init__.py +0 -24
  151. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/classes/runners.py +0 -54
  152. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/__init__.py +0 -891
  153. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/admission.py +0 -13
  154. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/audio.py +0 -70
  155. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/authentication.py +0 -23
  156. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/cli.py +0 -158
  157. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/context.py +0 -69
  158. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/cpu.py +0 -23
  159. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/discovery.py +0 -431
  160. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/engines.py +0 -171
  161. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/environment.py +0 -113
  162. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/estimation.py +0 -61
  163. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/hardware.py +0 -27
  164. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/memory.py +0 -11
  165. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/models.py +0 -45
  166. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/observability.py +0 -39
  167. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/placement.py +0 -199
  168. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/policy.py +0 -14
  169. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/prediction.py +0 -5
  170. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/runners.py +0 -211
  171. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/serving.py +0 -431
  172. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/storage.py +0 -17
  173. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/constants/video.py +0 -117
  174. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/functions/__init__.py +0 -29
  175. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/functions/children.py +0 -19
  176. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/functions/environment.py +0 -46
  177. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/functions/paths.py +0 -40
  178. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/imports/init_imports.py +0 -236
  179. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/probes/__init__.py +0 -1
  180. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/probes/calibration.py +0 -34
  181. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/__init__.py +0 -3
  182. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/__init__.py +0 -5
  183. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/env_utils/__init__.py +0 -6
  184. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/env_utils/env_utils.py +0 -87
  185. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/env_utils/environment.py +0 -147
  186. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/imports/__init__.py +0 -3
  187. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/imports/constants/__init__.py +0 -12
  188. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/imports/constants/mime_constants.py +0 -831
  189. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/imports/constants/type_constants.py +0 -17
  190. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/imports/functions.py +0 -72
  191. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/imports/init_imports.py +0 -53
  192. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/lazy_utils/__init__.py +0 -5
  193. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/lazy_utils/loading.py +0 -119
  194. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/string_helpers/__init__.py +0 -2
  195. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/string_helpers/string_helpers.py +0 -70
  196. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/type_utils/__init__.py +0 -14
  197. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/type_utils/alpha_utils.py +0 -63
  198. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/type_utils/get_type.py +0 -139
  199. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/type_utils/is_type.py +0 -468
  200. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/type_utils/make_type.py +0 -153
  201. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/abstract_essentials/type_utils/num_utils.py +0 -31
  202. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/__init__.py +0 -13
  203. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/__init__.py +0 -39
  204. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/classes/__init__.py +0 -21
  205. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/classes/errors.py +0 -74
  206. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/classes/http.py +0 -116
  207. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/classes/nvml.py +0 -32
  208. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/__init__.py +0 -36
  209. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/admission.py +0 -17
  210. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/architecture.py +0 -84
  211. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/audit.py +0 -6
  212. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/comfy.py +0 -15
  213. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/context.py +0 -35
  214. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/cpu.py +0 -17
  215. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/drives.py +0 -24
  216. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/engines.py +0 -15
  217. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/formats.py +0 -113
  218. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/gguf.py +0 -88
  219. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/hardware.py +0 -21
  220. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/identity.py +0 -16
  221. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/math.py +0 -79
  222. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/memory.py +0 -31
  223. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/placement.py +0 -155
  224. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/platform.py +0 -32
  225. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/tensors.py +0 -53
  226. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/terms.py +0 -221
  227. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/text.py +0 -85
  228. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/timing.py +0 -37
  229. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/tool_calls.py +0 -22
  230. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/transfer.py +0 -28
  231. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/constants/validation.py +0 -52
  232. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/functions/__init__.py +0 -41
  233. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/functions/application_paths.py +0 -180
  234. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/functions/comfy_metadata.py +0 -113
  235. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/functions/engine_metadata.py +0 -53
  236. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/functions/env_values.py +0 -23
  237. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/functions/host_memory.py +0 -131
  238. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/functions/inference_children.py +0 -122
  239. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/functions/json_http.py +0 -30
  240. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/functions/nvml.py +0 -212
  241. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/functions/openai_protocol.py +0 -48
  242. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/functions/profile_metadata.py +0 -39
  243. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/init_imports.py +0 -74
  244. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/module_imports.py +0 -10
  245. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/imports/terms.json +0 -5599
  246. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_resources/lazy_imports.py +0 -10
  247. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_settings/__init__.py +0 -2
  248. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_settings/imports/__init__.py +0 -1
  249. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_settings/imports/constants/__init__.py +0 -3
  250. hugpy_wrapper-0.1.211/src/hugpy_wrapper/engines/runtime/kg_engines/vendor/hugpy_settings/imports/constants/domains.py +0 -42
  251. hugpy_wrapper-0.1.211/src/hugpy_wrapper/imports/__init__.py +0 -47
  252. hugpy_wrapper-0.1.211/src/hugpy_wrapper/queue/templates.py +0 -132
  253. hugpy_wrapper-0.1.211/src/hugpy_wrapper/resources/fit.py +0 -355
  254. hugpy_wrapper-0.1.211/src/hugpy_wrapper/resources/placement.py +0 -44
  255. hugpy_wrapper-0.1.211/src/hugpy_wrapper/system/__init__.py +0 -6
  256. hugpy_wrapper-0.1.211/src/hugpy_wrapper/system/engine_base.json +0 -31
  257. hugpy_wrapper-0.1.211/src/hugpy_wrapper/system/engine_report.py +0 -44
  258. hugpy_wrapper-0.1.211/src/hugpy_wrapper/system/engines.py +0 -239
  259. hugpy_wrapper-0.1.211/src/hugpy_wrapper/system/install.py +0 -782
  260. hugpy_wrapper-0.1.211/src/hugpy_wrapper.egg-info/PKG-INFO +0 -151
  261. hugpy_wrapper-0.1.211/src/hugpy_wrapper.egg-info/SOURCES.txt +0 -256
  262. hugpy_wrapper-0.1.211/src/hugpy_wrapper.egg-info/entry_points.txt +0 -6
  263. hugpy_wrapper-0.1.211/src/hugpy_wrapper.egg-info/requires.txt +0 -9
  264. hugpy_wrapper-0.1.211/tests/test_api_key.py +0 -40
  265. hugpy_wrapper-0.1.211/tests/test_calibration.py +0 -176
  266. hugpy_wrapper-0.1.211/tests/test_caller_gone.py +0 -19
  267. hugpy_wrapper-0.1.211/tests/test_capabilities.py +0 -11
  268. hugpy_wrapper-0.1.211/tests/test_central_fetch.py +0 -170
  269. hugpy_wrapper-0.1.211/tests/test_comfy_video_endpoint.py +0 -21
  270. hugpy_wrapper-0.1.211/tests/test_core_link.py +0 -97
  271. hugpy_wrapper-0.1.211/tests/test_core_link_requests.py +0 -43
  272. hugpy_wrapper-0.1.211/tests/test_deferral_and_disk_host.py +0 -80
  273. hugpy_wrapper-0.1.211/tests/test_engine_settings.py +0 -31
  274. hugpy_wrapper-0.1.211/tests/test_enter_core_links.py +0 -14
  275. hugpy_wrapper-0.1.211/tests/test_fit.py +0 -349
  276. hugpy_wrapper-0.1.211/tests/test_four_bit.py +0 -61
  277. hugpy_wrapper-0.1.211/tests/test_groups.py +0 -881
  278. hugpy_wrapper-0.1.211/tests/test_host_only_load.py +0 -27
  279. hugpy_wrapper-0.1.211/tests/test_immutable_serving.py +0 -101
  280. hugpy_wrapper-0.1.211/tests/test_live_resources.py +0 -53
  281. hugpy_wrapper-0.1.211/tests/test_ram_footprint.py +0 -162
  282. hugpy_wrapper-0.1.211/tests/test_reaping_copy.py +0 -95
  283. hugpy_wrapper-0.1.211/tests/test_slow_discovery.py +0 -97
  284. hugpy_wrapper-0.1.211/tests/test_sort.py +0 -844
  285. hugpy_wrapper-0.1.211/tests/test_storage_report.py +0 -38
  286. hugpy_wrapper-0.1.211/tests/test_system_install_options.py +0 -76
  287. hugpy_wrapper-0.1.211/tests/test_templates.py +0 -34
  288. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/setup.cfg +0 -0
  289. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/queue/__init__.py +0 -0
  290. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/queue/capabilities.py +0 -0
  291. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper/tools/__init__.py +0 -0
  292. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper.egg-info/dependency_links.txt +0 -0
  293. {hugpy_wrapper-0.1.211 → hugpy_wrapper-0.2.0}/src/hugpy_wrapper.egg-info/top_level.txt +0 -0
@@ -0,0 +1,49 @@
1
+ Metadata-Version: 2.4
2
+ Name: hugpy-wrapper
3
+ Version: 0.2.0
4
+ Summary: Resource and queue management: the front door, the queue, memory placement and the run loop
5
+ Requires-Python: >=3.11
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: hugpy-resources<0.2,>=0.1.17.29
8
+ Requires-Dist: abstract_essentials>=0.0.0.31
9
+ Requires-Dist: hugpy-terminal<0.2,>=0.1.39
10
+ Requires-Dist: abstract_database>=0.0.2.213
11
+ Requires-Dist: sqlalchemy
12
+ Requires-Dist: numpy
13
+ Requires-Dist: scipy
14
+
15
+ # hugpy-wrapper
16
+
17
+ Hugpy Wrapper serves models on one worker. It exposes OpenAI-compatible inference routes, queues requests and chooses a placement that fits the worker’s available GPU and host memory.
18
+
19
+ ## Installation
20
+
21
+ Use Python 3.11 or later. For inference, install Hugpy Discovery and the 0.4 worker edition of Hugpy Engine on the same host. Make their commands available on the Wrapper process’s PATH.
22
+
23
+ ```sh
24
+ python -m pip install 'hugpy-wrapper>=0.2,<0.3'
25
+ ```
26
+
27
+ ## Quick start
28
+
29
+ After declaring model drives in Discovery and installing a suitable engine, start the worker.
30
+
31
+ ```sh
32
+ hugpy-wrapper serve
33
+ ```
34
+
35
+ Run `hugpy-wrapper` in a second terminal to open its console. Inspect `/health` at the configured worker address, then request `GET /v1/models` to find the model identifiers this worker advertises.
36
+
37
+ ## How a request runs
38
+
39
+ 1. Discovery supplies the model files, tensor facts and drive route through its SQLite export. Wrapper can ask Discovery to prepare a model on its selected drive.
40
+ 2. Engine publishes the model formats, request inputs and allocation methods each backend supports. Wrapper asks Engine for a launch command and starts the child process.
41
+ 3. Wrapper selects an allocation for the requested context using current free memory and resident models. The queue tracks the call through staging, loading and execution.
42
+
43
+ Inspect `GET /v1/feasibility?model=KEY::VARIATION` for the available allocations of a model variation. `hugpy-wrapper settings` shows the active sources for configuration, including the Discovery and Engine command and export paths.
44
+
45
+ ## Running as a service
46
+
47
+ `hugpy-wrapper system install` provisions the service account, API key, systemd unit and endpoint descriptor. Run it with administrative privileges from a shared installation path. Use `hugpy-wrapper system register --help` for Core enrollment options. System state lives under `/var/lib/hugpy/wrapper` and per-user state defaults to `~/.local/share/hugpy/wrapper`.
48
+
49
+ Core connects directly to Wrapper by default. Give Core a reachable Wrapper URL on the private network. Use `hugpy-wrapper system register --core URL --link` for workers that must connect outbound. Successful direct enrollment removes a previous reverse-link record. Core pauses disconnected reverse links, and a rejected credential stays idle until the link is registered again.
@@ -0,0 +1,35 @@
1
+ # hugpy-wrapper
2
+
3
+ Hugpy Wrapper serves models on one worker. It exposes OpenAI-compatible inference routes, queues requests and chooses a placement that fits the worker’s available GPU and host memory.
4
+
5
+ ## Installation
6
+
7
+ Use Python 3.11 or later. For inference, install Hugpy Discovery and the 0.4 worker edition of Hugpy Engine on the same host. Make their commands available on the Wrapper process’s PATH.
8
+
9
+ ```sh
10
+ python -m pip install 'hugpy-wrapper>=0.2,<0.3'
11
+ ```
12
+
13
+ ## Quick start
14
+
15
+ After declaring model drives in Discovery and installing a suitable engine, start the worker.
16
+
17
+ ```sh
18
+ hugpy-wrapper serve
19
+ ```
20
+
21
+ Run `hugpy-wrapper` in a second terminal to open its console. Inspect `/health` at the configured worker address, then request `GET /v1/models` to find the model identifiers this worker advertises.
22
+
23
+ ## How a request runs
24
+
25
+ 1. Discovery supplies the model files, tensor facts and drive route through its SQLite export. Wrapper can ask Discovery to prepare a model on its selected drive.
26
+ 2. Engine publishes the model formats, request inputs and allocation methods each backend supports. Wrapper asks Engine for a launch command and starts the child process.
27
+ 3. Wrapper selects an allocation for the requested context using current free memory and resident models. The queue tracks the call through staging, loading and execution.
28
+
29
+ Inspect `GET /v1/feasibility?model=KEY::VARIATION` for the available allocations of a model variation. `hugpy-wrapper settings` shows the active sources for configuration, including the Discovery and Engine command and export paths.
30
+
31
+ ## Running as a service
32
+
33
+ `hugpy-wrapper system install` provisions the service account, API key, systemd unit and endpoint descriptor. Run it with administrative privileges from a shared installation path. Use `hugpy-wrapper system register --help` for Core enrollment options. System state lives under `/var/lib/hugpy/wrapper` and per-user state defaults to `~/.local/share/hugpy/wrapper`.
34
+
35
+ Core connects directly to Wrapper by default. Give Core a reachable Wrapper URL on the private network. Use `hugpy-wrapper system register --core URL --link` for workers that must connect outbound. Successful direct enrollment removes a previous reverse-link record. Core pauses disconnected reverse links, and a rejected credential stays idle until the link is registered again.
@@ -0,0 +1,26 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "hugpy-wrapper"
7
+ version = "0.2.0"
8
+ description = "Resource and queue management: the front door, the queue, memory placement and the run loop"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ # hugpy-engine (the engines) and hugpy-discovery (the models) are not dependencies: each is a tool of its own,
12
+ # installed beside this one, read from the file it publishes and asked through its command.
13
+ dependencies = ["hugpy-resources>=0.1.17.29,<0.2", "abstract_essentials>=0.0.0.31", "hugpy-terminal>=0.1.39,<0.2",
14
+ "abstract_database>=0.0.2.213", "sqlalchemy", "numpy", "scipy"]
15
+
16
+ [project.scripts]
17
+ hugpy-wrapper = "hugpy_wrapper.cli:main"
18
+
19
+ [tool.setuptools]
20
+ package-dir = {"" = "src"}
21
+
22
+ [tool.setuptools.packages.find]
23
+ where = ["src"]
24
+
25
+ [tool.setuptools.package-data]
26
+ "hugpy_wrapper" = []
@@ -6,16 +6,16 @@
6
6
  queue what it is / has rows inside wrapper.sqlite3
7
7
 
8
8
  Flat API:
9
- from hugpy_wrapper import units, place, feasibility_read, feasibility_view, resource_read, resource_view
9
+ from hugpy_wrapper import units, placed, feasibility_read, feasibility_view, resource_read, resource_view
10
10
  from hugpy_wrapper import enqueue, predict, queue_read, serve
11
11
  """
12
- from . import discovery, engines, imports, queue, resources
12
+ from . import discovery, engines, imports, queue, resources, sql
13
13
 
14
14
  # discovery: where it's stored
15
- from .discovery import units, unit, unit_files, models, facts, files, snapshot, accommodate
15
+ from .discovery import units, unit, unit_files, models, facts, files, accommodate
16
16
 
17
17
  # resources: where it's loaded (+ placement, the spill)
18
- from .resources import read_gpus, read_mem, read_cpu, read_processes, open_db, poll_once, prune, run, place
18
+ from .resources import read_gpus, read_mem, read_cpu, read_processes, open_db, poll_once, prune, run, placed
19
19
  from .resources import read as resource_read, view as resource_view
20
20
 
21
21
  # engines: what it's doing and needs (+ feasibility, the output over the spill)
@@ -25,13 +25,14 @@ from .engines import open_db as wrapper_db, discovery_path, feasibility_read, fe
25
25
  from .queue import enqueue, next_row, predict, resolve, queue_read, run_one, loop, serve
26
26
 
27
27
  # shared helpers + db browser (handles a sqlite file OR a server URL)
28
- from .imports import connect_ro, connect_rw, attach_ro, rows_of, read_json, lines, gib
29
- from .imports import to_url, engine, tables, columns, rows, schema, collate, DatabaseManager
28
+ from .imports import gib
29
+ from .sql import connect_ro, connect_rw, attach_ro, rows_of, read_json, lines
30
+ from .sql import to_url, engine, tables, columns, rows, schema, collate, DatabaseManager
30
31
 
31
32
  __all__ = [
32
33
  "discovery", "resources", "engines", "queue", "imports",
33
- "units", "unit", "unit_files", "models", "facts", "files", "snapshot", "accommodate",
34
- "read_gpus", "read_mem", "read_cpu", "read_processes", "open_db", "poll_once", "prune", "run", "place",
34
+ "units", "unit", "unit_files", "models", "facts", "files", "accommodate",
35
+ "read_gpus", "read_mem", "read_cpu", "read_processes", "open_db", "poll_once", "prune", "run", "placed",
35
36
  "resource_read", "resource_view",
36
37
  "wrapper_db", "discovery_path", "feasibility_read", "feasibility_view", "llama",
37
38
  "enqueue", "next_row", "predict", "resolve", "queue_read", "run_one", "loop", "serve",
@@ -0,0 +1,7 @@
1
+ from .imports import (
2
+ sys,
3
+ )
4
+
5
+ from .cli import main
6
+
7
+ sys.exit(main())
@@ -0,0 +1,152 @@
1
+ """hugpy-wrapper: resource and queue management. serve (the OpenAI /v1 front door and the run loop), settings
2
+ and set (its own settings, kept in its database), and system install|status|uninstall (the system service layer).
3
+ The engines themselves are hugpy-engine's, a tool of its own: read from what it publishes, asked by its command."""
4
+
5
+ from .imports import (
6
+ argparse,
7
+ health_of,
8
+ is_own,
9
+ os,
10
+ set_service_name,
11
+ signal,
12
+ subprocess,
13
+ sys,
14
+ terminal_main,
15
+ time,
16
+ who,
17
+ write_settings,
18
+ )
19
+ from .system import main as system_main
20
+ from .imports import WRAPPER_HOST, WRAPPER_PORT
21
+ from .system.install import status
22
+ from .imports import constants as c
23
+ from .imports import STATE_DIR
24
+ from .queue import serve
25
+ from .tools.resource_db import main as resources_main
26
+ from .engine import client as engine_client
27
+
28
+
29
+ def front_door(url: str):
30
+ """The front door for a person at a terminal: the hugpy-wrapper that already answers at url (its service, or
31
+ a `hugpy-wrapper serve` in another terminal), else this tool's own `serve`, started here with its output in
32
+ serve.log of the state folder and stopped when the terminal is closed. Returns that process, or None. Another
33
+ program at that address (a hugpy-wrapper before 0.2, which does not say its package) is said, never attached to."""
34
+ found = health_of(url, timeout=2)
35
+ if is_own(found):
36
+ return None
37
+ if found is not None: # the address is taken, and not by this tool: its screen is not opened on it
38
+ raise SystemExit(f'hugpy-wrapper: {url} is answered by {who(found)}, not by hugpy-wrapper. Another address '
39
+ f'for this one: hugpy-wrapper set port N (and engine_port_base for its engines)')
40
+ if c.SERVICE_CLIENT: # the front door of this host is its service: it is not started from here
41
+ raise SystemExit(service_only(f'nothing answers at {url}'))
42
+ log = os.path.join(STATE_DIR, 'serve.log')
43
+ os.makedirs(STATE_DIR, exist_ok=True)
44
+ print(f'hugpy-wrapper: nothing answers at {url}; starting the front door (its output: {log})', flush=True)
45
+ child = subprocess.Popen([sys.executable, '-P', '-m', 'hugpy_wrapper', 'serve'], stdin=subprocess.DEVNULL,
46
+ stdout=open(log, 'a'), stderr=subprocess.STDOUT, start_new_session=True)
47
+ began = time.monotonic()
48
+ while time.monotonic() - began < 120:
49
+ if is_own(health_of(url, timeout=2)):
50
+ return child
51
+ if child.poll() is not None:
52
+ with open(log) as fh:
53
+ last = (fh.read().strip().splitlines() or ['no output'])[-1]
54
+ raise SystemExit(f'hugpy-wrapper: the front door did not start: {last}')
55
+ time.sleep(0.5)
56
+ child.terminate()
57
+ raise SystemExit(f'hugpy-wrapper: the front door did not answer at {url} in 120 s; see {log}')
58
+
59
+
60
+ def service_only(what: str) -> str:
61
+ """What a person is told where the front door is this host's service and its folder is the service's own."""
62
+ return (f'hugpy-wrapper: {what}. On this host the front door is the service hugpy-wrapper.service, and its '
63
+ f'folder ({c.HOME_DIR}) is the service account\'s own:\n'
64
+ f' sudo hugpy-wrapper system status how it stands\n'
65
+ f' sudo hugpy-wrapper system set KEY VALUE save one of its settings\n'
66
+ f' hugpy-wrapper its screen, from any account')
67
+
68
+
69
+ def main(argv=None):
70
+ argv = sys.argv[1:] if argv is None else list(argv)
71
+ if argv[:1] == ['system']:
72
+ return system_main(argv[1:])
73
+ if c.SERVICE_CLIENT and argv[:1] in (['serve'], ['set'], ['resources']):
74
+ raise SystemExit(service_only(f'`hugpy-wrapper {argv[0]}` works on the front door\'s own folder'))
75
+ if argv[:1] == ['resources']:
76
+ return resources_main(argv[1:])
77
+ parser = argparse.ArgumentParser(prog='hugpy-wrapper', description=__doc__.splitlines()[0])
78
+ sub = parser.add_subparsers(dest='command')
79
+ serve_parser = sub.add_parser('serve', help='the front door and the run loop (the service runs this)')
80
+ serve_parser.add_argument('--host', default=WRAPPER_HOST)
81
+ serve_parser.add_argument('--port', type=int, default=WRAPPER_PORT)
82
+ sub.add_parser('system', help='install | status | uninstall: the system service (hugpy-wrapper system --help)')
83
+ sub.add_parser('resources', help='the resource poller as its own process: appends the kernel log (--interval, --once)')
84
+ sub.add_parser('settings', help='every setting, its value and where it comes from')
85
+ set_parser = sub.add_parser('set', help='save one setting in the database (an empty VALUE: its default again)')
86
+ set_parser.add_argument('key')
87
+ set_parser.add_argument('value')
88
+ parser.add_argument('--yolo', '--allow-all', '--dangerously-skip-permissions', dest='yolo', action='store_true',
89
+ help='at a terminal: run every tool call without asking (without it, read-only calls run '
90
+ 'and a read-write call asks; one approval can cover the session)')
91
+ args = parser.parse_args(argv)
92
+ if args.command is None:
93
+ url = f'http://{WRAPPER_HOST}:{WRAPPER_PORT}'
94
+ if sys.stdin.isatty() and sys.stdout.isatty():
95
+ # a person at a terminal: the wrapper's terminal (chat, resources, settings), as fitevict's opened it
96
+ if terminal_main is None:
97
+ raise SystemExit(f'hugpy-wrapper: the terminal (hugpy-terminal) is not installed for this python; '
98
+ f'the front door itself runs at {url}: hugpy-wrapper system status')
99
+ child = front_door(url)
100
+ set_service_name('hugpy-wrapper')
101
+ try:
102
+ return terminal_main(['--base', url, '--workspace', '.'] + (['--policy', 'auto'] if args.yolo else []),
103
+ local=True, api_key=None)
104
+ finally:
105
+ set_service_name(None)
106
+ if child is not None: # the front door this terminal started ends with it
107
+ child.send_signal(signal.SIGTERM)
108
+ try:
109
+ child.wait(timeout=30)
110
+ except subprocess.TimeoutExpired:
111
+ child.kill()
112
+ print(f'hugpy-wrapper: the front door is at {url} (hugpy-wrapper system --help)')
113
+ return status(None)
114
+ if args.command == 'settings':
115
+ if c.SERVICE_CLIENT: # the service's saved settings are its own to read: what is known from here
116
+ print(f"the front door of this host is the service hugpy-wrapper.service; its saved settings are in its own "
117
+ f"folder (sudo hugpy-wrapper system status). From this account: its address ({c.ENDPOINT_FILE}), "
118
+ f"then the environment and {c.ENV_FILE}, then the defaults")
119
+ else:
120
+ print(f'database: {c.SETTINGS_DB} .env: {c.ENV_FILE}')
121
+ for key, row in c.resolve_settings().items():
122
+ print(f" {key:<22} {row['value'] if row['value'] is not None else '(none)'} [{row['source']}]")
123
+ return 0
124
+ if args.command == 'set':
125
+ if args.key not in c.SETTING_KEYS and args.key in engine_client.settings():
126
+ raise SystemExit(f"hugpy-wrapper: {args.key} is an engine's setting, and the engines are hugpy-engine's: "
127
+ f"hugpy-engine set {args.key} VALUE")
128
+ if args.key not in c.SETTING_KEYS:
129
+ raise SystemExit(f"hugpy-wrapper: {args.key} is not one of: {', '.join(c.SETTING_KEYS)}")
130
+ value = c._typed(args.value)
131
+ os.makedirs(os.path.dirname(c.SETTINGS_DB), exist_ok=True)
132
+ if value is None:
133
+ changed = write_settings(c.SETTINGS_DB, remove=(args.key,), by='hugpy-wrapper set')
134
+ else:
135
+ changed = write_settings(c.SETTINGS_DB, {args.key: value}, by='hugpy-wrapper set')
136
+ print(f"{args.key}: " + (f"saved as {value!r}" if value is not None else 'its default again') if changed else f'{args.key}: unchanged',
137
+ f' ({c.SETTINGS_DB}; a running service takes it at its next start)')
138
+ return 0
139
+ if args.command == 'serve':
140
+ try:
141
+ os.makedirs(STATE_DIR, exist_ok=True) # a first start: its folder is made here
142
+ except OSError:
143
+ pass
144
+ if not os.access(STATE_DIR, os.W_OK):
145
+ raise SystemExit(f'hugpy-wrapper: this account cannot write its state folder ({STATE_DIR}): serve runs as the '
146
+ f'account that owns it (a service: hugpy-wrapper system status)')
147
+ serve(args.host, args.port)
148
+ return 0
149
+
150
+
151
+ if __name__ == '__main__':
152
+ sys.exit(main())
@@ -0,0 +1,13 @@
1
+ """DISCOVERY: where it's stored. This tool reads what hugpy-discovery publishes (the api_*_v1 tables of its
2
+ export, read-only) and asks through its `request` command (client.py); hugpy-discovery is the only writer, and is
3
+ never imported here.
4
+
5
+ from hugpy_wrapper.discovery import units, unit, unit_files, accommodate, facts, files, client
6
+ """
7
+ from . import client
8
+ from .client import DiscoveryError
9
+ from ..sql.discovery import facts, files, models, unit, unit_file_rows, unit_files, units
10
+ from .accommodate import accommodate
11
+
12
+ __all__ = ["units", "unit", "unit_files", "unit_file_rows", "models", "facts", "files", "accommodate",
13
+ "client", "DiscoveryError"]
@@ -0,0 +1,47 @@
1
+ """Run step 60, accommodate (Spec: FLOWCHART 2): the model is had where it is loaded from.
2
+
3
+ hugpy-discovery decides where that is (its route: the declared drive that makes this call and the next fastest,
4
+ whatever the drive is designated) and does the drive work in its own process: asked, it answers with the
5
+ folder to load from, at once when the unit is whole there, after bringing it when it is not (by_route).
6
+ """
7
+ from __future__ import annotations
8
+
9
+ from ..sql.discovery import unit as unit_row, unit_dependencies
10
+ from ..imports import (
11
+ os,
12
+ time,
13
+ )
14
+ from ..sql import (
15
+ dep_kinds,
16
+ )
17
+ from . import client
18
+
19
+
20
+ def by_route(key: str, variation: str, engine: str, started: float, again: bool = False, *, mmap: bool = False) -> dict:
21
+ """hugpy-discovery has the unit where its route says it is loaded from, and names the folder. A unit the
22
+ catalog already has whole on a drive it is loaded from in place (not the worker drive: nothing is ever
23
+ written beside it) is not asked about, unless ``again`` (what the catalog said was not found on the drive)."""
24
+ held = unit_row(key, variation) or {}
25
+ # a unit its engine loads another model beside is always asked about: hugpy-discovery has them together on one
26
+ # drive (an engine finds what it needs beside the model) and writes an adapter's descriptor, which names its base
27
+ alone = variation != "*" or not unit_dependencies(key)
28
+ if not again and alone and held.get("accommodated") and held.get("served_immutable") and os.path.isdir(held.get("serve_dir") or ""):
29
+ return dict(status="present", route="in place", seconds=0.0, dir=held["serve_dir"])
30
+ # every unit is asked for by its engine: discovery has it as that engine loads it
31
+ row = (client.accommodate_directory(key, with_dependencies=dep_kinds(engine), engine=engine, mmap=mmap) if variation == "*"
32
+ else client.accommodate_models([dict(key=key, variation=variation)], engine=engine, mmap=mmap))
33
+ res = row["result"]
34
+ unit = (res.get("units") or [{}])[-1]
35
+ return dict(status=unit.get("status") or res.get("status"), route=unit.get("route") or "route",
36
+ seconds=time.monotonic() - started, dir=res.get("dir") or unit.get("dir"), drive=unit.get("drive"),
37
+ request_id=row.get("request_id"), record=res)
38
+
39
+
40
+ def accommodate(key: str, variation: str, engine: str = None, again: bool = False, *, mmap: bool = False) -> dict:
41
+ """Have (key, variation) where it is loaded from. Returns {status, route, seconds, dir, ...}; dir is the
42
+ folder a load is pointed at.
43
+ variation '*' (a directory unit): its tree and what its engine loads beside it, as ONE accommodation.
44
+ ``again``: ask hugpy-discovery whatever the catalog says (a file it listed was not found on the drive).
45
+
46
+ status: 'present' (already there), 'accommodated', or raises DiscoveryError with discovery's reply."""
47
+ return by_route(key, variation, engine, time.monotonic(), again, mmap=mmap)
@@ -1,22 +1,31 @@
1
- """Discovery's request socket, protocol v1: the only way TEST acts on discovery (accommodate, hold, unlock,
2
- placements). One JSON object per line each way; every reply carries "v": 1. No hugpy_discovery import:
3
- TEST talks to discovery only through its published interfaces (the api_*_v1 views and this socket).
1
+ """Requests to the model side, protocol v1: the only way this tool acts on it (accommodate, hold, unlock,
2
+ placements). One JSON object each way; every reply carries "v": 1. Nothing of the model side is imported and
3
+ its database is never opened: this tool reads only what it publishes (the api_*_v1 tables) and asks.
4
4
 
5
- A failure (no socket, no answer, a reply with "error", another protocol version) raises DiscoveryError,
6
- whose source is "discovery" and whose message carries the op and discovery's own reply.
5
+ The model side is hugpy-discovery: each request is the `hugpy-discovery request` command run as its own
6
+ process, the message on its standard input and the reply on its standard output; the generation is read from
7
+ the export itself.
8
+
9
+ A failure (no command, no answer, a reply with "error", another protocol version) raises
10
+ DiscoveryError, whose source is "discovery" and whose message carries the op and the reply.
7
11
  """
8
12
  from __future__ import annotations
9
13
 
10
- import json
11
- import os
12
- import socket
13
- import threading
14
- import time
15
- from pathlib import Path
16
-
17
- PROTOCOL_VERSION = 1 # the socket protocol this wrapper speaks
18
- INTERFACE_VERSION = 1 # the api_*_v1 views this wrapper reads (api_meta_v1.interface_version)
19
- SHARED_SOCKET = Path("/run/hugpy/discovery/requests.sock") # (2026-11-06) /run/hugpy-discovery links here
14
+ from ..imports import (
15
+ INTERFACE_VERSION,
16
+ json,
17
+ os,
18
+ DISCOVERY_COMMAND,
19
+ DISCOVERY_EXPORT,
20
+ shutil,
21
+ sqlite3,
22
+ subprocess,
23
+ threading,
24
+ time,
25
+ )
26
+
27
+
28
+ PROTOCOL_VERSION = 1 # the request protocol this wrapper speaks
20
29
  OP_TIMEOUT_S = 60.0 # an op that answers at once (placements, hold, generation ...)
21
30
 
22
31
 
@@ -30,30 +39,50 @@ class DiscoveryError(RuntimeError):
30
39
  f" (reply: {json.dumps(reply, default=str)[:1500]})")
31
40
 
32
41
 
33
- def socket_path() -> Path:
34
- """HUGPY_DISCOVERY_SOCKET, else the shared /run/hugpy-discovery, else this user's runtime dir (as discovery)."""
35
- if os.environ.get("HUGPY_DISCOVERY_SOCKET"):
36
- return Path(os.environ["HUGPY_DISCOVERY_SOCKET"])
37
- if SHARED_SOCKET.parent.is_dir():
38
- return SHARED_SOCKET
39
- return Path(os.environ.get("XDG_RUNTIME_DIR") or f"/run/user/{os.getuid()}") / "hugpy-discovery" / SHARED_SOCKET.name
42
+ def records_request(op: str, timeout: float, message: dict) -> bytes:
43
+ """One op answered by hugpy-discovery in a process of its own: its reply as it printed it."""
44
+ command = shutil.which(DISCOVERY_COMMAND)
45
+ if not command:
46
+ raise DiscoveryError(op, None, f"the {DISCOVERY_COMMAND} command is not on PATH (hugpy-wrapper set discovery_command PATH)")
47
+ env = {k: v for k, v in os.environ.items() if k != "PYTHONPATH"} # its own runtime: nothing of this one's
48
+ try:
49
+ done = subprocess.run([command, "request"], input=json.dumps(dict(message, op=op), default=str).encode(),
50
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=timeout, env=env)
51
+ except subprocess.TimeoutExpired:
52
+ raise DiscoveryError(op, None, f"{DISCOVERY_COMMAND} request did not answer in {timeout} s") from None
53
+ except OSError as exc:
54
+ raise DiscoveryError(op, None, f"{command} could not be run: {type(exc).__name__}: {exc}") from exc
55
+ lines = done.stdout.strip().splitlines()
56
+ if not lines:
57
+ raise DiscoveryError(op, done.stderr.decode(errors="replace")[-500:], f"{DISCOVERY_COMMAND} request printed no reply (exit {done.returncode})")
58
+ return lines[-1]
40
59
 
41
60
 
42
- def request(op: str, timeout: float = OP_TIMEOUT_S, **message) -> dict:
43
- """One op; discovery's reply. timeout=None waits as long as discovery takes (a request wait)."""
44
- path = socket_path()
61
+ def export_meta() -> dict:
62
+ """api_meta_v1 of hugpy-discovery's export, read from the file itself."""
45
63
  try:
46
- with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client:
47
- client.settimeout(timeout)
48
- client.connect(str(path))
49
- with client.makefile("rwb") as stream:
50
- stream.write(json.dumps(dict(message, op=op), default=str).encode() + b"\n")
51
- stream.flush()
52
- line = stream.readline()
53
- except OSError as exc:
54
- raise DiscoveryError(op, None, f"socket {path} unreachable: {type(exc).__name__}: {exc}") from exc
55
- if not line:
56
- raise DiscoveryError(op, None, f"socket {path} closed without a reply")
64
+ conn = sqlite3.connect(f"file:{DISCOVERY_EXPORT}?mode=ro", uri=True, timeout=10)
65
+ try:
66
+ cursor = conn.execute("SELECT * FROM api_meta_v1")
67
+ row = cursor.fetchone()
68
+ return dict(zip([c[0] for c in cursor.description], row)) if row else {}
69
+ finally:
70
+ conn.close()
71
+ except sqlite3.Error as exc:
72
+ raise DiscoveryError("generation", None, f"{DISCOVERY_EXPORT} cannot be read: {type(exc).__name__}: {exc}") from exc
73
+
74
+
75
+ def request(op: str, timeout: float = OP_TIMEOUT_S, **message) -> dict:
76
+ """One op; the model side's reply. timeout=None waits as long as it takes (a request wait)."""
77
+ if op == "generation" or (op == "read" and message.get("view") == "api_meta_v1"):
78
+ meta = export_meta() # read from the export: no process for what is asked every few seconds
79
+ return dict(meta, v=PROTOCOL_VERSION) if op == "generation" else dict(
80
+ v=PROTOCOL_VERSION, columns=list(meta), rows=[list(meta.values())] if meta else [])
81
+ return _reply(op, records_request(op, timeout, message))
82
+
83
+
84
+ def _reply(op: str, line: bytes) -> dict:
85
+ """The reply as an object, or DiscoveryError: not JSON, not an object, another protocol version, an error."""
57
86
  try:
58
87
  reply = json.loads(line)
59
88
  except ValueError as exc:
@@ -68,7 +97,7 @@ def request(op: str, timeout: float = OP_TIMEOUT_S, **message) -> dict:
68
97
 
69
98
 
70
99
  def generation() -> dict:
71
- """api_meta_v1 over the socket: {interface_version, generation, changed_at, ...}; raises on another version."""
100
+ """api_meta_v1 of the export: {interface_version, generation, changed_at, ...}; raises on another version."""
72
101
  g = request("generation")
73
102
  if g.get("interface_version") != INTERFACE_VERSION:
74
103
  raise DiscoveryError("generation", g, f"interface version {g.get('interface_version')!r}, "
@@ -77,8 +106,8 @@ def generation() -> dict:
77
106
 
78
107
 
79
108
  def meta() -> dict:
80
- """api_meta_v1 read LIVE over the socket (the export can lag): interface_version, generation, install_mode,
81
- change_source, chain_ok, last_seq, last_heartbeat, ... as one dict ({} when the view has no row)."""
109
+ """api_meta_v1 of the export as one dict: interface_version, generation, install_mode, change_source,
110
+ chain_ok, last_seq, last_heartbeat, ... ({} when it has no row)."""
82
111
  r = request("read", view="api_meta_v1")
83
112
  cols, rows = r.get("columns"), r.get("rows") or []
84
113
  if not rows:
@@ -192,11 +221,13 @@ def accommodate_entry(entry: dict, mmap: bool = False) -> dict:
192
221
  return wait(_noted(q["request_id"]), "accommodate")
193
222
 
194
223
 
195
- def accommodate_models(models: list, mmap: bool = False) -> dict:
224
+ def accommodate_models(models: list, mmap: bool = False, engine: str = None, *, drive=None, reap=False) -> dict:
196
225
  """Every one of `models` ([{key, variation}], weights variations) on a worker drive, as ONE request: discovery
197
226
  chooses where and how, holds every member so none is reaped to make room for another, and copies what is
198
- missing (its accommodate_all). The finished request row; its result says fulfilled, or failed and where."""
199
- q = request("accommodate", models=models, mmap=mmap)
227
+ missing (its accommodate_all). The finished request row; its result says fulfilled, or failed and where.
228
+ ``engine``: the engine they are had for. Discovery then has each as that engine loads it (the files it opens
229
+ and no others), so what is brought, and the room reaped for it, is that engine's and not the whole folder's."""
230
+ q = request("accommodate", models=models, mmap=mmap, engine=engine, drive=drive, reap=reap)
200
231
  return wait(_noted(q["request_id"]), "accommodate")
201
232
 
202
233
 
@@ -0,0 +1,5 @@
1
+ """hugpy-engine, as this tool sees it: read from its export, asked through its command. Never imported."""
2
+ from . import client
3
+ from .client import EngineToolError
4
+
5
+ __all__ = ['EngineToolError', 'client']