hugpy-platform 0.2.4__tar.gz → 0.2.6__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.
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/PKG-INFO +1 -1
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/hardware.py +43 -9
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform.egg-info/PKG-INFO +1 -1
- hugpy_platform-0.2.6/src/hugpy_platform.egg-info/scm_version.json +8 -0
- hugpy_platform-0.2.4/src/hugpy_platform.egg-info/scm_version.json +0 -8
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/LICENSE +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/README.md +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/pyproject.toml +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/setup.cfg +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/__init__.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/app_dirs.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/async_runtime.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/atomic_json.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/binaries.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/buildinfo.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/central.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/choices.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/client_liveness.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/compat_pydantic.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/constants.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/env.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/environment_status.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/except_utils.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/filesystem.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/formatting.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/model_keys.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/module_imports.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/no_think.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/paths.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/platform_facade.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/procutil.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/py.typed +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/results.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/runner_config.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/test_isolation.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/trust.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/utils.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/verdict.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform/versioning.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform.egg-info/SOURCES.txt +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform.egg-info/dependency_links.txt +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform.egg-info/requires.txt +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform.egg-info/scm_file_list.json +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform.egg-info/top_level.txt +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/tests/conftest.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/tests/test_buildinfo.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/tests/test_constants.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/tests/test_import_policy.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/tests/test_platform_env_value.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/tests/test_public_api.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/tests/test_small_modules.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/tests/test_storage_isolation.py +0 -0
- {hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hugpy-platform
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.6
|
|
4
4
|
Summary: Hugpy platform: stdlib-first foundation shared by every Hugpy package (env-backed configuration, app dirs, hardware and process probes, central URL, pydantic compatibility shim)
|
|
5
5
|
Author-email: putkoff <support@hugpy.ai>
|
|
6
6
|
License-Expression: LicenseRef-Proprietary
|
|
@@ -12,6 +12,7 @@ nothing.
|
|
|
12
12
|
"""
|
|
13
13
|
from __future__ import annotations
|
|
14
14
|
|
|
15
|
+
import os
|
|
15
16
|
import subprocess
|
|
16
17
|
from typing import List, Optional
|
|
17
18
|
|
|
@@ -66,13 +67,22 @@ def _detect_gpus_nvidia_smi() -> List[dict]:
|
|
|
66
67
|
smi = resolve_bin("nvidia-smi")
|
|
67
68
|
if not smi:
|
|
68
69
|
return []
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
# memory.reserved = the driver's own share (firmware/GSP buffers): counted in
|
|
71
|
+
# memory.total, never in memory.free, held by no process and never freeable —
|
|
72
|
+
# displays show it as an immutable occupant (operator 2026-10-02). Drivers
|
|
73
|
+
# that predate the field reject the whole query, so fall back without it.
|
|
74
|
+
out = None
|
|
75
|
+
for fields in ("index,name,memory.total,memory.free,utilization.gpu,memory.reserved",
|
|
76
|
+
"index,name,memory.total,memory.free,utilization.gpu"):
|
|
77
|
+
try:
|
|
78
|
+
out = subprocess.check_output(
|
|
79
|
+
[smi, f"--query-gpu={fields}", "--format=csv,noheader,nounits"],
|
|
80
|
+
stderr=subprocess.DEVNULL, timeout=10,
|
|
81
|
+
).decode("utf-8", "replace")
|
|
82
|
+
break
|
|
83
|
+
except (OSError, subprocess.SubprocessError):
|
|
84
|
+
continue
|
|
85
|
+
if out is None:
|
|
76
86
|
return []
|
|
77
87
|
gpus: List[dict] = []
|
|
78
88
|
for line in out.strip().splitlines():
|
|
@@ -81,11 +91,13 @@ def _detect_gpus_nvidia_smi() -> List[dict]:
|
|
|
81
91
|
continue
|
|
82
92
|
idx, name, mem_total, mem_free = parts[:4]
|
|
83
93
|
tot, free = _safe_int(mem_total), _safe_int(mem_free)
|
|
94
|
+
rsv = _safe_int(parts[5]) if len(parts) > 5 else None
|
|
84
95
|
gpus.append({
|
|
85
96
|
"index": _safe_int(idx),
|
|
86
97
|
"name": name,
|
|
87
98
|
"memory_total": tot * 1024 * 1024 if tot else None, # MiB -> bytes
|
|
88
99
|
"memory_free": free * 1024 * 1024 if free else None,
|
|
100
|
+
"memory_reserved": rsv * 1024 * 1024 if rsv is not None else None,
|
|
89
101
|
"utilization": _safe_int(parts[4]) if len(parts) > 4 else None,
|
|
90
102
|
})
|
|
91
103
|
return gpus
|
|
@@ -114,12 +126,34 @@ def _detect_gpus_torch() -> List[dict]:
|
|
|
114
126
|
return []
|
|
115
127
|
|
|
116
128
|
|
|
129
|
+
def _torch_probe_allowed() -> bool:
|
|
130
|
+
"""Whether a VRAM read may go through ``torch.cuda``. A torch probe CREATES
|
|
131
|
+
a CUDA context (~256 MiB) in the calling process and never releases it —
|
|
132
|
+
fine in the worker agent, wrong in a hollow slot child (operator ruling
|
|
133
|
+
2026-10-02: hugpy's own idle CUDA contexts are residue to evict, so a child
|
|
134
|
+
with no model must not hold one). Slot children (``SLOT_ID`` set) and any
|
|
135
|
+
process with ``HUGPY_VRAM_PROBE=nvidia-smi`` read nvidia-smi only."""
|
|
136
|
+
if (os.environ.get("HUGPY_VRAM_PROBE") or "").strip().lower() in ("nvidia-smi", "smi"):
|
|
137
|
+
return False
|
|
138
|
+
if (os.environ.get("SLOT_ID") or "").strip():
|
|
139
|
+
return False
|
|
140
|
+
# Any hugpy process: read through torch only when THIS process already has
|
|
141
|
+
# a CUDA context (a model is loaded in-process) — a probe must never be the
|
|
142
|
+
# reason a context exists (the agent's idle 256 MiB lump, 2026-10-02).
|
|
143
|
+
try:
|
|
144
|
+
import sys as _sys
|
|
145
|
+
torch = _sys.modules.get("torch")
|
|
146
|
+
return bool(torch is not None and torch.cuda.is_initialized())
|
|
147
|
+
except Exception: # noqa: BLE001
|
|
148
|
+
return False
|
|
149
|
+
|
|
150
|
+
|
|
117
151
|
def free_vram_bytes(main: int = 0) -> Optional[int]:
|
|
118
152
|
"""Free VRAM on GPU ``main`` in bytes, or ``None`` if no GPU / can't tell."""
|
|
119
153
|
try:
|
|
120
154
|
import torch
|
|
121
155
|
|
|
122
|
-
if torch.cuda.is_available():
|
|
156
|
+
if _torch_probe_allowed() and torch.cuda.is_available():
|
|
123
157
|
free, _total = torch.cuda.mem_get_info(main)
|
|
124
158
|
return int(free)
|
|
125
159
|
except Exception:
|
|
@@ -150,7 +184,7 @@ def total_vram_bytes(main: int = 0) -> Optional[int]:
|
|
|
150
184
|
try:
|
|
151
185
|
import torch
|
|
152
186
|
|
|
153
|
-
if torch.cuda.is_available():
|
|
187
|
+
if _torch_probe_allowed() and torch.cuda.is_available():
|
|
154
188
|
_free, total = torch.cuda.mem_get_info(main)
|
|
155
189
|
return int(total)
|
|
156
190
|
except Exception:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hugpy-platform
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.6
|
|
4
4
|
Summary: Hugpy platform: stdlib-first foundation shared by every Hugpy package (env-backed configuration, app dirs, hardware and process probes, central URL, pydantic compatibility shim)
|
|
5
5
|
Author-email: putkoff <support@hugpy.ai>
|
|
6
6
|
License-Expression: LicenseRef-Proprietary
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{hugpy_platform-0.2.4 → hugpy_platform-0.2.6}/src/hugpy_platform.egg-info/scm_file_list.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|