Skip to content

Conversation

nv-rgresia
Copy link

@nv-rgresia nv-rgresia commented Oct 17, 2025

Description

This quality of life upgrade adds the ability to use the configuration classes without needing to load the kit dependencies.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I 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 updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@github-actions github-actions bot added the isaac-lab Related to Isaac Lab team label Oct 17, 2025
@nv-rgresia nv-rgresia self-assigned this Oct 17, 2025
@nv-rgresia nv-rgresia force-pushed the type-checking-cfg-imports branch 3 times, most recently from a37d32c to db7d2cd Compare October 17, 2025 22:04
@nv-rgresia nv-rgresia force-pushed the type-checking-cfg-imports branch from db7d2cd to 7dd771e Compare October 17, 2025 22:06
Copy link
Collaborator

@ooctipus ooctipus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kellyguo11
Copy link
Contributor

@greptileai

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

This PR refactors imports in configuration classes to use Python's TYPE_CHECKING guard pattern, allowing configuration classes to be imported without loading heavyweight Isaac Sim kit dependencies at runtime. The changes move imports like AssetBase, Articulation, RigidObject, RigidObjectCollection, and InteractiveScene into TYPE_CHECKING blocks, making them available only for static type analysis while deferring their runtime loading. The from __future__ import annotations statement enables deferred evaluation of type hints, which is essential for this pattern to work. This optimization improves import performance and enables using configuration classes in contexts where the full simulator isn't needed, such as configuration definition or manipulation without spinning up the simulation environment.

Critical Issue: In action_manager.py line 54, the code uses self._asset: AssetBase as a runtime type annotation, but AssetBase is now only imported in the TYPE_CHECKING block. This will cause a NameError at runtime when this line executes. The annotation should be stringified as self._asset: "AssetBase" or the import strategy needs adjustment to keep AssetBase available at runtime.

Confidence: 2/5 - The core pattern is sound, but the runtime annotation bug in action_manager.py is a blocking issue that will cause failures. Once fixed, this would be a clean optimization. The other files (scene_entity_cfg.py and CONTRIBUTORS.md) appear correct.

Additional Comments (1)

  1. source/isaaclab/isaaclab/managers/action_manager.py, line 54 (link)

    logic: Runtime type annotation without string quotes may cause NameError if AssetBase isn't imported at runtime. Consider using string annotation self._asset: "AssetBase" or importing conditionally.

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

from dataclasses import MISSING
from typing import TYPE_CHECKING

if TYPE_CHECKING:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this logic to the end of the imports?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants