Repository navigation
[Core] Refactor and cleanup core subpackage for 3.0 [1/N] - #7958
Conversation
|
| @functools.wraps(func) | ||
| def wrapper(prim_path: str | Sdf.Path, cfg: SpawnerCfg, *args, **kwargs): | ||
| from pxr import Sdf, UsdGeom # noqa: PLC0415 | ||
| from pxr import Sdf # noqa: PLC0415 |
There was a problem hiding this comment.
The wrapper now imports only Sdf, but it still calls UsdGeom.Imageable(prim). Because every SpawnerCfg defines visible, normal decorated spawns reach this branch and raise NameError after creating the source prim, preventing the asset from spawning.
| from pxr import Sdf # noqa: PLC0415 | |
| from pxr import Sdf, UsdGeom # noqa: PLC0415 |
| import argparse | ||
| import contextlib | ||
| import math | ||
| import os | ||
| import random | ||
| import sys | ||
| import time | ||
| from datetime import datetime | ||
| from typing import TYPE_CHECKING, Any |
There was a problem hiding this comment.
Hoisting these standard-library imports to module scope moves their cold-import work before run() records imports_t0. The dispatcher loads each backend module before invoking run(), and modules such as math, random, and importlib.metadata are not guaranteed to be preloaded. As a result, StartupTime.python_imports excludes work it previously measured and can vary with module-cache state. The same issue affects the changed RL-Games, RSL-RL, SB3, and SKRL benchmark entrypoints.
Knowledge Base Used: Learning workflows
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
|
||
| * :attr:`pose_range` - a dictionary of pose ranges for each axis. The keys of the dictionary are ``roll``, | ||
| ``pitch``, and ``yaw``. The position is sampled from the flat patches of the terrain. | ||
| import omni.replicator.core as rep # noqa: PLC0415 |
There was a problem hiding this comment.
Import Text Corrupts Documentation
This line is inside the function's docstring rather than executable code. It will appear as part of the pose_range description in help() and generated API documentation, misleading users with an unrelated Replicator import.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Isaac Lab Review Bot
The import refactor generally preserves module resolution and runtime behavior across the affected subpackages. One concrete documentation defect remains: a stray import statement was inserted into the public reset_root_state_from_terrain docstring and should be removed before merge.
- Design and architecture: The relative-import depth across the changed
envs/mdp,sim/spawners,sim/utils,benchmark, andutilsmodules resolves to the same package targets. No architectural issue is established by the import rewrites. - API: No public symbol or signature change is evident. However, the added line in
reset_root_state_from_terraincorrupts that public event term's rendered API documentation and may trigger a Sphinx warning because it appears as an incorrectly indented docstring line. - Implementation: The hoisted standard-library imports are side-effect free, while heavyweight RL dependencies remain deferred inside entrypoints. Remove the stray
import omni.replicator.core as reptext from thereset_root_state_from_terraindocstring; it has no runtime purpose there.
Minor fixes needed. Posted 1 actionable finding inline.
Automated review; human maintainers own approval decisions.
|
|
||
| * :attr:`pose_range` - a dictionary of pose ranges for each axis. The keys of the dictionary are ``roll``, | ||
| ``pitch``, and ``yaw``. The position is sampled from the flat patches of the terrain. | ||
| import omni.replicator.core as rep # noqa: PLC0415 |
There was a problem hiding this comment.
🟡 Warning · Implementation — Stray code line inserted into public docstring
An import omni.replicator.core as rep # noqa: PLC0415 line was inserted into the reset_root_state_from_terrain docstring, between the pose_range and velocity_range bullets and indented deeper than the list continuation. It has no runtime effect but corrupts the rendered API documentation for a public event term and risks a Sphinx indentation warning in a -W docs build. Remove the line.
|
run-ci |
ooctipus
left a comment
There was a problem hiding this comment.
maybe should update this rule to agent.md as well
|
run-ci |
|
run-ci |
|
Backported to |
# Description First PR in a series that splits the core cleanup in #7949 into small, reviewable pieces. This PR only changes how imports are written in `source/isaaclab/isaaclab` and adds the import rules to `AGENTS.md`; there is no logic change. **Import rules (new `## Code style` section in `AGENTS.md`)** - Imports are grouped in PEP 8 order: `__future__`, standard library, third-party, Omniverse runtime packages, Isaac Lab packages, then local relative imports. The existing ruff isort config already enforces this. - Imports from the same package are relative when the target is at most three leading dots away (e.g. `from ...utils import math as math_utils`), and absolute for deeper targets and other packages. - Modules with an `if __name__ == "__main__":` block keep absolute imports, because some are executed by file path (e.g. `benchmark/entrypoints/multigpu.py` launches itself as the worker script), where relative imports fail. **Changes in the core package** - Applied the rule above across the package with an AST-based rewrite: 725 imports converted (686 `from isaaclab.x import ...`, 39 `import isaaclab.x.y as z` -> `from ...x import y as z`), then re-sorted with ruff. 103 imports that would need more than three dots stay absolute. - No imports are added, removed, or moved between scopes. - `test/sensors/test_ray_caster_kernels.py` loaded `utils/warp/kernels.py` by file path, which cannot resolve relative imports. It now imports the kernels as regular package modules; they import without Kit. Verification: - Every file's AST is identical to `develop` once relative imports are resolved to absolute names (520 files). - Importing every module under `isaaclab` gives the same result as on `develop`, both in one process and with each of the 203 top-level modules in a fresh process (checks for import-order-dependent cycles). - `isaaclab train --rl_library rsl_rl --task Isaac-Cartpole-Direct --num_envs 16 presets=newton_mjwarp --max_iterations 5` completes. - `pytest source/isaaclab/test/benchmark source/isaaclab/test/cli source/isaaclab/test/app/test_app_launcher_argv.py`: 661 passed. - `ruff check` (including isort) / `ruff format` are clean. ## Type of change - Code cleanup (non-breaking, no functional change) ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (`.skip`) - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` (cherry picked from commit cff81e8)
…ng docs (#7957) Backports the three changes from the September 20–23 `develop` audit that are missing from `release/3.0.0`, alongside the existing cloning-guide backport: - #7722 (`4cf439dfeb`): reject a second `SimulationContext` construction instead of silently discarding its configuration. Includes the original fixture cleanup and regression coverage. - #7893 (`22fcd71bc4`): validate DelayBuffer lag values before mutating its live configuration. - #7947 (`6e9ef17f59`): make `v3.0.0-EA` the default documentation version in deployment and local multi-version builds. - #7129 (`354168560f`): clarify that `replicate_physics=False` skips the active physics context while other declared replication contexts still run. **Compatibility:** repeated `SimulationContext(...)` calls now raise. Retrieve the live context with `SimulationContext.instance()`, or call `clear_instance()` before constructing a replacement. The original major changelog fragment includes this migration. The runtime and test files match current `develop`. The docs-default backport adapts the release branch's existing redirect template, validates the target page, and preserves explicit overrides. The cloning-guide backport preserves the current release APIs; its obsolete sections were already removed. ## Release audit Checked all **35 PRs** merged into `develop` from **2026-09-20 16:43:18 UTC** through `cff81e8473` (September 23), against release head `5d3e0b695e`. **32 are already covered; the remaining three are included here.** Git history, patch equivalence, GitHub's merged PR list, and remaining file differences were checked. Branch-specific version/changelog compilation and existing release-only changes are preserved. <details> <summary>Already covered PRs</summary> 26 have an equivalent patch in release: #7919, #7922, #7923, #7924, #7925, #6758, #7928, #7902, #7927, #7891, #7931, #7691, #7861, #7929, #7916, #7939, #4609, #7942, #7940, #7948, #7937, #7955, #7960, #7961, #7970, #7958. Six were squash-merged or adapted: #7530 and #7899 in #7926; #7637 in #7933; #7860 in #7936; #7954 and #7950 in #7964. Their implementation differences were checked against the current release tree. </details> ## Validation - **276 tests passed**: SimulationContext (51, including CPU/CUDA), headless context construction (15), nine schema/fragment suites (165), four manager suites (38), and DelayBuffer (7). - Both backported regressions reproduce with the original release implementations. - Docs redirect recipe: local/deployment EA defaults, explicit override, and missing-target rejection passed with a stubbed Sphinx builder. - All 22 changed files match the intended backport scope; `uv run isaaclab -f` and `git diff --check` passed. - Fresh Sphinx validation (`-b dummy -W --keep-going`): passed without warnings, excluding static assets as the HTML builder does. Full HTML documentation CI is running. Local runtime validation used PyTorch 2.12.0, CUDA 13.0, Isaac Sim 6.0.1.0, and an RTX 5090. Existing runtime/deprecation warnings occurred; the CI jobs validate the pinned environments. The previous [docs CI failure](https://github.com/isaac-sim/IsaacLab/actions/runs/35795116307/job/106972539281) was an external connection reset fetching the Omniverse intersphinx inventory, producing one warning under `-W`. That URL returned HTTP 200 when rechecked. This update starts a fresh docs build. --------- Co-authored-by: hujc <[email protected]> Co-authored-by: Zihan Xu <[email protected]>
Description
First PR in a series that splits the core cleanup in #7949 into small, reviewable pieces. This PR only changes how imports are written in
source/isaaclab/isaaclaband adds the import rules toAGENTS.md; there is no logic change.Import rules (new
## Code stylesection inAGENTS.md)__future__, standard library, third-party, Omniverse runtime packages, Isaac Lab packages, then local relative imports. The existing ruff isort config already enforces this.from ...utils import math as math_utils), and absolute for deeper targets and other packages.if __name__ == "__main__":block keep absolute imports, because some are executed by file path (e.g.benchmark/entrypoints/multigpu.pylaunches itself as the worker script), where relative imports fail.Changes in the core package
from isaaclab.x import ..., 39import isaaclab.x.y as z->from ...x import y as z), then re-sorted with ruff. 103 imports that would need more than three dots stay absolute.test/sensors/test_ray_caster_kernels.pyloadedutils/warp/kernels.pyby file path, which cannot resolve relative imports. It now imports the kernels as regular package modules; they import without Kit.Verification:
developonce relative imports are resolved to absolute names (520 files).isaaclabgives the same result as ondevelop, both in one process and with each of the 203 top-level modules in a fresh process (checks for import-order-dependent cycles).isaaclab train --rl_library rsl_rl --task Isaac-Cartpole-Direct --num_envs 16 presets=newton_mjwarp --max_iterations 5completes.pytest source/isaaclab/test/benchmark source/isaaclab/test/cli source/isaaclab/test/app/test_app_launcher_argv.py: 661 passed.ruff check(including isort) /ruff formatare clean.Type of change
Checklist
I have read and understood the contribution guidelines
I have run the
pre-commitchecks with./isaaclab.sh --formatI have made corresponding changes to the documentation
My changes generate no new warnings
I have added tests that prove my fix is effective or that my feature works
I have added a changelog fragment under
source/<pkg>/changelog.d/for every touched package (.skip)I have added my name to the
CONTRIBUTORS.mdor my name already exists thereBackport this pull request to the active release branch after it merges into
develop