From 4cdd8abd98b88d13fa5f2f864a26f691afe29c59 Mon Sep 17 00:00:00 2001 From: Ivan Yang Date: Wed, 28 Oct 2026 14:59:14 -0700 Subject: [PATCH 1/2] examples: give the sdist the same only-include as the wheel Each example set only-include on the wheel target alone, so `uv build` packed the whole example directory into the sdist: tracked media (15.7 MB for vehicle_teleop, 5 MB for noitom), C++ sources, scripts, and, where the example has its own .gitignore, a local uv.lock and build trees. Move only-include (and camera_viz's exclude) to [tool.hatch.build], which both targets read, and keep `sources` on the wheel target. Wheels and editable installs are unchanged; examples/README.md states the rule. Signed-off-by: Ivan Yang --- examples/README.md | 11 +++++++++-- examples/camera_viz/pyproject.toml | 6 ++++-- examples/cloudxr_mujoco_teleop/pyproject.toml | 4 +++- examples/deviceio_live_view/pyproject.toml | 4 +++- examples/haptic_feedback/pyproject.toml | 4 +++- examples/mcap_record_replay/pyproject.toml | 4 +++- examples/noitom/pyproject.toml | 4 +++- examples/oglo_tactile/pyproject.toml | 4 +++- examples/oxr/pyproject.toml | 4 +++- examples/retargeting/pyproject.toml | 4 +++- examples/sharpa_avatar/pyproject.toml | 4 +++- examples/soma_body_publisher/pyproject.toml | 4 +++- examples/soma_hand_publisher/pyproject.toml | 4 +++- examples/tactile/pyproject.toml | 4 +++- examples/teleop/pyproject.toml | 4 +++- examples/teleop_ros2/pyproject.toml | 4 +++- examples/teleop_session_manager/pyproject.toml | 4 +++- examples/vehicle_teleop/pyproject.toml | 4 +++- 18 files changed, 61 insertions(+), 20 deletions(-) diff --git a/examples/README.md b/examples/README.md index f3d5245ce2..3ee484be92 100644 --- a/examples/README.md +++ b/examples/README.md @@ -82,13 +82,20 @@ the smallest complete one. - With hatchling, use `only-include` + `sources`, **not** `packages`: ```toml - [tool.hatch.build.targets.wheel] + [tool.hatch.build] only-include = ["python/isaaccapture_examples/"] + + [tool.hatch.build.targets.wheel] sources = ["python"] ``` `packages` keeps only the last path component, so it builds without complaint - and produces a wheel rooted at a bare top-level `/`. + and produces a wheel rooted at a bare top-level `/`. `only-include` + goes in `[tool.hatch.build]` so the sdist gets it too. Without it the sdist + takes the whole example directory: tracked media, stray `.mcap` recordings + and, in an example with its own `.gitignore` (hatchling reads only the + nearest one), `uv.lock` and build trees. `sources` stays on the wheel: the + sdist must keep the `python/` prefix that the wheel build looks for. - Keep `[tool.uv.sources]` last in the file. `install_python_example()` strips it from the installed copy by matching up to the next `[`, so a block after it loses its comments. diff --git a/examples/camera_viz/pyproject.toml b/examples/camera_viz/pyproject.toml index 709e6f38b6..8c4183783c 100644 --- a/examples/camera_viz/pyproject.toml +++ b/examples/camera_viz/pyproject.toml @@ -61,10 +61,12 @@ viewer = ["isaaccapture[cloudxr]", "pillow>=10.0"] # The native codec's .so is built in place by codec/build.sh, so it is picked up # from the source tree rather than shipped by this build. Hatchling reads only # this directory's .gitignore, so the codec build tree is excluded here. -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/camera_viz"] -sources = ["python"] exclude = ["/python/isaaccapture_examples/camera_viz/codec/build", "*.so"] +[tool.hatch.build.targets.wheel] +sources = ["python"] + [tool.uv] python-preference = "only-managed" diff --git a/examples/cloudxr_mujoco_teleop/pyproject.toml b/examples/cloudxr_mujoco_teleop/pyproject.toml index bbe0cb38d4..5d7e556265 100644 --- a/examples/cloudxr_mujoco_teleop/pyproject.toml +++ b/examples/cloudxr_mujoco_teleop/pyproject.toml @@ -24,6 +24,8 @@ dependencies = [ # # vive_assets/ lives inside the package because the modules resolve it from # __file__, so the meshes must travel with them. -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/cloudxr_mujoco_teleop"] + +[tool.hatch.build.targets.wheel] sources = ["python"] diff --git a/examples/deviceio_live_view/pyproject.toml b/examples/deviceio_live_view/pyproject.toml index 243b533ec3..006adbaffc 100644 --- a/examples/deviceio_live_view/pyproject.toml +++ b/examples/deviceio_live_view/pyproject.toml @@ -23,8 +23,10 @@ dependencies = [ # `only-include` + `sources`, not `packages`, and no __init__.py above # deviceio_live_view -- see the packaging rules in examples/README.md. -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/deviceio_live_view"] + +[tool.hatch.build.targets.wheel] sources = ["python"] [tool.uv.sources] diff --git a/examples/haptic_feedback/pyproject.toml b/examples/haptic_feedback/pyproject.toml index d8c5903789..cd532ecc76 100644 --- a/examples/haptic_feedback/pyproject.toml +++ b/examples/haptic_feedback/pyproject.toml @@ -19,6 +19,8 @@ dependencies = [ # `only-include` + `sources`, not `packages`, and no __init__.py above # haptic_feedback -- see the packaging rules in examples/README.md. -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/haptic_feedback"] + +[tool.hatch.build.targets.wheel] sources = ["python"] diff --git a/examples/mcap_record_replay/pyproject.toml b/examples/mcap_record_replay/pyproject.toml index d6bb76e974..89806645f9 100644 --- a/examples/mcap_record_replay/pyproject.toml +++ b/examples/mcap_record_replay/pyproject.toml @@ -25,8 +25,10 @@ dependencies = [ # must stay without an __init__.py. `only-include` + `sources`, not `packages`: # the latter keeps only the last path component and would root the wheel at a # bare top-level `mcap_record_replay/`. -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/mcap_record_replay"] + +[tool.hatch.build.targets.wheel] sources = ["python"] [tool.uv.sources] diff --git a/examples/noitom/pyproject.toml b/examples/noitom/pyproject.toml index 5400dcb080..a678b544ad 100644 --- a/examples/noitom/pyproject.toml +++ b/examples/noitom/pyproject.toml @@ -22,6 +22,8 @@ dependencies = [ # `only-include` + `sources`, not `packages`, and no __init__.py above # noitom -- see the packaging rules in examples/README.md. -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/noitom"] + +[tool.hatch.build.targets.wheel] sources = ["python"] diff --git a/examples/oglo_tactile/pyproject.toml b/examples/oglo_tactile/pyproject.toml index 66df54bb70..fa9226b858 100644 --- a/examples/oglo_tactile/pyproject.toml +++ b/examples/oglo_tactile/pyproject.toml @@ -20,6 +20,8 @@ dependencies = [ # `only-include` + `sources`, not `packages`, and no __init__.py above # oglo_tactile -- see the packaging rules in examples/README.md. -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/oglo_tactile"] + +[tool.hatch.build.targets.wheel] sources = ["python"] diff --git a/examples/oxr/pyproject.toml b/examples/oxr/pyproject.toml index a000590c7a..266122c2bc 100644 --- a/examples/oxr/pyproject.toml +++ b/examples/oxr/pyproject.toml @@ -18,6 +18,8 @@ dependencies = [ # `only-include` + `sources`, not `packages`, and no __init__.py above # oxr -- see the packaging rules in examples/README.md. -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/oxr"] + +[tool.hatch.build.targets.wheel] sources = ["python"] diff --git a/examples/retargeting/pyproject.toml b/examples/retargeting/pyproject.toml index d20a54ad63..e630959e9f 100644 --- a/examples/retargeting/pyproject.toml +++ b/examples/retargeting/pyproject.toml @@ -21,6 +21,8 @@ dependencies = [ # must stay without an __init__.py. `only-include` + `sources`, not `packages`: # the latter keeps only the last path component and would root the wheel at a # bare top-level `retargeting/`. -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/retargeting"] + +[tool.hatch.build.targets.wheel] sources = ["python"] diff --git a/examples/sharpa_avatar/pyproject.toml b/examples/sharpa_avatar/pyproject.toml index 5e4366e18d..e4d7ba5ef4 100644 --- a/examples/sharpa_avatar/pyproject.toml +++ b/examples/sharpa_avatar/pyproject.toml @@ -22,8 +22,10 @@ dependencies = [ # `only-include` + `sources`, not `packages`, and no __init__.py above # sharpa_avatar -- see the packaging rules in examples/README.md. -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/sharpa_avatar"] + +[tool.hatch.build.targets.wheel] sources = ["python"] [tool.uv.sources] diff --git a/examples/soma_body_publisher/pyproject.toml b/examples/soma_body_publisher/pyproject.toml index 30a18ac0d9..d557635a52 100644 --- a/examples/soma_body_publisher/pyproject.toml +++ b/examples/soma_body_publisher/pyproject.toml @@ -16,8 +16,10 @@ dependencies = [ "py-soma-x==0.3.1", ] -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/soma_body_publisher"] + +[tool.hatch.build.targets.wheel] sources = ["python"] [tool.uv.sources] diff --git a/examples/soma_hand_publisher/pyproject.toml b/examples/soma_hand_publisher/pyproject.toml index bcd25a8e39..175071a4f7 100644 --- a/examples/soma_hand_publisher/pyproject.toml +++ b/examples/soma_hand_publisher/pyproject.toml @@ -16,8 +16,10 @@ dependencies = [ "py-soma-x==0.3.1", ] -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/soma_hand_publisher"] + +[tool.hatch.build.targets.wheel] sources = ["python"] [tool.uv.sources] diff --git a/examples/tactile/pyproject.toml b/examples/tactile/pyproject.toml index d9cdeedcab..5815914fbe 100644 --- a/examples/tactile/pyproject.toml +++ b/examples/tactile/pyproject.toml @@ -15,8 +15,10 @@ dependencies = [ "numpy>=1.23.0", ] -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/tactile"] + +[tool.hatch.build.targets.wheel] sources = ["python"] [tool.uv.sources] diff --git a/examples/teleop/pyproject.toml b/examples/teleop/pyproject.toml index df1020cdff..f6bc6163ce 100644 --- a/examples/teleop/pyproject.toml +++ b/examples/teleop/pyproject.toml @@ -27,6 +27,8 @@ ui = ["isaaccapture[ui]"] # # config/ lives inside the package because the bimanual examples resolve it # from __file__, so the YAML and URDF must travel with them. -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/teleop"] + +[tool.hatch.build.targets.wheel] sources = ["python"] diff --git a/examples/teleop_ros2/pyproject.toml b/examples/teleop_ros2/pyproject.toml index ee1a93acbb..dab128e039 100644 --- a/examples/teleop_ros2/pyproject.toml +++ b/examples/teleop_ros2/pyproject.toml @@ -33,6 +33,8 @@ testpaths = ["../../tests/python/examples/teleop_ros2"] # must stay without an __init__.py. `only-include` + `sources`, not `packages`: # the latter keeps only the last path component and would root the wheel at a # bare top-level `teleop_ros2/`. -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/teleop_ros2"] + +[tool.hatch.build.targets.wheel] sources = ["python"] diff --git a/examples/teleop_session_manager/pyproject.toml b/examples/teleop_session_manager/pyproject.toml index 466cf4a909..89a7cae256 100644 --- a/examples/teleop_session_manager/pyproject.toml +++ b/examples/teleop_session_manager/pyproject.toml @@ -21,6 +21,8 @@ dependencies = [ # must stay without an __init__.py. `only-include` + `sources`, not `packages`: # the latter keeps only the last path component and would root the wheel at a # bare top-level `teleop_session_manager/`. -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/teleop_session_manager"] + +[tool.hatch.build.targets.wheel] sources = ["python"] diff --git a/examples/vehicle_teleop/pyproject.toml b/examples/vehicle_teleop/pyproject.toml index f00cb0236f..f45de644eb 100644 --- a/examples/vehicle_teleop/pyproject.toml +++ b/examples/vehicle_teleop/pyproject.toml @@ -29,8 +29,10 @@ dependencies = [ # `only-include` + `sources`, not `packages`, and no __init__.py above # vehicle_teleop -- see the packaging rules in examples/README.md. -[tool.hatch.build.targets.wheel] +[tool.hatch.build] only-include = ["python/isaaccapture_examples/vehicle_teleop"] + +[tool.hatch.build.targets.wheel] sources = ["python"] [[tool.uv.index]] From 22fed6725180a4b27bb21113ad9bccdb3e8a77dc Mon Sep 17 00:00:00 2001 From: Ivan Yang Date: Wed, 28 Oct 2026 15:52:57 -0700 Subject: [PATCH 2/2] examples: note that the sdist omits files read from the example root With only-include shared by both targets, the sdist holds only the package, so files the code resolves from the example root (teleop_ros2 configs/, vehicle_teleop config/) are not in it. Say so in "Adding an example" and point at the source tree and install tree, which carry them. Signed-off-by: Ivan Yang --- examples/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/README.md b/examples/README.md index 3ee484be92..6562ad376d 100644 --- a/examples/README.md +++ b/examples/README.md @@ -94,8 +94,11 @@ the smallest complete one. goes in `[tool.hatch.build]` so the sdist gets it too. Without it the sdist takes the whole example directory: tracked media, stray `.mcap` recordings and, in an example with its own `.gitignore` (hatchling reads only the - nearest one), `uv.lock` and build trees. `sources` stays on the wheel: the - sdist must keep the `python/` prefix that the wheel build looks for. + nearest one), `uv.lock` and build trees. Files the code reads from the + example root, such as teleop_ros2's `configs/`, are therefore not in the + sdist: run such an example from the source tree or the install tree. + `sources` stays on the wheel: the sdist must keep the `python/` prefix that + the wheel build looks for. - Keep `[tool.uv.sources]` last in the file. `install_python_example()` strips it from the installed copy by matching up to the next `[`, so a block after it loses its comments.