examples: use proper pyproject.toml setup for all python ones
@jiwenc-nv is already working on this.
Since Aug 28, 2026.
- Dominant language
- Python
- Stars
- 385
- Forks
- 88
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 82
Description
Partner feedback on #736 (item 5): the Physical AI Developer team copied example code into their own project, hit import failures, and patched their copies with dual-mode import guards. Worth settling a convention rather than leaving each example to pick one.
Two conventions coexist under examples/:
mujoco_xr— its own wheel,isaacteleop_examples.mujoco_xrnamespace, relative imports, documented aspython -m. Copies cleanly.camera_vizandteleop_ros2/python— 21 files import siblings as top-level modules:from pipeline import ...,from sources import ...,from messages import ...,from geometry import .... These resolve only because the script's own directory lands onsys.path.
So the second group breaks under python -m, breaks the moment a file is copied into a package (what the partner hit), and squats on very generic top-level names — pipeline, sources, messages, constants, assets. examples/teleop_ros2/python/pyproject.toml already carries pythonpath = ["."] to keep pytest working around it.
Suggested direction: make both directories real packages with relative imports plus a -m entry point, matching mujoco_xr, and write the convention down for examples. I'd avoid adopting try: from .x / except ImportError: from x guards repo-wide — that doubles every import site to paper over an invocation mistake.
Cross-repo note: huggingface/lerobot's examples/isaac_teleop_to_so101/ uses files(__package__) (common.py:76) and relative imports. Its README documents python -m only, so it works as specified; recording it here for traceability.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.