Official Codebase of 3DCodeVerse
Python
toolkits: the contributor CLI's command is 3dcode-data — the harness takes 3dcode
gaoypenga848a54b6d95
diff --git a/README.md b/README.mdindex 12d5b299..91f64737 100644--- a/README.md+++ b/README.md@@ -41,7 +41,7 @@ Start at [`harness/README.md`](harness/README.md); design and operation live in## [`toolkits/`](toolkits/) — raw 3D projects → trainable data-Everything that operates on data rather than models: the installable `3dcode`+Everything that operates on data rather than models: the installable `3dcode-data`contributor CLI (validate / dedupe / execute / render / push, with per-dialectmodules for Blender-Python, CadQuery, build123d, FreeCAD, OpenSCAD), per-sourcecuration pipelines (convert → execute → render → ground truth → dedupe →diff --git a/toolkits/3dcode_cli/CLAUDE.md b/toolkits/3dcode_cli/CLAUDE.mdindex a4fc7f32..26cba97a 100644--- a/toolkits/3dcode_cli/CLAUDE.md+++ b/toolkits/3dcode_cli/CLAUDE.md@@ -12,8 +12,8 @@ multi-dialect, license-clean corpus for training & evaluating 3D-from-code gener**This repo (`3dcode`)** is the CLI toolkit contributors run **on their own machine** tovalidate, fingerprint (dedup), executability-check, render, and upload (code → 3D) *projects*.-Data flows: `3dcode push` → private R2 staging + a validation report → a maintainer reviews in-a web Inbox → approve → `3dcode ingest` pulls it into the canonical store. Everything that can+Data flows: `3dcode-data push` → private R2 staging + a validation report → a maintainer reviews in+a web Inbox → approve → `3dcode-data ingest` pulls it into the canonical store. Everything that canrun locally runs locally — nothing routes heavy compute/bandwidth through a central server.## The data model (memorize this)@@ -43,11 +43,11 @@ your eyes open — never author blind:1. Write **self-contained** code for the target dialect (no project-local imports; e.g. aBlender script must NOT `import infinigen` — inline what it needs).-2. `3dcode exec ./dir` → it must run **error-free AND produce a non-empty mesh**. Fix until green.+2. `3dcode-data exec ./dir` → it must run **error-free AND produce a non-empty mesh**. Fix until green.(Blender Python is checked in Blender 5.0 **and** 5.1 — make it work in both.)-3. `3dcode render ./dir` → look at the render. Iterate until the shape/material is right.-4. `3dcode check ./dir` → if it's a near-duplicate of the corpus, drop or justify it.-5. `3dcode push ./dir --source <name>` → uploads + registers for review.+3. `3dcode-data render ./dir` → look at the render. Iterate until the shape/material is right.+4. `3dcode-data check ./dir` → if it's a near-duplicate of the corpus, drop or justify it.+5. `3dcode-data push ./dir --source <name>` → uploads + registers for review.**Quality bar:** runs + builds geometry; grounded by a reference image and/or prompt; not anear-duplicate; not absurdly long (anomaly-flagged); permissive `license`/`provenance` in meta.@@ -56,7 +56,7 @@ near-duplicate; not absurdly long (anomaly-flagged); permissive `license`/`prove```threedcode/- cli.py # the `3dcode` entry (Typer)+ cli.py # the `3dcode-data` entry (Typer)config.py storage.py(R2) schema.py hashing.py registry.pydialects/ # per-dialect adapters: blender_python, cadquery_dialect, build123d_dialect,# openscad_dialect, freecad_dialect (CadQuery & build123d = separate venvs)diff --git a/toolkits/3dcode_cli/README.md b/toolkits/3dcode_cli/README.mdindex 74050b83..1271605d 100644--- a/toolkits/3dcode_cli/README.md+++ b/toolkits/3dcode_cli/README.md@@ -1,7 +1,7 @@# 3dcode — 3DCodeVerse data toolkitCLI to validate, fingerprint (dedup), and upload **(code → 3D)** projects to the-3DCodeVerse corpus. Contributors run `3dcode push` from their own machine; data goes+3DCodeVerse corpus. Contributors run `3dcode-data push` from their own machine; data goesstraight to a private staging bucket (Cloudflare R2), gets reviewed, then ingested to thecanonical store.@@ -34,7 +34,7 @@ pipx install "3dcode[dedup] @ git+https://github.com/gaoypeng/3dcode_toolkit"## Configure (once)```bash-3dcode config set \+3dcode-data config set \--endpoint https://<ACCOUNT_ID>.r2.cloudflarestorage.com \--bucket 3dcodeverse \--access-key-id <YOUR_KEY> --secret-access-key <YOUR_SECRET> \@@ -46,23 +46,23 @@ Saved to `~/.config/3dcode/config.toml` (chmod 600). You can also use `R2_*` env## Use```bash-3dcode validate ./data # layout + structure + anomaly checks, no upload-3dcode check ./data # validate + flag duplicates vs the corpus, no upload-3dcode anomalies ./data # distribution outliers (code length / char count)-3dcode exec ./data # run the code locally; record pass/fail in meta.json-3dcode render ./data --mode white # render the code locally into renders/ (white | textured)-3dcode grid ./data # contact-sheet PNG of all thumbnails (visual review)-3dcode push ./data --source you # validate → hash → dedup-check → upload → register+3dcode-data validate ./data # layout + structure + anomaly checks, no upload+3dcode-data check ./data # validate + flag duplicates vs the corpus, no upload+3dcode-data anomalies ./data # distribution outliers (code length / char count)+3dcode-data exec ./data # run the code locally; record pass/fail in meta.json+3dcode-data render ./data --mode white # render the code locally into renders/ (white | textured)+3dcode-data grid ./data # contact-sheet PNG of all thumbnails (visual review)+3dcode-data push ./data --source you # validate → hash → dedup-check → upload → register```-### Executability (`3dcode exec`)+### Executability (`3dcode-data exec`)Runs each project's code **locally, in your own runtimes** (nothing is uploaded) and recordsthe result in `meta.json`. Pass = ran error-free **and** produced a non-empty mesh. Configurethe runtimes once:```bash-3dcode config set --blender-5-0 /path/to/blender-5.0/blender \+3dcode-data config set --blender-5-0 /path/to/blender-5.0/blender \--blender-5-1 /path/to/blender-5.1/blender```Wired dialects: Blender Python (5.0 + 5.1), CadQuery, build123d, OpenSCAD, FreeCAD.@@ -102,9 +102,9 @@ Each code type plugs in how to validate / find code / hash for that dialect:After reviewing uploads in the web Inbox (`/data/inbox`) and approving them:```bash-3dcode config set --core-dir /path/to/canonical/store-3dcode ingest --all-approved # pull approved R2 → core dir, mark ingested, clear staging-3dcode ingest <source>/<project> # or a single project+3dcode-data config set --core-dir /path/to/canonical/store+3dcode-data ingest --all-approved # pull approved R2 → core dir, mark ingested, clear staging+3dcode-data ingest <source>/<project> # or a single project```## Statusdiff --git a/toolkits/3dcode_cli/VENDORED.md b/toolkits/3dcode_cli/VENDORED.mdindex 38e54ff4..256633e0 100644--- a/toolkits/3dcode_cli/VENDORED.md+++ b/toolkits/3dcode_cli/VENDORED.md@@ -9,3 +9,10 @@ toolchain is maintained in one place.* files: 25 here + 49 curation scripts in `../curation/` = the upstream repo's 74 tracked filesEdits made here do not flow upstream automatically. Decide which copy is canonical before changing either.++## Differences from upstream++* 2026-09-21 — the console command is `3dcode-data` here (upstream: `3dcode`). The harness in+ `../../harness` took `3dcode` as its short command, and two distributions cannot install the same+ script name. Unchanged: the distribution name `3dcode` (so `pip install "3dcode[dedup]"` still+ works), the python package `threedcode`, and the credentials file `~/.config/3dcode/config.toml`.diff --git a/toolkits/3dcode_cli/config.toml.example b/toolkits/3dcode_cli/config.toml.exampleindex 56a11791..90e3b328 100644--- a/toolkits/3dcode_cli/config.toml.example+++ b/toolkits/3dcode_cli/config.toml.example@@ -10,7 +10,7 @@ secret_access_key = "<YOUR_R2_SECRET_ACCESS_KEY>"# Default source folder for your uploads (overridable with --source).source = "<your-source-name>"-# Optional: local runtimes for `3dcode exec` / `render` (only the dialects you use).+# Optional: local runtimes for `3dcode-data exec` / `render` (only the dialects you use).# blender_5_0 = "/path/to/blender-5.0/blender"# blender_5_1 = "/path/to/blender-5.1/blender"# openscad = "/path/to/OpenSCAD.AppImage"diff --git a/toolkits/3dcode_cli/docs/contributing.md b/toolkits/3dcode_cli/docs/contributing.mdindex 058315e9..d7a4a89e 100644--- a/toolkits/3dcode_cli/docs/contributing.md+++ b/toolkits/3dcode_cli/docs/contributing.md@@ -12,7 +12,7 @@ pipx install "git+https://github.com/gaoypeng/3dcode_toolkit"# [dedup] geometry + perceptual hashing (recommended)# [cadquery] CadQuery exec/render-3dcode config set \+3dcode-data config set \--endpoint https://<ACCOUNT_ID>.r2.cloudflarestorage.com \--bucket 3dcodeverse \--access-key-id <YOUR_KEY> --secret-access-key <YOUR_SECRET> \@@ -32,7 +32,7 @@ yourname/model.py # the code (the core artifact)renders/ # rendered images + .glb meshprompt.txt # text prompt (optional)- meta.json # auto-generated by `3dcode`+ meta.json # auto-generated by `3dcode-data`chair_02/...```@@ -40,11 +40,11 @@ yourname/## 3. Workflow```bash-3dcode validate ./yourname # layout + anomaly checks-3dcode exec ./yourname # run the code locally, confirm it builds geometry-3dcode render ./yourname # (optional) render thumbnails into renders/-3dcode check ./yourname # flag duplicates against the existing corpus-3dcode push ./yourname --source yourname # validate → fingerprint → upload → register+3dcode-data validate ./yourname # layout + anomaly checks+3dcode-data exec ./yourname # run the code locally, confirm it builds geometry+3dcode-data render ./yourname # (optional) render thumbnails into renders/+3dcode-data check ./yourname # flag duplicates against the existing corpus+3dcode-data push ./yourname --source yourname # validate → fingerprint → upload → register```Everything runs **on your machine** (your runtimes, your bandwidth) — nothing routes through acentral server. `push` uploads directly to the private staging bucket and registers a@@ -58,8 +58,8 @@ validation report. A maintainer then reviews it in the web Inbox and ingests it.## 5. What makes a good sample-- Code that **runs error-free and produces non-empty geometry** (`3dcode exec` checks this).+- Code that **runs error-free and produces non-empty geometry** (`3dcode-data exec` checks this).- A grounding signal: a **reference image and/or a text prompt**.-- **Not a near-duplicate** of something already in the corpus (`3dcode check` flags these).-- Reasonable size — wildly over-long code is flagged by `3dcode anomalies`.+- **Not a near-duplicate** of something already in the corpus (`3dcode-data check` flags these).+- Reasonable size — wildly over-long code is flagged by `3dcode-data anomalies`.- A permissive, attributable **license** (set `license`/`provenance` in `meta.json`).diff --git a/toolkits/3dcode_cli/pyproject.toml b/toolkits/3dcode_cli/pyproject.tomlindex ecd4a4f7..242695f4 100644--- a/toolkits/3dcode_cli/pyproject.toml+++ b/toolkits/3dcode_cli/pyproject.toml@@ -20,10 +20,10 @@ dependencies = [dedup = ["trimesh>=4.0", "imagehash>=4.3", "Pillow>=10.0", "numpy>=1.24"]cadquery = ["cadquery>=2.5"]build123d = ["build123d>=0.5"]-# OpenSCAD + FreeCAD are system binaries (not pip) — set their paths via `3dcode config set`.+# OpenSCAD + FreeCAD are system binaries (not pip) — set their paths via `3dcode-data config set`.[project.scripts]-"3dcode" = "threedcode.cli:app"+"3dcode-data" = "threedcode.cli:app"[tool.setuptools.packages.find]include = ["threedcode*"]diff --git a/toolkits/3dcode_cli/threedcode/__init__.py b/toolkits/3dcode_cli/threedcode/__init__.pyindex 9971cede..cbfa046a 100644--- a/toolkits/3dcode_cli/threedcode/__init__.py+++ b/toolkits/3dcode_cli/threedcode/__init__.py@@ -1,3 +1,3 @@-"""3DCodeVerse data toolkit (`3dcode`) — validate, dedup, and upload (code -> 3D) projects."""+"""3DCodeVerse data toolkit (`3dcode-data`) — validate, dedup, and upload (code -> 3D) projects."""__version__ = "0.1.0"diff --git a/toolkits/3dcode_cli/threedcode/cli.py b/toolkits/3dcode_cli/threedcode/cli.pyindex 93df5875..80092227 100644--- a/toolkits/3dcode_cli/threedcode/cli.py+++ b/toolkits/3dcode_cli/threedcode/cli.py@@ -1,8 +1,8 @@-"""`3dcode` CLI — contributor-side commands to validate and upload (code -> 3D) projects.+"""`3dcode-data` CLI — contributor-side commands to validate and upload (code -> 3D) projects.- 3dcode config set --endpoint ... --access-key-id ... --secret-access-key ...- 3dcode validate ./data- 3dcode push ./data --source yourname+ 3dcode-data config set --endpoint ... --access-key-id ... --secret-access-key ...+ 3dcode-data validate ./data+ 3dcode-data push ./data --source yourname"""from __future__ import annotations@@ -25,7 +25,7 @@ app.add_typer(config_app, name="config")@app.command()def version():"""Print the toolkit version."""- typer.echo(f"3dcode {__version__}")+ typer.echo(f"3dcode-data {__version__}")@config_app.command("set")@@ -37,11 +37,11 @@ def config_set(source: str = typer.Option(None, help="default source folder for your uploads"),api: str = typer.Option(None, help="registry API base (default 3dcodebench.com)"),contrib_token: str = typer.Option(None, help="shared contributor token for the registry"),- blender_5_0: str = typer.Option(None, help="local Blender 5.0 binary (for 3dcode exec)"),+ blender_5_0: str = typer.Option(None, help="local Blender 5.0 binary (for 3dcode-data exec)"),blender_5_1: str = typer.Option(None, help="local Blender 5.1 binary"),openscad: str = typer.Option(None, help="local OpenSCAD binary/AppImage (.scad)"),freecadcmd: str = typer.Option(None, help="local freecadcmd binary (FreeCAD)"),- core_dir: str = typer.Option(None, help="admin canonical store dir (for 3dcode ingest)"),+ core_dir: str = typer.Option(None, help="admin canonical store dir (for 3dcode-data ingest)"),):"""Write R2 settings to ~/.config/3dcode/config.toml (chmod 600)."""path = save_config({@@ -160,7 +160,7 @@ def exec_run(path: Path = typer.Argument(..., exists=True),write: bool = typer.Option(True, help="write the result into each meta.json")):"""Run each project's code in its dialect runtime(s); record pass/fail in meta.json.- Runs LOCALLY in your own runtimes (configure Blender via `3dcode config set+ Runs LOCALLY in your own runtimes (configure Blender via `3dcode-data config set--blender-5-0 ... --blender-5-1 ...`); nothing is uploaded. Pass = error-free AND a non-empty mesh."""from .dialects import run_dialect@@ -270,7 +270,7 @@ def render(path: Path = typer.Argument(..., exists=True),"""Render each project's code LOCALLY into renders/ (white clay or textured) — no upload.Runs the code in your local Blender (config --blender-5-0) and writes view_00..03.png +- thumb.png. Then `3dcode push` picks up the renders (modality + phash dedup + Inbox preview).+ thumb.png. Then `3dcode-data push` picks up the renders (modality + phash dedup + Inbox preview)."""from .dialects import render_dialectcfg = load_config()@@ -309,7 +309,7 @@ def grid(path: Path = typer.Argument(..., exists=True),typer.secho("grid needs Pillow — install 3dcode[dedup]", fg="red", err=True)raise typer.Exit(1)if n == 0:- typer.secho("no thumbnails found — run `3dcode render` first?", fg="yellow")+ typer.secho("no thumbnails found — run `3dcode-data render` first?", fg="yellow")else:typer.secho(f"grid: {n} thumbnails → {dest}", fg="green")diff --git a/toolkits/3dcode_cli/threedcode/config.py b/toolkits/3dcode_cli/threedcode/config.pyindex f2cf0f53..bb79af3e 100644--- a/toolkits/3dcode_cli/threedcode/config.py+++ b/toolkits/3dcode_cli/threedcode/config.py@@ -43,11 +43,11 @@ class Config:source: str = ""api: str = "https://www.3dcodebench.com" # registry + dedup-index endpointscontrib_token: str = "" # shared contributor token for those endpoints- blender_5_0: str = "" # local Blender 5.0 binary, for `3dcode exec`+ blender_5_0: str = "" # local Blender 5.0 binary, for `3dcode-data exec`blender_5_1: str = "" # local Blender 5.1 binaryopenscad: str = "" # local OpenSCAD binary/AppImage (.scad exec/render)freecadcmd: str = "" # local freecadcmd binary (FreeCAD exec/render)- core_dir: str = "/lab/yipeng/infinigen/3dcodeverse" # admin-side canonical store (for `3dcode ingest`)+ core_dir: str = "/lab/yipeng/infinigen/3dcodeverse" # admin-side canonical store (for `3dcode-data ingest`)def require_r2(self) -> None:missing = [k for k in ("endpoint", "bucket", "access_key_id", "secret_access_key")@@ -55,7 +55,7 @@ class Config:if missing:raise SystemExit(f"R2 not configured (missing {', '.join(missing)}). "- f"Run `3dcode config set ...` or set the R2_* env vars."+ f"Run `3dcode-data config set ...` or set the R2_* env vars.")diff --git a/toolkits/3dcode_cli/threedcode/storage.py b/toolkits/3dcode_cli/threedcode/storage.pyindex d80512fc..61532d02 100644--- a/toolkits/3dcode_cli/threedcode/storage.py+++ b/toolkits/3dcode_cli/threedcode/storage.py@@ -1,4 +1,4 @@-"""R2 (S3-compatible) object storage — thin boto3 wrapper used by `3dcode`.+"""R2 (S3-compatible) object storage — thin boto3 wrapper used by `3dcode-data`.Contributors upload straight from their own machine to the staging bucket; the adminside pulls/lists/deletes the same way. Keys are ``<source>/<project>/<relpath>``.diff --git a/toolkits/README.md b/toolkits/README.mdindex f4aed154..410b8d3b 100644--- a/toolkits/README.md+++ b/toolkits/README.md@@ -11,7 +11,7 @@ contributor's project ──▶ curation ──▶ 3DCodeVerse on the Hub ──| folder | stage | what it does ||---|---|---|-| [`3dcode_cli/`](3dcode_cli/) | contributor → corpus | the installable `3dcode` CLI: validate, fingerprint/dedupe, execute, render and push a project to the staging bucket. Per-dialect modules for Blender-Python, CadQuery, build123d, FreeCAD and OpenSCAD |+| [`3dcode_cli/`](3dcode_cli/) | contributor → corpus | the installable `3dcode-data` CLI: validate, fingerprint/dedupe, execute, render and push a project to the staging bucket. Per-dialect modules for Blender-Python, CadQuery, build123d, FreeCAD and OpenSCAD || [`curation/`](curation/) | raw → corpus | per-source curation: convert a source's native format to runnable projects, execute/render them, compute ground-truth meshes, dedupe, pack to tar+parquet, upload to the Hub || [`llamafactory/`](llamafactory/) | corpus → training data | turn every corpus subdirectory into a LLaMA-Factory dataset, verify it with the real compilers/runtimes, flatten multi-file samples, build multimodal (render + instruction) variants, and sample training mixes |