Skip to content

Official Codebase of 3DCodeVerse

Python

addons: the gallery and the dataset tools move out of the core, one-way boundary pinned

gaoypengc02141fd9e2f
diff --git a/harness/bench/report.py b/harness/bench/report.py
index 4cdeba5b..e4a5e4cd 100644
--- a/harness/bench/report.py
+++ b/harness/bench/report.py
@@ -3,7 +3,7 @@
``build_report(out_dir)`` reads ``results.jsonl`` (or results.json), aggregates
mean/median/pass-rate/cost per tier and category, writes ``report.md`` and
``report.html`` — the same self-contained page as ``3dcv gallery build --embed``
-(``codeverse.gallery``), one section per tier, with the stats tables under the
+(``codeverse.addons.gallery``), one section per tier, with the stats tables under the
summary strip.
"""
@@ -20,9 +20,9 @@ from bench._compare_report import _f as _fmt
from bench._compare_report import _mean
from bench._jsonl import read_jsonl
from bench.run_bench import BenchItemResult
+from codeverse.addons.gallery import GalleryIndex, RootSection, RunEntry, render_static
+from codeverse.addons.gallery.index import entry_from_record
from codeverse.flywheel.record import RecordError, load_record
-from codeverse.gallery import GalleryIndex, RootSection, RunEntry, render_static
-from codeverse.gallery.index import entry_from_record
from codeverse.workspace import Workspace
TIER_ORDER = {"easy": 0, "medium": 1, "hard": 2}
diff --git a/harness/codeverse/addons/__init__.py b/harness/codeverse/addons/__init__.py
new file mode 100644
index 00000000..99c4a198
--- /dev/null
+++ b/harness/codeverse/addons/__init__.py
@@ -0,0 +1,11 @@
+"""Optional tools that READ finished runs — nothing a run needs in order to happen.
+
+* ``gallery`` the run browser (``3dcv gallery serve|build``)
+* ``dataset`` run records → samples, packs, preference pairs, captions, an index
+ (``3dcv flywheel export|pairs|caption|index``)
+
+The boundary is one-way and pinned by ``tests/core/test_addons_boundary.py``: an addon may
+import anything in ``codeverse``; outside ``codeverse.cli`` nothing in ``codeverse`` imports an
+addon. What a run itself writes (``record.json``, ``deliverable/``, telemetry) is NOT an
+addon — that is ``codeverse.flywheel``.
+"""
diff --git a/harness/codeverse/addons/dataset/__init__.py b/harness/codeverse/addons/dataset/__init__.py
new file mode 100644
index 00000000..8adadbac
--- /dev/null
+++ b/harness/codeverse/addons/dataset/__init__.py
@@ -0,0 +1,9 @@
+"""Run records → a dataset: what ``3dcv flywheel …`` does AFTER the runs exist.
+
+* ``export`` ``export_samples(runs_dir, out_dir, min_score=..)`` → ``ExportReport``
+* ``pack`` ``pack_samples(out_dir)`` (plain tars + byte-range locators, optional)
+* ``pairs`` ``build_pairs(runs_dir, out_jsonl, min_delta=..)`` → n
+* ``refine`` the refine-transition rows (``RefineTransition``)
+* ``captions`` ``caption_sample(ws, record, model_id)`` → ``Captions``
+* ``index`` ``build_index(runs_dir, out_sqlite)`` + query helpers
+"""
diff --git a/harness/codeverse/flywheel/captions.py b/harness/codeverse/addons/dataset/captions.py
similarity index 100%
rename from harness/codeverse/flywheel/captions.py
rename to harness/codeverse/addons/dataset/captions.py
diff --git a/harness/codeverse/flywheel/export.py b/harness/codeverse/addons/dataset/export.py
similarity index 100%
rename from harness/codeverse/flywheel/export.py
rename to harness/codeverse/addons/dataset/export.py
diff --git a/harness/codeverse/flywheel/index.py b/harness/codeverse/addons/dataset/index.py
similarity index 100%
rename from harness/codeverse/flywheel/index.py
rename to harness/codeverse/addons/dataset/index.py
diff --git a/harness/codeverse/flywheel/pack.py b/harness/codeverse/addons/dataset/pack.py
similarity index 99%
rename from harness/codeverse/flywheel/pack.py
rename to harness/codeverse/addons/dataset/pack.py
index 6b037727..faa4a728 100644
--- a/harness/codeverse/flywheel/pack.py
+++ b/harness/codeverse/addons/dataset/pack.py
@@ -25,7 +25,7 @@ from typing import Any
from pydantic import BaseModel, Field
-from codeverse.flywheel.export import (
+from codeverse.addons.dataset.export import (
JSONL_NAME,
PARQUET_NAME,
ManifestEntry,
diff --git a/harness/codeverse/flywheel/pairs.py b/harness/codeverse/addons/dataset/pairs.py
similarity index 99%
rename from harness/codeverse/flywheel/pairs.py
rename to harness/codeverse/addons/dataset/pairs.py
index 4ffdfbbf..ec7f2e0c 100644
--- a/harness/codeverse/flywheel/pairs.py
+++ b/harness/codeverse/addons/dataset/pairs.py
@@ -80,7 +80,7 @@ def _base(ws: Workspace, rec: RunRecord, kind: str, *, slug: str | None = None)
#: the judge Δ at which two rounds are a preference pair — and, in
-#: :mod:`codeverse.flywheel.refine`, the Δ at which a transition counts as improved. One
+#: :mod:`codeverse.addons.dataset.refine`, the Δ at which a transition counts as improved. One
#: constant, so a Δ that is a preference pair here is never "unchanged" there.
MIN_PREFERENCE_DELTA = 0.05
diff --git a/harness/codeverse/flywheel/refine.py b/harness/codeverse/addons/dataset/refine.py
similarity index 98%
rename from harness/codeverse/flywheel/refine.py
rename to harness/codeverse/addons/dataset/refine.py
index 6e5f7eaa..8feea538 100644
--- a/harness/codeverse/flywheel/refine.py
+++ b/harness/codeverse/addons/dataset/refine.py
@@ -1,6 +1,6 @@
"""Refine rounds as transitions: what the round was told, what it changed, what it scored.
-:mod:`codeverse.flywheel.pairs` exports whole code trees per round and never looks at what
+:mod:`codeverse.addons.dataset.pairs` exports whole code trees per round and never looks at what
asked for the change, so a refine round arrives as two 30 kB files with no cause. This
exports the transition instead — one row per refine round::
@@ -27,10 +27,10 @@ from typing import Any
from pydantic import BaseModel, Field
+from codeverse.addons.dataset.pairs import MIN_PREFERENCE_DELTA
from codeverse.contracts.artifacts import Severity
from codeverse.contracts.run import RoundRecord, RunRecord
from codeverse.flywheel._git import GitReadError, changed_files_between, diff_between, read_tree_at
-from codeverse.flywheel.pairs import MIN_PREFERENCE_DELTA
from codeverse.flywheel.record import (
BATTERY_MARKERS,
effective_judgment,
diff --git a/harness/codeverse/gallery/__init__.py b/harness/codeverse/addons/gallery/__init__.py
similarity index 83%
rename from harness/codeverse/gallery/__init__.py
rename to harness/codeverse/addons/gallery/__init__.py
index 77fee54d..5c32f569 100644
--- a/harness/codeverse/gallery/__init__.py
+++ b/harness/codeverse/addons/gallery/__init__.py
@@ -13,9 +13,9 @@
* ``server`` ``GalleryApp.route`` + ``serve(...)`` — loopback-only unless --host is typed
"""
-from codeverse.gallery.compare import export_csv, render_compare
-from codeverse.gallery.index import build_index, default_roots
-from codeverse.gallery.model import (
+from codeverse.addons.gallery.compare import export_csv, render_compare
+from codeverse.addons.gallery.index import build_index, default_roots
+from codeverse.addons.gallery.model import (
VERDICTS,
GalleryIndex,
RootSection,
@@ -25,8 +25,8 @@ from codeverse.gallery.model import (
summarize,
verdict_breakdown,
)
-from codeverse.gallery.page import build_static, render_static
-from codeverse.gallery.server import (
+from codeverse.addons.gallery.page import build_static, render_static
+from codeverse.addons.gallery.server import (
DEFAULT_HOST,
DEFAULT_PORT,
GalleryApp,
diff --git a/harness/codeverse/gallery/cards.py b/harness/codeverse/addons/gallery/cards.py
similarity index 98%
rename from harness/codeverse/gallery/cards.py
rename to harness/codeverse/addons/gallery/cards.py
index 31b2f982..c47649f5 100644
--- a/harness/codeverse/gallery/cards.py
+++ b/harness/codeverse/addons/gallery/cards.py
@@ -14,9 +14,9 @@ Design rules this module exists to hold in one place:
from __future__ import annotations
-from codeverse.gallery.model import VERDICT_META, RunEntry, RunLink, humanize_view
-from codeverse.gallery.theme import esc
-from codeverse.gallery.urls import UrlMaker
+from codeverse.addons.gallery.model import VERDICT_META, RunEntry, RunLink, humanize_view
+from codeverse.addons.gallery.theme import esc
+from codeverse.addons.gallery.urls import UrlMaker
#: links promoted next to ``detail`` on the card, best-first — the one artifact
#: you actually open for that track
diff --git a/harness/codeverse/gallery/code.py b/harness/codeverse/addons/gallery/code.py
similarity index 97%
rename from harness/codeverse/gallery/code.py
rename to harness/codeverse/addons/gallery/code.py
index bcd6a06f..6d0bc20d 100644
--- a/harness/codeverse/gallery/code.py
+++ b/harness/codeverse/addons/gallery/code.py
@@ -12,9 +12,9 @@ from __future__ import annotations
import re
from pathlib import Path
-from codeverse.gallery.model import RunEntry
-from codeverse.gallery.theme import esc, footer, page_shell, top_bar
-from codeverse.gallery.urls import UrlMaker, safe_join
+from codeverse.addons.gallery.model import RunEntry
+from codeverse.addons.gallery.theme import esc, footer, page_shell, top_bar
+from codeverse.addons.gallery.urls import UrlMaker, safe_join
MAX_VIEW_BYTES = 512 * 1024
HIGHLIGHT_SUFFIXES = {".py", ".js", ".mjs", ".cjs", ".frag", ".vert", ".glsl", ".json"}
diff --git a/harness/codeverse/gallery/compare.py b/harness/codeverse/addons/gallery/compare.py
similarity index 97%
rename from harness/codeverse/gallery/compare.py
rename to harness/codeverse/addons/gallery/compare.py
index e2895f59..c6227fbb 100644
--- a/harness/codeverse/gallery/compare.py
+++ b/harness/codeverse/addons/gallery/compare.py
@@ -15,10 +15,10 @@ import csv
import io
from urllib.parse import quote
-from codeverse.gallery.cards import fmt, tier_tag, verdict_tag
-from codeverse.gallery.model import VERDICT_META, RunEntry
-from codeverse.gallery.theme import esc, footer, page_shell, top_bar
-from codeverse.gallery.urls import UrlMaker
+from codeverse.addons.gallery.cards import fmt, tier_tag, verdict_tag
+from codeverse.addons.gallery.model import VERDICT_META, RunEntry
+from codeverse.addons.gallery.theme import esc, footer, page_shell, top_bar
+from codeverse.addons.gallery.urls import UrlMaker
#: how many runs a compare page will lay out before it says "too many"
MAX_COMPARE = 8
diff --git a/harness/codeverse/gallery/detail.py b/harness/codeverse/addons/gallery/detail.py
similarity index 98%
rename from harness/codeverse/gallery/detail.py
rename to harness/codeverse/addons/gallery/detail.py
index c4e3c777..ad2fb298 100644
--- a/harness/codeverse/gallery/detail.py
+++ b/harness/codeverse/addons/gallery/detail.py
@@ -12,15 +12,15 @@ from __future__ import annotations
from pathlib import Path
from urllib.parse import quote
+from codeverse.addons.gallery.cards import fmt, gallery_figure, tier_tag, verdict_tag
+from codeverse.addons.gallery.code import CODE_CSS, numbered, read_text, src_files
+from codeverse.addons.gallery.index import _rel
+from codeverse.addons.gallery.model import RunEntry
+from codeverse.addons.gallery.theme import esc, footer, page_shell, top_bar
+from codeverse.addons.gallery.urls import UrlMaker
from codeverse.contracts.common import ENTRY_FILE
from codeverse.contracts.run import RunRecord
from codeverse.flywheel.record import best_round_record, effective_judgment
-from codeverse.gallery.cards import fmt, gallery_figure, tier_tag, verdict_tag
-from codeverse.gallery.code import CODE_CSS, numbered, read_text, src_files
-from codeverse.gallery.index import _rel
-from codeverse.gallery.model import RunEntry
-from codeverse.gallery.theme import esc, footer, page_shell, top_bar
-from codeverse.gallery.urls import UrlMaker
from codeverse.workspace import Workspace
DETAIL_CSS = CODE_CSS + """
diff --git a/harness/codeverse/gallery/index.py b/harness/codeverse/addons/gallery/index.py
similarity index 99%
rename from harness/codeverse/gallery/index.py
rename to harness/codeverse/addons/gallery/index.py
index 5dbf7097..a1d17729 100644
--- a/harness/codeverse/gallery/index.py
+++ b/harness/codeverse/addons/gallery/index.py
@@ -1,7 +1,7 @@
"""Build the gallery index from run roots.
``build_index(roots)`` walks every run directory once, reads ``record.json`` and
-turns it into a :class:`~codeverse.gallery.model.RunEntry` whose every path is
+turns it into a :class:`~codeverse.addons.gallery.model.RunEntry` whose every path is
**run-relative**. It is deliberately cheap (no image work, no git): ~80 runs
index in well under a second, which is what makes ``--reload`` free.
@@ -15,6 +15,14 @@ from __future__ import annotations
import time
from pathlib import Path
+from codeverse.addons.gallery.model import (
+ GalleryIndex,
+ RootSection,
+ RoundRow,
+ RunEntry,
+ RunLink,
+ humanize_view,
+)
from codeverse.contracts.run import RunId, RunRecord
from codeverse.flywheel.quality import quality_tier
from codeverse.flywheel.record import (
@@ -28,14 +36,6 @@ from codeverse.flywheel.record import (
load_record,
)
from codeverse.flywheel.sample import gate_error_summary, telemetry_digest
-from codeverse.gallery.model import (
- GalleryIndex,
- RootSection,
- RoundRow,
- RunEntry,
- RunLink,
- humanize_view,
-)
from codeverse.proc import read_json_or_none
from codeverse.workspace import Workspace
diff --git a/harness/codeverse/gallery/model.py b/harness/codeverse/addons/gallery/model.py
similarity index 99%
rename from harness/codeverse/gallery/model.py
rename to harness/codeverse/addons/gallery/model.py
index c9008d23..3c318a1e 100644
--- a/harness/codeverse/gallery/model.py
+++ b/harness/codeverse/addons/gallery/model.py
@@ -179,7 +179,7 @@ class RunEntry(BaseModel):
@property
def verdict(self) -> str:
- """The triage bucket — exactly one of :data:`~codeverse.gallery.model.VERDICTS`.
+ """The triage bucket — exactly one of :data:`~codeverse.addons.gallery.model.VERDICTS`.
The four are disjoint *and* exhaustive on purpose: a status breakdown built
from them always sums to the number of runs on screen. A run whose record
diff --git a/harness/codeverse/gallery/page.py b/harness/codeverse/addons/gallery/page.py
similarity index 96%
rename from harness/codeverse/gallery/page.py
rename to harness/codeverse/addons/gallery/page.py
index 49c366cd..6a74d95a 100644
--- a/harness/codeverse/gallery/page.py
+++ b/harness/codeverse/addons/gallery/page.py
@@ -1,7 +1,7 @@
"""The index page: status rail, filters, per-battery sections, cards + table.
Rendered identically for the local server and the static build — the only
-difference is the :class:`~codeverse.gallery.urls.UrlMaker` it is handed. The
+difference is the :class:`~codeverse.addons.gallery.urls.UrlMaker` it is handed. The
initial filter is applied **server-side** (so ``curl '/?track=graphics'`` and a
no-JS browser both see the right runs and the right summary) and then re-applied
client-side on every keystroke without a reload.
@@ -17,9 +17,9 @@ from __future__ import annotations
import json
from pathlib import Path
-from codeverse.gallery.cards import TABLE_HEAD, fmt, render_card, render_row
-from codeverse.gallery.index import build_index
-from codeverse.gallery.model import (
+from codeverse.addons.gallery.cards import TABLE_HEAD, fmt, render_card, render_row
+from codeverse.addons.gallery.index import build_index
+from codeverse.addons.gallery.model import (
FILTER_KEYS,
VERDICT_META,
VERDICTS,
@@ -29,8 +29,8 @@ from codeverse.gallery.model import (
sort_entries,
summarize,
)
-from codeverse.gallery.theme import INDEX_CSS, INDEX_JS, esc, footer, page_shell, top_bar
-from codeverse.gallery.urls import THUMB_PX, StaticUrls, UrlMaker
+from codeverse.addons.gallery.theme import INDEX_CSS, INDEX_JS, esc, footer, page_shell, top_bar
+from codeverse.addons.gallery.urls import THUMB_PX, StaticUrls, UrlMaker
from codeverse.proc import write_text_atomic
diff --git a/harness/codeverse/gallery/server.py b/harness/codeverse/addons/gallery/server.py
similarity index 95%
rename from harness/codeverse/gallery/server.py
rename to harness/codeverse/addons/gallery/server.py
index d0fcfc2c..3e8e8e8c 100644
--- a/harness/codeverse/gallery/server.py
+++ b/harness/codeverse/addons/gallery/server.py
@@ -27,15 +27,15 @@ from pathlib import Path
from typing import Any
from urllib.parse import parse_qs, unquote, urlsplit
-from codeverse.gallery import code as code_page
-from codeverse.gallery import viewer as viewer_page
-from codeverse.gallery.compare import MAX_COMPARE, export_csv, parse_keys, render_compare
-from codeverse.gallery.detail import render_broken_detail, render_detail
-from codeverse.gallery.index import build_index
-from codeverse.gallery.model import FILTER_KEYS, RunEntry, match, sort_entries
-from codeverse.gallery.page import render_index
-from codeverse.gallery.theme import esc, footer, page_shell, top_bar
-from codeverse.gallery.urls import PathError, UrlMaker, content_type, safe_join
+from codeverse.addons.gallery import code as code_page
+from codeverse.addons.gallery import viewer as viewer_page
+from codeverse.addons.gallery.compare import MAX_COMPARE, export_csv, parse_keys, render_compare
+from codeverse.addons.gallery.detail import render_broken_detail, render_detail
+from codeverse.addons.gallery.index import build_index
+from codeverse.addons.gallery.model import FILTER_KEYS, RunEntry, match, sort_entries
+from codeverse.addons.gallery.page import render_index
+from codeverse.addons.gallery.theme import esc, footer, page_shell, top_bar
+from codeverse.addons.gallery.urls import PathError, UrlMaker, content_type, safe_join
DEFAULT_HOST = "127.0.0.1"
DEFAULT_PORT = 8765
@@ -242,7 +242,7 @@ class GalleryApp:
state = entry.state if entry.state != "ok" else "broken"
broken = entry.model_copy(update={"state": state, "error": str(e)[:400]})
return Response.html(render_broken_detail(broken, self.urls))
- from codeverse.gallery.index import entry_from_record
+ from codeverse.addons.gallery.index import entry_from_record
fresh = entry_from_record(entry.battery, ws, rec, slug=entry.slug) # newest rounds, even mid-bench
prev, nxt = self.neighbours(entry)
@@ -270,7 +270,7 @@ class GalleryApp:
return Response.json({"n": len(rows), "total": len(self.index.entries()),
"runs": [e.model_dump(mode="json") for e in rows]})
if what == "summary":
- from codeverse.gallery.model import summarize
+ from codeverse.addons.gallery.model import summarize
return Response.json(summarize(self.selected(query)).model_dump(mode="json"))
if what == "index":
diff --git a/harness/codeverse/gallery/theme.py b/harness/codeverse/addons/gallery/theme.py
similarity index 100%
rename from harness/codeverse/gallery/theme.py
rename to harness/codeverse/addons/gallery/theme.py
diff --git a/harness/codeverse/gallery/urls.py b/harness/codeverse/addons/gallery/urls.py
similarity index 99%
rename from harness/codeverse/gallery/urls.py
rename to harness/codeverse/addons/gallery/urls.py
index 7b99d38c..6e8906d1 100644
--- a/harness/codeverse/gallery/urls.py
+++ b/harness/codeverse/addons/gallery/urls.py
@@ -14,7 +14,7 @@ import mimetypes
from pathlib import Path, PurePosixPath
from urllib.parse import quote
-from codeverse.gallery.model import RunEntry, RunLink
+from codeverse.addons.gallery.model import RunEntry, RunLink
THUMB_PX = 720
JPEG_QUALITY = 78
diff --git a/harness/codeverse/gallery/viewer.py b/harness/codeverse/addons/gallery/viewer.py
similarity index 96%
rename from harness/codeverse/gallery/viewer.py
rename to harness/codeverse/addons/gallery/viewer.py
index 99799f71..61eac175 100644
--- a/harness/codeverse/gallery/viewer.py
+++ b/harness/codeverse/addons/gallery/viewer.py
@@ -11,9 +11,9 @@ from __future__ import annotations
import json
from pathlib import Path
-from codeverse.gallery.model import RunEntry
-from codeverse.gallery.theme import esc, footer, page_shell, top_bar
-from codeverse.gallery.urls import UrlMaker
+from codeverse.addons.gallery.model import RunEntry
+from codeverse.addons.gallery.theme import esc, footer, page_shell, top_bar
+from codeverse.addons.gallery.urls import UrlMaker
#: URL prefix → path under node_modules/three
VENDOR_MAP = {"three/build/": "build/", "three/examples/jsm/": "examples/jsm/"}
@@ -104,7 +104,7 @@ def vendor_path(rel: str, runtime_js: Path | str | None = None) -> Path | None:
Only the two whitelisted subtrees are reachable, and :func:`safe_join` still
checks the result — a vendor URL can never leave ``node_modules/three``."""
- from codeverse.gallery.urls import PathError, safe_join
+ from codeverse.addons.gallery.urls import PathError, safe_join
root = three_root(runtime_js)
if root is None:
diff --git a/harness/codeverse/cli/flywheel_cmd.py b/harness/codeverse/cli/flywheel_cmd.py
index 9a625d61..0aa48f90 100644
--- a/harness/codeverse/cli/flywheel_cmd.py
+++ b/harness/codeverse/cli/flywheel_cmd.py
@@ -9,9 +9,9 @@ from typing import Annotated
import typer
from rich.markup import escape
+from codeverse.addons.dataset.pairs import MIN_PREFERENCE_DELTA
from codeverse.cli import _common as C
from codeverse.cli._common import console, kv_table, ok, warn
-from codeverse.flywheel.pairs import MIN_PREFERENCE_DELTA
flywheel_app = typer.Typer(no_args_is_help=True)
@@ -30,7 +30,7 @@ def export_cmd(
) -> None:
"""Export runs → sample folders + dataset_manifest.json + metadata.jsonl/.parquet
(+ optional plain tars, packed FROM the manifest)."""
- from codeverse.flywheel.export import export_samples
+ from codeverse.addons.dataset.export import export_samples
if pack:
# pack_samples rewrites the index and reads it back with pyarrow, so --pack
@@ -58,7 +58,7 @@ def export_cmd(
for g in rep.duplicates[:20]:
warn(f"duplicate of {g.canonical}: {', '.join(g.duplicates)}")
if pack:
- from codeverse.flywheel.pack import pack_samples, verify_locators
+ from codeverse.addons.dataset.pack import pack_samples, verify_locators
prep = pack_samples(out_dir, tar_prefix=tar_prefix)
n = verify_locators(out_dir)
@@ -72,7 +72,7 @@ def pairs_cmd(
min_delta: Annotated[float, typer.Option("--min-delta")] = MIN_PREFERENCE_DELTA,
) -> None:
"""Preference / repair (round + in-session) / cross-backend pairs → JSONL."""
- from codeverse.flywheel.pairs import build_pairs
+ from codeverse.addons.dataset.pairs import build_pairs
n = build_pairs(runs_dir, out_jsonl, min_delta=min_delta)
ok(f"{n} pairs → {out_jsonl}")
@@ -86,7 +86,7 @@ def refine_cmd(
"format converter needs no access to the runs")] = False,
) -> None:
"""Refine rounds as transitions (brief → diff → score delta) → JSONL."""
- from codeverse.flywheel.refine import build_refine
+ from codeverse.addons.dataset.refine import build_refine
n, drops = build_refine(runs_dir, out_jsonl, with_code=with_code)
ok(f"{n} transitions → {out_jsonl}" + (f"; not exported: {dict(drops)}" if drops else ""))
@@ -102,9 +102,9 @@ def caption_cmd(
out: Annotated[Path | None, typer.Option("--out", help="write side-car <out>/<slug>.json instead of touching the run (read-only runs)")] = None,
) -> None:
"""Caption run(s): {detailed, instruction, factory} via a chat model."""
+ from codeverse.addons.dataset.captions import CaptionError, caption_sample
+ from codeverse.addons.dataset.export import load_captions
from codeverse.cost.instrument import run_ledger
- from codeverse.flywheel.captions import CaptionError, caption_sample
- from codeverse.flywheel.export import load_captions
from codeverse.flywheel.record import iter_runs, load_record
from codeverse.proc import RunLocked, exclusive
@@ -145,7 +145,7 @@ def index_cmd(
show: Annotated[bool, typer.Option("--summary/--no-summary")] = True,
) -> None:
"""Build the SQLite index (runs / rounds / usage) and print a summary."""
- from codeverse.flywheel.index import build_index, summary
+ from codeverse.addons.dataset.index import build_index, summary
n = build_index(runs_dir, out_sqlite)
ok(f"indexed {n} runs → {out_sqlite}")
@@ -208,7 +208,7 @@ def gallery_cmd(
embed: Annotated[bool, typer.Option("--embed/--no-embed", help="inline the contact sheets as data: URIs")] = True,
) -> None:
"""Alias of `3dcv gallery build` (kept for scripts): one self-contained HTML page."""
- from codeverse.gallery.page import build_static
+ from codeverse.addons.gallery.page import build_static
path, n, _ = build_static([runs_dir], out_html, title=title, embed=embed, thumb_px=thumb_px)
ok(f"gallery of {n} runs → {path} ({path.stat().st_size // 1024} KB)")
diff --git a/harness/codeverse/cli/main.py b/harness/codeverse/cli/main.py
index 33fd5f55..c566d498 100644
--- a/harness/codeverse/cli/main.py
+++ b/harness/codeverse/cli/main.py
@@ -155,7 +155,7 @@ RootsArg = Annotated[list[Path] | None, typer.Argument(
def resolve_roots(roots: list[Path] | None) -> list[Path]:
"""Explicit roots (validated) or the defaults; a clear error when there are none."""
- from codeverse.gallery.index import default_roots
+ from codeverse.addons.gallery.index import default_roots
if roots:
missing = [r for r in roots if not Path(r).is_dir()]
@@ -186,7 +186,7 @@ def serve_cmd(
title: Annotated[str, typer.Option("--title")] = "3dcv gallery",
) -> None:
"""Serve the gallery (and the run directories) on localhost."""
- from codeverse.gallery.server import GalleryError, serve
+ from codeverse.addons.gallery.server import GalleryError, serve
root_paths = resolve_roots(roots)
@@ -216,7 +216,7 @@ def build_cmd(
thumb_px: Annotated[int, typer.Option("--thumb-px", min=128, help="embedded thumbnail long edge")] = 720,
) -> None:
"""Write the gallery as one self-contained HTML file."""
- from codeverse.gallery.page import build_static
+ from codeverse.addons.gallery.page import build_static
path, n, index = build_static(resolve_roots(roots), out, title=title, embed=embed, thumb_px=thumb_px)
broken = sum(1 for e in index.entries() if e.state != "ok")
diff --git a/harness/codeverse/flywheel/__init__.py b/harness/codeverse/flywheel/__init__.py
index bb26cfd9..d7f8dc84 100644
--- a/harness/codeverse/flywheel/__init__.py
+++ b/harness/codeverse/flywheel/__init__.py
@@ -1,13 +1,14 @@
-"""Flywheel: run records → dataset samples, preference pairs, captions, dedupe, index.
+"""Flywheel: what every run WRITES so it can be learned from later.
Public API (see docs/INTERFACES.md):
-* ``record`` ``finalize_record(ws, record)`` · ``load_record(ws)`` · ``iter_runs(runs_dir)``
-* ``export`` ``export_samples(runs_dir, out_dir, min_score=..)`` → ``ExportReport``
-* ``pack`` ``pack_samples(out_dir)`` (plain tars + byte-range locators, optional)
-* ``pairs`` ``build_pairs(runs_dir, out_jsonl, min_delta=..)`` → n
-* ``captions`` ``caption_sample(ws, record, model_id)`` → ``Captions``
-* ``dedupe`` ``code_fingerprint`` · ``mesh_fingerprint`` · ``near_duplicates``
-* ``quality`` ``quality_tier`` (A/B/C/D) · ``prompt_hash`` · exact (code, prompt) duplicate groups
-* ``index`` ``build_index(runs_dir, out_sqlite)`` + query helpers
+* ``record`` ``finalize_record(ws, record)`` · ``load_record(ws)`` · ``iter_runs(runs_dir)``
+* ``deliverable`` the run's ``deliverable/`` directory
+* ``telemetry`` the settings / environment a record carries
+* ``sample`` one run → one dataset sample (code files of the best round)
+* ``quality`` ``quality_tier`` (A/B/C/D) · ``prompt_hash`` · code / mesh fingerprints, duplicate groups
+* ``code_quality`` the per-record code metrics
+
+Turning a tree of finished runs into a dataset (export, pack, pairs, captions, index) is
+``codeverse.addons.dataset``.
"""
diff --git a/harness/docs/ARCHITECTURE.md b/harness/docs/ARCHITECTURE.md
index 62851202..02dbe738 100644
--- a/harness/docs/ARCHITECTURE.md
+++ b/harness/docs/ARCHITECTURE.md
@@ -197,12 +197,15 @@ codeverse/
planner as a re-ask before any code is written),
skills_hook.py (the round's view of codeverse/skills: attach before generating,
probe reads after — a no-op unless CV3D_SKILLS is on)
- flywheel/ record.py (+ best_round_record), export.py, pack.py, sample.py, pairs.py,
- deliverable.py, telemetry.py, captions.py, quality.py (tiers + dedupe + code/mesh fingerprints), index.py,
+ flywheel/ what every run WRITES: record.py (+ best_round_record), sample.py,
+ deliverable.py, telemetry.py, quality.py (tiers + dedupe + code/mesh fingerprints),
code_quality.py (the delivered CODE's own vector — magic numbers per 100 LOC,
function length, dead functions, duplication, docstrings → record.extra
["code_quality"].index, a flywheel filter beside score and complexity)
- gallery/ THE local run gallery (`3dcv gallery serve|build`): cards.py,
+ addons/ optional tools that READ finished runs; outside cli/ nothing imports them
+ (tests/core/test_addons_boundary.py). dataset/ = export.py, pack.py, pairs.py,
+ refine.py, captions.py, index.py (`3dcv flywheel …`); gallery/ = below
+ addons/gallery/ THE local run gallery (`3dcv gallery serve|build`): cards.py,
compare.py (side-by-side arms), index.py (run roots →
typed RunEntry, tolerant of half-written records), model.py, page.py (cards +
table + filters + per-filter summary), detail.py (/run/<battery>/<slug>),
@@ -226,7 +229,7 @@ codeverse/
flywheel_cmd.py, texture_cmd.py, cost_cmd.py (`3dcv cost`), layout_cmd.py, doctor.py
(`--skills` checks the library + its discovery wiring),
skills_cmd.py (`3dcv skills list|show|validate|report` — the read-rate report)
-bench/ run_bench.py, report.py (renders through codeverse/gallery), compare_backends.py
+bench/ run_bench.py, report.py (renders through codeverse/addons/gallery), compare_backends.py
(preflights every model it needs; --wait-for-provider / --no-preflight),
_infra.py (outage vs model failure: infra_failed / budget_exhausted, docs/EVAL.md §7),
pin_plan.py (seed one plan into both arms so the paired delta stops carrying
@@ -553,7 +556,7 @@ repair pairs (in-session trajectory mining died with the api-agent, 2026-08-28
vendor CLIs log raw stdout, not structured tool turns); `flywheel refine` emits the loop's OWN transitions — one row per (round i → round
i+1) where the harness asked for a change, carrying what condemned the round, the
instructions written in response, both code snapshots and whether the score moved
-(the row is `flywheel/refine.RefineTransition`; INTERFACES has the fields and the
+(the row is `addons/dataset/refine.RefineTransition`; INTERFACES has the fields and the
drop reasons). That is the supervision the harness produces that a
one-shot corpus cannot: what a failing artefact looked like, what was wrong with it
in the harness's own words, and what the fix changed. `toolkits/llamafactory/`
@@ -563,7 +566,7 @@ trainer's format. `flywheel caption` adds
side-car mode); `flywheel gallery` is an alias of `3dcv gallery build --embed`
(the flywheel package has no renderer of its own).
-`codeverse/gallery/` is the **local** answer to the same question: `3dcv gallery
+`codeverse/addons/gallery/` is the **local** answer to the same question: `3dcv gallery
serve` indexes `runs/` + every `bench/out/*/runs`, serves the page **and the run
directories** on 127.0.0.1 (so every link opens: sheet, renders, `src/`, `object.glb`
in an orbit viewer built on the vendored three.js, `record.json`), and re-reads a
diff --git a/harness/docs/INTERFACES.md b/harness/docs/INTERFACES.md
index dc029150..7a468bff 100644
--- a/harness/docs/INTERFACES.md
+++ b/harness/docs/INTERFACES.md
@@ -530,16 +530,16 @@ from codeverse.texturing.plan import scene_texture_pack, texture_pack_prompt #
## flywheel/ + cli/
```python
from codeverse.flywheel.record import finalize_record, load_record, iter_runs, best_round_index, best_round_record
-from codeverse.gallery.index import hero_view # (ws, rec) -> (rel, label, n_views): the card image, rebased via ws
+from codeverse.addons.gallery.index import hero_view # (ws, rec) -> (rel, label, n_views): the card image, rebased via ws
from codeverse.flywheel.record import complexity_block, round_complexity # objective complexity of what shipped
# finalize_record fills record.extra["complexity"] = the BEST round's vector + plan_parts /
# parts_per_plan_part / by_round; every rounds_summary row gains "complexity" (the index or None)
-from codeverse.flywheel.export import export_samples # (runs_dir, out_dir, *, min_score=None, only_passed=False,
+from codeverse.addons.dataset.export import export_samples # (runs_dir, out_dir, *, min_score=None, only_passed=False,
# include_unbuilt=False, captions_dir=None, drop_duplicates=False) -> ExportReport{…, n_duplicates, duplicates, tiers}
from codeverse.flywheel.quality import quality_tier, prompt_hash, find_duplicates # tiers: A passed & 0 gate errors, B passed,
# C best ≥ 0.6, D else; dedupe = (code fingerprint, prompt)
-from codeverse.flywheel.pairs import build_pairs # (runs_dir, out_jsonl, *, min_delta=0.05) -> n
-from codeverse.flywheel.refine import build_refine, transitions, RefineTransition, REFINE_KINDS, outcome_of
+from codeverse.addons.dataset.pairs import build_pairs # (runs_dir, out_jsonl, *, min_delta=0.05) -> n
+from codeverse.addons.dataset.refine import build_refine, transitions, RefineTransition, REFINE_KINDS, outcome_of
# build_refine(runs_dir, out_jsonl, **kw) -> (rows written, Counter of drop reasons); writes via a .part file
# transitions(runs_dir, *, threshold=MIN_PREFERENCE_DELTA, max_diff_bytes=200_000, with_code=False,
# drops=None) -> Iterator[RefineTransition]; outcome_of(delta, threshold) -> the label
@@ -564,17 +564,17 @@ from codeverse.workspace import GIT_SAFE_FLAGS, GIT_SAFE_DIFF_FLAGS, git_safe_en
# is still live and why read_tree_at avoids every content-rendering command. git_safe_env drops
# the SYSTEM and GLOBAL config (GIT_CONFIG_NOSYSTEM, GIT_CONFIG_GLOBAL=/dev/null) and the
# inherited environment (HOME, PATH, GIT_TERMINAL_PROMPT)
-from codeverse.flywheel.captions import caption_sample # Δ (ws, record, model_id, *, model=None, out_dir=None) -> Captions;
+from codeverse.addons.dataset.captions import caption_sample # Δ (ws, record, model_id, *, model=None, out_dir=None) -> Captions;
# out_dir → side-car <out_dir>/<slug>.json, run untouched
-from codeverse.gallery import build_index, default_roots, build_static, serve, GalleryApp # THE local gallery
+from codeverse.addons.gallery import build_index, default_roots, build_static, serve, GalleryApp # THE local gallery
# build_index(roots) -> GalleryIndex (sections of RunEntry; never raises per run)
# build_static(roots, out_html, *, embed=False) -> (path, n, index)
# render_static(index, *, embed=…, extra_html="") — bench/report.py's page
# GalleryApp(roots, reload=False).route(path, query) -> Response (pure, testable)
# serve(roots, *, host=None, host_explicit=False, port=8765, reload=False)
-from codeverse.gallery.urls import safe_join # (root, rel) -> Path inside root, else PathError
-from codeverse.gallery.urls import content_type # .glb→model/gltf-binary, .py/.js/.frag→text/plain; charset=utf-8
-from codeverse.flywheel.index import build_index, query, summary # sqlite + parquet: adds quality_tier, gate_errors, cost_usd,
+from codeverse.addons.gallery.urls import safe_join # (root, rel) -> Path inside root, else PathError
+from codeverse.addons.gallery.urls import content_type # .glb→model/gltf-binary, .py/.js/.frag→text/plain; charset=utf-8
+from codeverse.addons.dataset.index import build_index, query, summary # sqlite + parquet: adds quality_tier, gate_errors, cost_usd,
# rounds, status, code_fingerprint, prompt_hash, duplicate_of, has_captions
3dcodeverse make [--profile economy|balanced|quality]|resume|status|show|render|judge|tools|mcp
|texture {pass,scene-pack,show}|cost {<slug>,show,cache,prices,profiles,estimate}
diff --git a/harness/docs/RUNBOOK.md b/harness/docs/RUNBOOK.md
index 249af358..1c9cd23e 100644
--- a/harness/docs/RUNBOOK.md
+++ b/harness/docs/RUNBOOK.md
@@ -160,7 +160,7 @@ unless you type `--host` yourself; it never serves a path outside the declared r
3dcv flywheel pairs runs/ pairs.jsonl [--min-delta 0.05]
3dcv flywheel refine runs/ refine.jsonl [--with-code]
# one row per round the harness asked to change; the row
- # schema is codeverse/flywheel/refine.RefineTransition and
+ # schema is codeverse/addons/dataset/refine.RefineTransition and
# INTERFACES has the call signatures. Training formats live
# in toolkits/llamafactory/, not here.
3dcv flywheel caption <slug> [--model …] [--out caps/] # --out = side-car mode, run untouched
diff --git a/harness/tests/core/test_addons_boundary.py b/harness/tests/core/test_addons_boundary.py
new file mode 100644
index 00000000..c7879e85
--- /dev/null
+++ b/harness/tests/core/test_addons_boundary.py
@@ -0,0 +1,29 @@
+"""``codeverse.addons`` reads finished runs; a run never needs it. One-way, pinned here."""
+
+from __future__ import annotations
+
+import re
+from pathlib import Path
+
+import codeverse
+import codeverse.addons
+
+PKG = Path(codeverse.__file__).parent
+# an import statement, or a module named in a string (the lazy `_import("codeverse.…")` call sites);
+# prose that points a reader at the addons is fine
+IMPORTS_ADDON = re.compile(r"""(?:\bimport|\bfrom)\s+codeverse\.addons|["']codeverse\.addons""")
+
+
+def test_nothing_outside_the_cli_imports_an_addon() -> None:
+ offenders = [
+ p.relative_to(PKG).as_posix()
+ for p in sorted(PKG.rglob("*.py"))
+ if p.relative_to(PKG).parts[0] not in {"addons", "cli"} and IMPORTS_ADDON.search(p.read_text())
+ ]
+ assert offenders == [], f"the core imports an addon: {offenders}"
+
+
+def test_the_addons_are_the_ones_the_docstring_lists() -> None:
+ names = sorted(p.name for p in (PKG / "addons").iterdir() if p.is_dir() and p.name != "__pycache__")
+ assert names == ["dataset", "gallery"]
+ assert all(f"``{n}``" in (codeverse.addons.__doc__ or "") for n in names)
diff --git a/harness/tests/flywheel_cli/test_captions.py b/harness/tests/flywheel_cli/test_captions.py
index 6352280f..6d5db7ca 100644
--- a/harness/tests/flywheel_cli/test_captions.py
+++ b/harness/tests/flywheel_cli/test_captions.py
@@ -6,9 +6,14 @@ import json
import pytest
+from codeverse.addons.dataset.captions import (
+ CaptionError,
+ Captions,
+ caption_sample,
+ validate_captions,
+)
from codeverse.contracts.chat import ChatRequest, ChatResponse, ImagePart
from codeverse.contracts.common import Usage
-from codeverse.flywheel.captions import CaptionError, Captions, caption_sample, validate_captions
from codeverse.flywheel.record import load_record
GOOD = {
@@ -120,8 +125,8 @@ GOOD_JS = {
def test_threejs_instruction_naming_threejs_is_valid():
"""The required 'Three.js' phrase must NOT trip the forbidden-API check (both js languages)."""
+ from codeverse.addons.dataset.captions import Captions, validate_captions
from codeverse.contracts.common import Language
- from codeverse.flywheel.captions import Captions, validate_captions
c = Captions(**GOOD_JS)
assert validate_captions(c, Language.THREEJS) == []
@@ -148,8 +153,8 @@ def test_caption_sample_threejs_run(tmp_path):
def test_caption_graphics_and_scene_phrases():
"""Graphics languages have phrases + phrase words (no KeyError, sane rules)."""
+ from codeverse.addons.dataset.captions import Captions, validate_captions
from codeverse.contracts.common import Language
- from codeverse.flywheel.captions import Captions, validate_captions
shader = Captions(
detailed="Neon rain streaks down a dark window while blurred city lights pulse behind the glass.",
diff --git a/harness/tests/flywheel_cli/test_flywheel.py b/harness/tests/flywheel_cli/test_flywheel.py
index 02da46c2..4f13ce4d 100644
--- a/harness/tests/flywheel_cli/test_flywheel.py
+++ b/harness/tests/flywheel_cli/test_flywheel.py
@@ -10,12 +10,12 @@ from pathlib import Path
import pytest
+from codeverse.addons.dataset.export import export_samples
+from codeverse.addons.dataset.index import build_index, summary
+from codeverse.addons.dataset.pack import pack_samples, verify_locators
+from codeverse.addons.dataset.pairs import build_pairs
from codeverse.contracts.run import RunRecord
from codeverse.flywheel import _git
-from codeverse.flywheel.export import export_samples
-from codeverse.flywheel.index import build_index, summary
-from codeverse.flywheel.pack import pack_samples, verify_locators
-from codeverse.flywheel.pairs import build_pairs
from codeverse.flywheel.quality import (
DedupeItem,
MeshFingerprint,
@@ -315,7 +315,7 @@ def test_build_index_and_queries(runs_dir: Path, tmp_path: Path):
# --------------------------------------------------------------------------- finding: repair pairs (pairs.py:115)
def test_repair_pairs_match_structurally_not_by_kind(tmp_path: Path):
"""Lifecycle labels the fixing round 'refine' — repair pairs must not need kind='repair'."""
- from codeverse.flywheel.pairs import repair_pairs
+ from codeverse.addons.dataset.pairs import repair_pairs
from tests.flywheel_cli.conftest import make_fake_run
ws, rec = make_fake_run(tmp_path / "runs", with_repair=True)
@@ -335,7 +335,7 @@ def test_in_round_repair_pairs_from_generated_commit(tmp_path: Path):
"""build_with_repair fixes inside one round: generated commit → final commit."""
import json as _json
- from codeverse.flywheel.pairs import in_round_repair_pairs
+ from codeverse.addons.dataset.pairs import in_round_repair_pairs
from tests.flywheel_cli.conftest import make_fake_run
ws, rec = make_fake_run(tmp_path / "runs")
@@ -370,7 +370,7 @@ def _degrade(judgment):
def test_degraded_round_is_not_a_zero_score(tmp_path: Path):
- from codeverse.flywheel.pairs import preference_pairs
+ from codeverse.addons.dataset.pairs import preference_pairs
from codeverse.flywheel.record import effective_judgment, effective_score, round_summary
from tests.flywheel_cli.conftest import make_fake_run
@@ -455,8 +455,8 @@ def test_export_includes_textured_assets_when_shipped(fake_run, tmp_path: Path):
def test_battery_layouts_are_discovered_by_flywheel_and_gallery(tmp_path):
"""All three battery layouts resolve runs; eval siblings never become gallery runs."""
+ from codeverse.addons.gallery.index import scan_root
from codeverse.flywheel.record import find_run_dirs, iter_runs
- from codeverse.gallery.index import scan_root
battery = tmp_path / "static_v2_flash" # run_bench: runs/<id>
(battery / "runs" / "some_run").mkdir(parents=True)
@@ -507,7 +507,7 @@ def test_parquet_keeps_the_complexity_columns_the_exporter_writes(tmp_path):
"""The fixed Arrow schema preserves exported complexity columns."""
import pyarrow.parquet as pq
- from codeverse.flywheel.export import parquet_schema, write_parquet
+ from codeverse.addons.dataset.export import parquet_schema, write_parquet
row = dict.fromkeys(parquet_schema().names)
row.update(id="x", key="k", complexity=7.5, complexity_band="high")
diff --git a/harness/tests/flywheel_cli/test_manifest_pack.py b/harness/tests/flywheel_cli/test_manifest_pack.py
index 4212d983..03a4d73a 100644
--- a/harness/tests/flywheel_cli/test_manifest_pack.py
+++ b/harness/tests/flywheel_cli/test_manifest_pack.py
@@ -20,14 +20,14 @@ from pathlib import Path
import pytest
-from codeverse.flywheel.export import (
+from codeverse.addons.dataset.export import (
MANIFEST_NAME,
ManifestError,
export_samples,
load_manifest,
write_manifest,
)
-from codeverse.flywheel.pack import PackError, pack_samples, verify_locators
+from codeverse.addons.dataset.pack import PackError, pack_samples, verify_locators
CHAIR_ID = "3dcodeverse/static_object/blender/wooden_chair_ab12cd34"
@@ -141,7 +141,7 @@ def test_a_failure_after_the_pack_loop_publishes_nothing(packed_ds: Path, monkey
write fails. Publishing the tars alone left the OLD index resolving to the new
tars' byte offsets — six rows pointing at the wrong bytes, and verify_locators
happily passing a corrupt dataset."""
- import codeverse.flywheel.pack as P
+ import codeverse.addons.dataset.pack as P
before = _packed_state(packed_ds)
monkeypatch.setattr(P, "write_parquet", lambda *a, **k: (_ for _ in ()).throw(OSError("No space left on device")))
diff --git a/harness/tests/flywheel_cli/test_quality_gallery.py b/harness/tests/flywheel_cli/test_quality_gallery.py
index 223fcf01..aec856f0 100644
--- a/harness/tests/flywheel_cli/test_quality_gallery.py
+++ b/harness/tests/flywheel_cli/test_quality_gallery.py
@@ -5,9 +5,9 @@ from __future__ import annotations
import json
from pathlib import Path
+from codeverse.addons.dataset.captions import caption_sample
+from codeverse.addons.dataset.export import export_samples, load_captions
from codeverse.contracts.common import Language
-from codeverse.flywheel.captions import caption_sample
-from codeverse.flywheel.export import export_samples, load_captions
from codeverse.flywheel.quality import find_duplicates, mark_duplicates, prompt_hash, quality_tier
from codeverse.flywheel.record import load_record
from tests.flywheel_cli.conftest import make_fake_run
diff --git a/harness/tests/flywheel_cli/test_refine.py b/harness/tests/flywheel_cli/test_refine.py
index ba6e18e5..6fc99f2d 100644
--- a/harness/tests/flywheel_cli/test_refine.py
+++ b/harness/tests/flywheel_cli/test_refine.py
@@ -1,4 +1,4 @@
-"""Refine transitions (codeverse/flywheel/refine.py)."""
+"""Refine transitions (codeverse/addons/dataset/refine.py)."""
from __future__ import annotations
@@ -7,10 +7,10 @@ from pathlib import Path
import pytest
+from codeverse.addons.dataset.pairs import MIN_PREFERENCE_DELTA
+from codeverse.addons.dataset.refine import build_refine, outcome_of, transitions
from codeverse.contracts.artifacts import GateFinding, GateReport, Severity
-from codeverse.flywheel.pairs import MIN_PREFERENCE_DELTA
from codeverse.flywheel.record import load_record
-from codeverse.flywheel.refine import build_refine, outcome_of, transitions
from tests.flywheel_cli.conftest import make_fake_run
diff --git a/harness/tests/flywheel_cli/test_run_identity.py b/harness/tests/flywheel_cli/test_run_identity.py
index 0a08b8f8..514a37b4 100644
--- a/harness/tests/flywheel_cli/test_run_identity.py
+++ b/harness/tests/flywheel_cli/test_run_identity.py
@@ -15,10 +15,10 @@ from pathlib import Path
import pytest
+from codeverse.addons.dataset.export import export_samples, load_captions
+from codeverse.addons.dataset.index import build_index as build_sqlite_index
+from codeverse.addons.dataset.pairs import build_pairs
from codeverse.contracts.run import RunId
-from codeverse.flywheel.export import export_samples, load_captions
-from codeverse.flywheel.index import build_index as build_sqlite_index
-from codeverse.flywheel.pairs import build_pairs
from codeverse.flywheel.record import FoundRun, battery_label, iter_runs, run_id_for, unique_files
from codeverse.flywheel.sample import SampleError
from tests.flywheel_cli.conftest import make_fake_run
@@ -130,7 +130,7 @@ def test_nested_run_identity_survives_every_flywheel_consumer(tmp_path: Path):
assert runs == {"cmp_a_stool__armx", "cmp_b_lamp__armx"}
# Caption sidecars are equally isolated.
- from codeverse.flywheel.captions import caption_sample
+ from codeverse.addons.dataset.captions import caption_sample
from tests.flywheel_cli.test_captions import GOOD, FakeModel
side = tmp_path / "caps"
diff --git a/harness/tests/flywheel_cli/test_run_layout_cli.py b/harness/tests/flywheel_cli/test_run_layout_cli.py
index 796a5c7e..86880430 100644
--- a/harness/tests/flywheel_cli/test_run_layout_cli.py
+++ b/harness/tests/flywheel_cli/test_run_layout_cli.py
@@ -9,10 +9,12 @@ from pathlib import Path
from typer.testing import CliRunner
+from codeverse.addons.dataset.export import export_samples
+from codeverse.addons.gallery import build_static
+from codeverse.addons.gallery.index import entry_from_record
from codeverse.cli.main import app
from codeverse.contracts.run import RunRecord
from codeverse.flywheel.deliverable import build_deliverable, deliverable_path, load_deliverable
-from codeverse.flywheel.export import export_samples
from codeverse.flywheel.record import load_record, package_run
from codeverse.flywheel.telemetry import (
build_telemetry,
@@ -21,8 +23,6 @@ from codeverse.flywheel.telemetry import (
load_telemetry,
stage_order,
)
-from codeverse.gallery import build_static
-from codeverse.gallery.index import entry_from_record
from codeverse.workspace import LAYOUT_ALIASES, Workspace
from .conftest import make_fake_run
diff --git a/harness/tests/gallery/test_hardening.py b/harness/tests/gallery/test_hardening.py
index 9a63875d..0445f4df 100644
--- a/harness/tests/gallery/test_hardening.py
+++ b/harness/tests/gallery/test_hardening.py
@@ -7,10 +7,10 @@ import csv
import io
from pathlib import Path
-from codeverse.gallery.compare import CSV_COLUMNS, csv_safe, export_csv
-from codeverse.gallery.index import build_index
-from codeverse.gallery.server import SANDBOXED_TYPES, GalleryApp
-from codeverse.gallery.urls import content_type
+from codeverse.addons.gallery.compare import CSV_COLUMNS, csv_safe, export_csv
+from codeverse.addons.gallery.index import build_index
+from codeverse.addons.gallery.server import SANDBOXED_TYPES, GalleryApp
+from codeverse.addons.gallery.urls import content_type
from tests.flywheel_cli.conftest import make_fake_run
diff --git a/harness/tests/gallery/test_index.py b/harness/tests/gallery/test_index.py
index 8175b10c..f314ca2f 100644
--- a/harness/tests/gallery/test_index.py
+++ b/harness/tests/gallery/test_index.py
@@ -5,9 +5,9 @@ from __future__ import annotations
import json
from pathlib import Path
+from codeverse.addons.gallery.index import build_index, default_roots, entry_for_dir
+from codeverse.addons.gallery.model import match, sort_entries, summarize
from codeverse.flywheel.record import battery_label
-from codeverse.gallery.index import build_index, default_roots, entry_for_dir
-from codeverse.gallery.model import match, sort_entries, summarize
def test_build_index_sections_and_states(gallery_tree: dict[str, Path]):
diff --git a/harness/tests/gallery/test_page.py b/harness/tests/gallery/test_page.py
index dd12341d..64832a2f 100644
--- a/harness/tests/gallery/test_page.py
+++ b/harness/tests/gallery/test_page.py
@@ -7,9 +7,9 @@ import re
from html.parser import HTMLParser
from pathlib import Path
-from codeverse.gallery.index import build_index
-from codeverse.gallery.page import build_static, render_index, render_static
-from codeverse.gallery.urls import StaticUrls, UrlMaker
+from codeverse.addons.gallery.index import build_index
+from codeverse.addons.gallery.page import build_static, render_index, render_static
+from codeverse.addons.gallery.urls import StaticUrls, UrlMaker
VOID = {"area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param",
"source", "track", "wbr"}
diff --git a/harness/tests/gallery/test_server.py b/harness/tests/gallery/test_server.py
index 658c0e41..7c1077ec 100644
--- a/harness/tests/gallery/test_server.py
+++ b/harness/tests/gallery/test_server.py
@@ -13,14 +13,14 @@ from pathlib import Path
import pytest
-from codeverse.gallery.server import (
+from codeverse.addons.gallery.server import (
DEFAULT_HOST,
GalleryApp,
GalleryError,
make_server,
resolve_host,
)
-from codeverse.gallery.urls import PathError, content_type, safe_join
+from codeverse.addons.gallery.urls import PathError, content_type, safe_join
@pytest.fixture
@@ -124,7 +124,7 @@ def test_unknown_run_and_unknown_route(app: GalleryApp):
def test_vendor_and_viewer(app: GalleryApp):
- from codeverse.gallery.viewer import viewer_available
+ from codeverse.addons.gallery.viewer import viewer_available
v = app.route("/viewer/runs/wooden_chair_ab12cd34/artifacts/object.glb")
if viewer_available():
diff --git a/harness/tests/gallery/test_triage.py b/harness/tests/gallery/test_triage.py
index 49bcf08b..9e557a67 100644
--- a/harness/tests/gallery/test_triage.py
+++ b/harness/tests/gallery/test_triage.py
@@ -14,18 +14,24 @@ from urllib.parse import parse_qs
import pytest
-from codeverse.gallery.compare import (
+from codeverse.addons.gallery.compare import (
CSV_COLUMNS,
MAX_COMPARE,
export_csv,
parse_keys,
render_compare,
)
-from codeverse.gallery.index import build_index, hero_view
-from codeverse.gallery.model import VERDICTS, humanize_view, match, summarize, verdict_breakdown
-from codeverse.gallery.page import render_index
-from codeverse.gallery.server import GalleryApp
-from codeverse.gallery.urls import UrlMaker
+from codeverse.addons.gallery.index import build_index, hero_view
+from codeverse.addons.gallery.model import (
+ VERDICTS,
+ humanize_view,
+ match,
+ summarize,
+ verdict_breakdown,
+)
+from codeverse.addons.gallery.page import render_index
+from codeverse.addons.gallery.server import GalleryApp
+from codeverse.addons.gallery.urls import UrlMaker
# --------------------------------------------------------------------------- breakdown
@@ -187,7 +193,7 @@ def test_compare_survives_a_run_with_no_record(gallery_tree: dict[str, Path]):
def test_bulk_bar_is_offered_on_the_server_but_not_in_the_static_build(gallery_tree: dict[str, Path]):
- from codeverse.gallery.page import render_static
+ from codeverse.addons.gallery.page import render_static
index = build_index([gallery_tree["runs"]])
served = render_index(index, UrlMaker())