Commit 2741e42
authored
* feat(isaac): [isaac] extras + entry-point + PEP 562 lazy import (1/5 of #31 split)
Part 1 / 5 of the split of #31 — tracked by #42.
Adds the package skeleton for the Isaac Sim backend with zero `omni`
overhead on `import strands_robots_sim`:
- `pyproject.toml`:
- new `[isaac]` extra (lightweight Isaac-companion deps that ARE
pip-installable: `usd-core>=24.5,<26.0`, `warp-lang>=1.13.0`).
Comment explains that Isaac Sim itself is NOT installable from
PyPI — must come via Omniverse Launcher / Isaac Lab / nvcr.io.
- new `[all]` aggregate extra (currently delegates to `[isaac]`;
will gain `[newton]` etc. as later backends land).
- new `[project.entry-points."strands_robots.backends"]` declaring
both `isaac` and `isaac_sim` aliases pointing at
`strands_robots_sim.isaac.simulation:IsaacSimulation` (the class
itself lands in PR-4 / `feat(isaac): IsaacSimulation backend`).
- new `pytest>=7.0` in `dev` extras and `[tool.hatch.envs.default]`
deps so future PRs in this split chain can run pytest under
`hatch run test`.
- new `[tool.pytest.ini_options]` with a `gpu` marker so PR-4's
GPU-only integ tests can gate on `STRANDS_GPU_TEST=1`.
- `strands_robots_sim/isaac/__init__.py`:
PEP 562 lazy stub — declares `__all__ = ["IsaacSimulation",
"IsaacConfig"]` and routes attribute access through `__getattr__`
to deferred imports of `.simulation` and `.config`. The bare
`import strands_robots_sim.isaac` does NOT import any `omni`
modules; that overhead only fires when a caller actually accesses
`IsaacSimulation` or `IsaacConfig`.
- `strands_robots_sim/isaac/tests/__init__.py`: empty package marker
so future test files in this directory are collectable. Test files
themselves land in subsequent slices alongside the code they cover.
CI signal: lint clean (black / isort / flake8); the existing
`hatch run test` import-smoke passes (it doesn't touch `isaac`, so
no missing-submodule errors). Pytest doesn't run yet from `hatch
run test` — the test command stays as the import-smoke placeholder
in this slice and flips to `pytest strands_robots_sim/isaac/tests/`
in PR-3 once the first real test files land.
Why this lands first: PR-2 / PR-3 / PR-4 all import from
`strands_robots_sim.isaac`, so the package stub + extras + entry
points have to exist before any of those files can be code-reviewed
against current `main`.
Original work by @cagataycali in #31 (`413ff15..befb1e3`); this
slice cherry-picks just the foundation files. Review-thread anchors
on the original commits stay intact for whichever child PR consumes
the relevant code.
* review(isaac): port 10 entry-point + lazy-import tests from #43 (PR #44 R1)
Closes @cagataycali's R1 review on #44 -- the lazy-import contract
ships with concrete CI signal now, not just a manual probe in the PR
description.
Three coordinated changes per the review:
1. **Port `tests/test_entrypoint.py` (140 LOC, 10 tests)** from the
closed orphan PR #43 (`feat/isaac-extras-and-lazy-import`). These
tests verify *only* PR-1's surface and have **zero dependency on
`simulation.py`** (which lands in PR-4 of the #31 split):
- `TestEntryPointDeclaration` (6 tests):
- `test_pyproject_exists`
- `test_isaac_entry_point_declared_in_pyproject`
- `test_isaac_sim_alias_entry_point_declared_in_pyproject`
- `test_isaac_extra_declared_in_pyproject`
- `test_isaac_extra_includes_pytest`
- `test_entry_points_visible_via_importlib_metadata_when_installed`
(skips with actionable hint when not pip-installed)
- `TestLazyImportSurface` (4 tests):
- `test_import_isaac_does_not_load_omni` -- pins the `omni`-not-
loaded contract via `sys.modules` set diff before/after
import.
- `test_isaac_subpackage_exposes_lazy_attrs_in___all__`
- `test_unknown_attr_raises_attributeerror` -- pins the PEP 562
`__getattr__` raises `AttributeError` (not `ImportError`) on
unknown attrs.
- `test_dunder_getattr_is_present`
2. **Add `pytest>=7.0` to the `[isaac]` extra** in `pyproject.toml`.
Means `pip install '.[isaac]'` covers the test deps without a
separate dev extra on CI hosts. Also pinned by
`test_isaac_extra_includes_pytest`.
3. **Flip `hatch run test`** from the import-smoke placeholder
(`python -c "import strands_robots_sim; ..."`) to
`pytest strands_robots_sim/isaac/tests/ -v`. The 10 tests collect
and pass standalone; PR-4's simulation-module tests join the
collection automatically when that PR rebases.
Verification:
- `pytest strands_robots_sim/isaac/tests/ -v` -> **10 passed in 0.14s**
- `black --check` / `isort --check-only` / `flake8` (max-line=120) on
`strands_robots_sim/` + `examples/` -> clean
- AST parse on touched files -> ok
- The 10 tests have no import path through `simulation.py`; they
validate only PR-1's actual surface (pyproject parsing, entry-
point declaration, PEP 562 `__getattr__` contract).
The original `test_entrypoint.py` on `cagataycali/feat/isaac-sim`
imports from `strands_robots_sim.isaac.simulation`, which is why
PR-1 of the split couldn't ship that file unmodified. The version
ported here was rewritten on the #43 branch specifically for the
PR-1 surface; cleanly self-contained against this slice.
1 parent 4d82bcf commit 2741e42
4 files changed
Lines changed: 215 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
44 | 56 | | |
45 | 57 | | |
46 | 58 | | |
47 | 59 | | |
48 | 60 | | |
49 | 61 | | |
50 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
51 | 70 | | |
52 | 71 | | |
53 | 72 | | |
| |||
68 | 87 | | |
69 | 88 | | |
70 | 89 | | |
| 90 | + | |
71 | 91 | | |
72 | 92 | | |
73 | 93 | | |
74 | | - | |
75 | | - | |
76 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
77 | 100 | | |
78 | 101 | | |
79 | 102 | | |
| |||
96 | 119 | | |
97 | 120 | | |
98 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
0 commit comments