Metadata-Version: 2.5
Name: whitehalo
Version: 1.3.0rc2
Summary: Lightweight, zero-torch launcher and agent-native Python SDK for Halo Docker runtimes.
Project-URL: Homepage, https://whitecircle.com/halo/docs
Project-URL: Documentation, https://whitecircle.com/halo/docs
Project-URL: Repository, https://github.com/whitecircle/halo
Project-URL: Issues, https://github.com/whitecircle/halo/issues
Author-email: White Circle <hello@whitecircle.com>
License-Expression: LicenseRef-Halo
License-File: APACHE-2.0.txt
License-File: LICENSE
Keywords: docker,grpo,halo,launcher,llm,sft,training,whitecircle
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: msgspec[yaml]<1.0.0,>=0.20.0
Requires-Dist: niquests<4.0.0,>=3.15.0
Description-Content-Type: text/markdown

# whitehalo

Lightweight, zero-torch launcher and agent-native Python SDK for [Halo](https://github.com/whitecircle/halo).

`whitehalo` does **not** install or compile PyTorch, Flash Attention, DeepEP, DeepGEMM, or CUDA kernels on your host. Instead, it manages and launches prebuilt Halo Docker images (`public.ecr.aws/whitecircle/halo`) from the host—and automatically dispatches directly to the local Halo runtime when executed inside a Halo container.

## Install

Requires Python 3.12+ (runs cleanly on your host and natively inside Halo Docker containers).

```bash
pip install whitehalo
# or
uvx whitehalo doctor
```

## Quickstart (CLI)

```bash
# 1. Check Docker daemon, NVIDIA runtime, GPU architecture, local images, and scratch disk
whitehalo doctor

# 2. Pull the matching prebuilt Blackwell or Hopper Docker image (no AWS login required)
whitehalo setup
# Include vLLM or SGLang rollout server images for online / environmental GRPO:
whitehalo setup --with-vllm

# 3. Preview the exact launch command without side effects
whitehalo launch sft examples/sft/qwen3/qwen3-4b-ultrachat-lora.yaml --dry-run

# 4. Launch training (works with zero repo clone, or bind-mounts your local Halo checkout)
whitehalo launch sft examples/sft/qwen3/qwen3-4b-ultrachat-lora.yaml -n 1 -- --report_to=none

# 5. Run a Halo post-training / data / White Circle tool
whitehalo run create-whitecircle-policies -- --environment-id <env_id> --policies policies.json

# 6. Drop into an interactive Halo shell with all mounts, ulimits, and GPU flags configured
whitehalo shell
```

## Quickstart (Python SDK)

Every request and response type is a strictly typed frozen `msgspec.Struct` or `StrEnum`.

```python
from pathlib import Path
from whitehalo import (
    BuiltinExample,
    ConfigEntry,
    ConfigOverride,
    ContainerOptions,
    GpuArch,
    HaloClient,
    ImageRole,
    InlineConfig,
    LaunchRequest,
    SetupRequest,
    TrainingMethod,
)

with HaloClient() as client:
    # Pull the GPU-matched Halo image
    client.setup(SetupRequest(arch=GpuArch.AUTO, roles=(ImageRole.TRAINER,)))

    # Verify Docker/Podman, GPU runtime, image, and scratch space
    report = client.doctor()
    report.raise_for_errors()

    # Launch a built-in example with typed overrides (zero repo clone required)
    result = client.launch(
        LaunchRequest(
            method=TrainingMethod.SFT,
            config=BuiltinExample(relative_path="examples/sft/qwen3/qwen3-4b-ultrachat-lora.yaml"),
            nproc=1,
            overrides=(ConfigOverride(key="report_to", value="none"),),
        )
    )

    # Or stage a typed inline YAML config and launch detached
    job = client.sft(
        config=InlineConfig(
            model_name_or_path="Qwen/Qwen3-4B-Instruct-2507",
            output_dir=Path("./checkpoints/my-sft"),
            dataset=("HuggingFaceH4/ultrachat_200k@train_sft",),
            extra=(
                ConfigEntry(key="use_peft", value=True),
                ConfigEntry(key="report_to", value="none"),
            ),
        ),
        nproc=4,
        detach=True,
        container=ContainerOptions(name="qwen3-sft"),
    )
```

## Agent-Native Interface

- **Structured JSON responses (`msgspec.json`):** Pass `--format json` (or pipe stdout—JSON mode activates automatically on non-TTY stdout). All human progress goes to `stderr`; machine output goes strictly to `stdout`.
- **Self-describing schemas:** `whitehalo schema all` emits JSON Schema for every request, response, and error struct.
- **Structured request input:** Every command accepts `--request-json <json-or-@file>` validated strictly by `msgspec`.
- **Deterministic exit codes:** `0` OK, `1` runtime failure, `2` usage/validation error, `10` Docker missing, `11` Docker daemon stopped, `12` Docker permission denied, `13` GPU unavailable, `14` ambiguous GPU architecture, `15` image not pulled, `16` scratch volume missing, `17` rollout server unreachable.

## License

Released under the **Halo License** (`LicenseRef-Halo`: Apache 2.0 + Supplemental Terms in `LICENSE`).
