Metadata-Version: 2.4
Name: hugpy-wrapper
Version: 0.2.0
Summary: Resource and queue management: the front door, the queue, memory placement and the run loop
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: hugpy-resources<0.2,>=0.1.17.29
Requires-Dist: abstract_essentials>=0.0.0.31
Requires-Dist: hugpy-terminal<0.2,>=0.1.39
Requires-Dist: abstract_database>=0.0.2.213
Requires-Dist: sqlalchemy
Requires-Dist: numpy
Requires-Dist: scipy

# hugpy-wrapper

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.

## Installation

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.

```sh
python -m pip install 'hugpy-wrapper>=0.2,<0.3'
```

## Quick start

After declaring model drives in Discovery and installing a suitable engine, start the worker.

```sh
hugpy-wrapper serve
```

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.

## How a request runs

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.
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.
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.

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.

## Running as a service

`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`.

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.
