Metadata-Version: 2.4
Name: hugpy-discovery
Version: 0.2.1
Summary: The model record of every declared drive: facts, chunks per drive, and the reap-to-fit estimate
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: hugpy-resources<0.2,>=0.1.17.29
Requires-Dist: hugpy-settings<0.2,>=0.1.18
Requires-Dist: abstract_database>=0.0.2.213
Requires-Dist: abstract_essentials>=0.0.0.31
Requires-Dist: sqlalchemy

# hugpy-discovery

Hugpy Discovery inventories model files on declared drives. It records model facts, tensors, weight chunks and available copies, then publishes an SQLite export that Wrapper uses to decide which models it can serve.

## Installation

Use Python 3.11 or later on a host with readable model storage.

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

## Quick start

Replace the example path with a model store. The `immutable` role lets Discovery inventory a drive while excluding it as a write destination.

```sh
hugpy-discovery drives add /data/models immutable
hugpy-discovery scan
hugpy-discovery routes
```

Start `hugpy-discovery serve` to browse the record. Use `hugpy-discovery watch` to track changes to declared drives and refresh the export.

## Drives and placement

Declare drives as `central`, `worker` or `immutable`. Discovery records a model once and associates its files with each drive that holds them. It compares the measured cost of loading a complete copy with the cost of moving and then loading one. `hugpy-discovery routes MODEL` explains a choice. `hugpy-discovery accommodate MODEL` prepares the selected copy and may write model files on a writable drive.

## Consumer interface

The `api_*_v1` tables in `export.sqlite3` describe the model inventory for other processes. `hugpy-discovery export` refreshes them from the record, and `hugpy-discovery request` accepts JSON requests. Engine’s export supplies backend capabilities used when matching files to engines.

For host-wide operation, `hugpy-discovery system install` provisions the watcher under systemd and sets access to declared drives. Its state lives under `/var/lib/hugpy/discovery`. Per-user operation defaults to `~/.local/share/hugpy/discovery`.

## Host service

On a systemd host, `hugpy-discovery system install` provisions the watcher and its data directory. It can declare a drive during installation or apply access permissions for one added later. For a single-user installation the default data directory is `~/.local/share/hugpy/discovery`. The system service uses `/var/lib/hugpy/discovery`. Use `hugpy-discovery settings` to inspect the effective configuration and `hugpy-discovery system status` to inspect the service.
