refactor(integrations): move harbor out of the hud package - #523
Conversation
The integration contract belongs in core; its implementations do not. `hud/integrations/harbor/` shipped inside the `hud` wheel, contradicting the repository map, so it moves to `integrations/harbor/`. Core keeps `hud.environment.Integration` and imports no implementation — the built wheel now contains the contract and nothing else. An adapted image can no longer get the integration from `pip install hud`, so the adaptation layer copies it in from the build context and drops it into the serving venv. The code serving an image is then the revision that adapted it, rather than whatever the index resolves to at build time. The interpreter version the venv and that path share is one constant instead of being spelled out in the install script alone. Also trims `Integration.name` to what it actually backs: the format identifier and the taskset origin scheme. There is no format registry and no `--format` flag for it to key.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 223a687787
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| ```python | ||
| from hud.integrations import harbor | ||
| from integrations import harbor |
There was a problem hiding this comment.
Package the Harbor import used in the live docs
For users following the normal pip install hud workflow, this import now raises ModuleNotFoundError: pyproject.toml packages only hud, explicitly excludes integrations/, and there is no separate project manifest that installs Harbor. The relocated tests pass only because pytest runs from the repository root. Either publish/install this integration separately or make this page explicitly repository-checkout-only instead of presenting the snippet as usable SDK code.
AGENTS.md reference: AGENTS.md:L14-L15
Useful? React with 👍 / 👎.
The integration contract belongs in core; its implementations do not.
hud/integrations/harbor/was shipping inside thehudwheel, which contradicts the repository map (cookbooks/andintegrations/live outside thehudpackage).Nothing in core imported it, so this is purely a location fix — no dependency untangling was needed.
What moves
hud/integrations/harbor/→integrations/harbor/, tests alongside ithud/integrations/__init__.py→integrations/__init__.pyhud.environment.Integrationand imports no implementationThe built wheel now contains
hud/environment/integration.pyand no format code.Adapted images
An adapted image can no longer get the integration from
pip install hud, so the adaptation layer copies it in from the build context:A side effect worth having: the code serving an image is now the revision that adapted it, rather than whatever the index resolves to at build time.
hud_requirementstill means the core SDK and is unchanged.The interpreter version shared by the venv and that path is now one constant (
SERVING_PYTHON) instead of being spelled out in the install script alone.Contract docstring
Integration.nameclaimed to be the CLI--formatvalue and a registry key. Neither exists — the origin scheme is the only role it backs, and the docstring now says only that.Checks
uv run pytest -q— 824 passed (66 underintegrations/)uv run ruff format . --check,uv run ruff check .— cleanuv run pyright— 0 errorstestpathsgainsintegrations, and the hatch build excludes it alongsidecookbooks/.One thing left open:
integrations.harboris not an installable import path for anyone outside this repo. If that becomes necessary it wants apyproject.tomlunderintegrations/harbor/, which is a separate decision from where the files live.Note
Medium Risk
Changes Harbor image build/serve paths and wheel contents; adapted images depend on the new COPY layout and
harbormodule name, though core runtime behavior is unchanged and tests cover adapt contexts.Overview
Harbor and other format integrations are relocated from
hud/integrations/to top-levelintegrations/, so thehudwheel no longer ships implementation code—onlyhud.environment.Integrationin core. Docs and imports now useintegrations/harbor:environmentinstead ofhud.integrations.*.Adapted Harbor images copy the integration into the serving venv (
COPY _hud_harbor→site-packages/harbor) because it is no longer available viapip install hud.SERVING_PYTHONties the venv path and install script to one version; serve CMD referencesharbor:environment.Packaging/tests: hatch excludes
integrations/; pytesttestpathsincludesintegrations.Integration.namedocstring is narrowed to origin-stamping only (drops unused CLI/registry claims).Reviewed by Cursor Bugbot for commit 223a687. Bugbot is set up for automated code reviews on this repo. Configure here.