Metadata-Version: 2.4
Name: hugpy-downloader
Version: 0.1.0.3
Summary: Standalone headless model downloader: plans against Discovery's inventory, downloads only what is missing, verifies every file by hash and merges into the flat store layout
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: abstract-flask>=0.0.0.1079
Requires-Dist: flask<4,>=3
Requires-Dist: werkzeug<4,>=3
Requires-Dist: hugpy-resources<0.2,>=0.1.17.29
Requires-Dist: hugpy-settings<0.2,>=0.1.9
Requires-Dist: requests>=2.28
Provides-Extra: test
Requires-Dist: pytest<10,>=8; extra == "test"
Requires-Dist: hugpy-discovery>=0.2.0; extra == "test"

# hugpy-downloader

Hugpy Downloader plans and verifies model downloads from Hugging Face and Civitai. It compares provider records with local inventory, reuses matching files and merges downloads into a store organized by creator and model.

## Installation

For the first release, install from this package source directory using Python 3.11 or later and the matching staged dependencies. From the bundle root, use `python -m pip install ./package`.

```sh
python -m pip install .
```

## Quick start

Inspect the store configuration, then preview a download. Replace `OWNER/REPOSITORY` and the store path with your own values. Planning reads provider metadata and reports the files and bytes needed.

```sh
hugpy-downloader status
hugpy-downloader plan hf:OWNER/REPOSITORY --store /data/models --json
```

Run `fetch` with the same target and store to transfer the files. Use `--version` to select a Hugging Face revision and `--file` to select paths or globs. Civitai accepts `civitai/VERSION_ID` or a model version URL.

## Integrity and recovery

The planner can consult Discovery’s inventory read-only. A matching published SHA-256 establishes a verified copy. `verify DIRECTORY --json` hashes the local weights, updates their records and distinguishes verified files, mismatches and files with only a local digest. When replacing a mismatched file, the downloader retains the old file beside it with a `.mismatch-` suffix.

## Queued downloads

```sh
hugpy-downloader queue add hf:OWNER/REPOSITORY --store /data/models
hugpy-downloader queue list --json
hugpy-downloader daemon --once
```

The queue returns a job ID. Use `queue show ID` to inspect progress and the classified failure reason. `queue cancel ID` and `queue retry ID` operate on an individual job. The daemon serializes writes to each destination and can expose a loopback API with `--http`.

Core can forward catalog and queue requests from `/api/downloads/` when the daemon’s loopback API is enabled on the same host. The default listener port is `8767`. Use `--port` to change it and configure Core to match.
