Metadata-Version: 2.4
Name: hugpy-platform
Version: 0.3.2
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)
Author-email: putkoff <support@hugpy.ai>
License-Expression: LicenseRef-Proprietary
Keywords: hugpy,llm,self-hosted,platform,configuration
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: abstract_essentials
Requires-Dist: platformdirs
Provides-Extra: hardware
Requires-Dist: psutil; extra == "hardware"

# hugpy-platform

The stdlib-first foundation that the hugpy arms build on: app directories,
storage-root constants, executable resolution, a process-wide async runtime,
hardware and process probes, and small formatting and result helpers.

Distribution `hugpy-platform` **0.3.0** ("lean"), import `hugpy_platform`.
Dependencies: `abstract_essentials`, `platformdirs`. Optional extra: `hardware`
(`psutil`).

**Status: LIVE.** It is a library only: no service, no console script, no
entry points. It is installed in `/opt/hugpy-media/venv` and
`/opt/hugpy-video/venv`, and imported by:

- `hugpy_media`
- `hugpy_video`
- `hugpy_engine`
- `hugpy_oracle`
- core's legacy `config/prompt.py`, which is not live

Core's live basic mode and the wrapper do not use it; the wrapper carries its
own lifted copies under `fitevict/lifted/`.

The lean 0.3.0 release ships only the modules the live arms import. The rest
of the pre-0.3 package is retired. The `pyproject.toml` description still mentions "central URL", but
`hugpy_platform.central` is not shipped. `hugpy_oracle/assessment/benchmark.py` imports
it inside a `try` and records no figure when it is missing.
`hugpy_engine/placement.py` falls back the same way for
`hugpy_platform.model_keys`.

## Modules

`import hugpy_platform` re-exports only the light, side-effect-free accessors:

- `cache_dir`, `config_dir`, `data_dir`, `engine_dir`
- `hugpy_home`, `ensure_hugpy_home`, `hugpy_config_dir`, `hugpy_logs_dir`,
  `hugpy_run_dir`, `hugpy_state_dir`
- `models_root`
- `EXE_SUFFIX`, `IS_LINUX`, `IS_MACOS`, `IS_WINDOWS`, `env_value`

Import everything else by dotted path.

| module | what it provides |
|---|---|
| `app_dirs` | per-OS application directories, the single source of truth for them |
| `platform_facade` | OS facts and the `env_value` environment seam |
| `constants` | storage roots resolved from the environment: `DEFAULT_ROOT`, `MODELS_HOME`, `UPLOADS_HOME`, `PROJECTS_HOME`, `IDENTITIES_HOME`, …, `HF_TOKEN`, `env_bool()` |
| `utils` | small filesystem, message and naming helpers (`get_messages`, `get_request_id`, `exists`, …) |
| `async_runtime` | one long-lived event loop in a daemon thread: `run`, `submit`, `await_sync`, `iter_sync` |
| `binaries` | portable executable resolution: `resolve_bin`, `with_exe` |
| `module_imports` | lazy heavy imports with actionable errors: `require`, `get_torch`, `get_transformers`, `get_whisper`, … |
| `runner_config` | `RunnerConfig`, the common constructor state for media runner adapters |
| `results` | result-object adapters: `result_text`, `vision_result_text`, `result_payload` |
| `filesystem` | `free_bytes`, `directory_bytes`, `is_within`, `write_text`, … |
| `hardware` | `total_vram_bytes` (torch or nvidia-smi) |
| `procutil` | `pid_alive`, `popen_detached`, `terminate_tree`, `reexec` |
| `atomic_json`, `formatting`, `choices`, `verdict`, `versioning`, `client_liveness` | atomic JSON writes, byte formatting, value selection, `VERDICT/SCORE/WHY` parsing, version lookup, client-disconnect detection |

This package has no `imports/` layer (see
[the convention](../../docs/packages.md#the-imports-layout-convention)).

See also [docs/packages.md](../../docs/packages.md) and
[docs/architecture.md](../../docs/architecture.md).
