Skip to content

robot_assets: put the CAD toolchain behind a cad extra - #15

Merged
T-K-233 merged 1 commit into
mainfrom
cad-extra
Aug 22, 2026
Merged

robot_assets: put the CAD toolchain behind a cad extra#15
T-K-233 merged 1 commit into
mainfrom
cad-extra

Conversation

@T-K-233

@T-K-233 T-K-233 commented Aug 20, 2026

Copy link
Copy Markdown
Member

Why

robot-assets ships two unrelated halves in one distribution:

  • robot_assets/loader.py — a stdlib-only GitHub ZIP fetch/cache helper (load("robots/lite/urdf/lite.urdf")), which is what runtime consumers want
  • robot_assets/workflow/* — the CAD → URDF/MJCF/xacro generator

Both were covered by one hard dependency list, so installing this package for the loader also pulled mujoco, onshape-to-robot and pymeshlab — none of which the loader imports. A description package should be asset-generation tooling plus assets; deployment code consuming it shouldn't inherit a simulator.

The ROS side was already clean (package.xml only exec_depends on xacro), so this only ever leaked through the Python wheel — but it leaked to exactly the consumers we care about.

What

  • dependencies = []; the three move to [project.optional-dependencies] cad
  • test group depends on robot-assets[cad], so CI needs no change — it already runs uv sync --group test
  • Guarded the two entry points that need the toolchain: urdf_to_mjcf.py's import mujoco, and the onshape-to-robot CLI lookup in onshape_to_urdf.py (a subprocess, so a missing install would otherwise fail obscurely). Both now name the extra.
  • README: uv sync --extra cad for regeneration; noted the dependency-free base install

On the name: extras in the wild are nouns for the capability you're opting into (mujoco itself ships sysid/usd), so cad over a verb like generate. It also matches this repo's own vocabulary — robots/<robot>/cad/ is exactly the directory holding the inputs these three deps consume.

Two notes kept inline in the extra, since neither is obvious from the dep list:

  • MuJoCo is the MJCF compiler, not a simulatorurdf_to_mjcf.py uses MjModel.from_xml_path + mj_saveLastXML. There's no standalone binding for it.
  • pymeshlab is really onshape-to-robot[pymeshlab] — never imported by us, required because every cad/config.json sets "simplify_stls": true. Kept as an explicit pin to preserve the >=2025.7.post1 floor.

Downstream

prime_description declares a plain robot-assets git dependency, with a comment noting it "transitively provides mujoco / onshape-to-robot / pymeshlab" — which stops being true here. It imports robot_assets.workflow, so it needs robot-assets[cad] @ git+.... That change is prepared and must merge after this one, since the extra has to exist upstream first.

The same change is up for Lite-Specialist-Description (T-K-233/Lite-Specialist-Description#1).

Verification

  • Base install is exactly one package with zero transitive deps, and from robot_assets import load works in it
  • Both guards fire with their intended messages in that bare env
  • uv sync --group test resolves the self-referential extra correctly
  • pytest: 1569 passed, 6 skipped; flake8 clean on touched files (the one W503 in urdf_to_mjcf.py predates this branch)

🤖 Generated with Claude Code

https://claude.ai/code/session_01FwK47CB1Cdu2PEYtqt87Js

The package ships two unrelated halves: `robot_assets.loader`, a stdlib-only
GitHub fetch/cache helper that runtime consumers use to pull descriptions, and
`robot_assets.workflow`, the CAD -> URDF/MJCF/xacro generator. Both were covered
by one hard dependency list, so anyone installing this for the loader also got
mujoco, onshape-to-robot and pymeshlab -- none of which the loader imports.

Move the three to a `cad` extra and leave the base install dependency-free.
Deployment code that only calls `load()` now pulls in no simulator and no CAD
toolchain; asset generation asks for `robot-assets[cad]`.

MuJoCo here is the MJCF compiler rather than a simulator (urdf_to_mjcf.py goes
through MjModel.from_xml_path / mj_saveLastXML), and pymeshlab is really
onshape-to-robot's own extra, needed because every cad/config.json sets
"simplify_stls": true -- both noted inline so the extra stays self-explaining.

Guard the two entry points that need the toolchain so a base install fails with
a message naming the extra instead of a bare ModuleNotFoundError, or an obscure
subprocess failure for the onshape-to-robot CLI.

The `test` group depends on `robot-assets[cad]`, so CI needs no change.

Note for downstream: prime_description declares a plain `robot-assets` git
dependency and relies on these three arriving transitively. It needs to move to
`robot-assets[cad]` once this lands.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FwK47CB1Cdu2PEYtqt87Js
@T-K-233
T-K-233 force-pushed the cad-extra branch 2 times, most recently from 0d8b9f5 to f3b6899 Compare August 20, 2026 18:47
@T-K-233
T-K-233 merged commit dc55b81 into main Aug 22, 2026
2 checks passed
@T-K-233
T-K-233 deleted the cad-extra branch August 22, 2026 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant