Skip to content

Commit eef3144

Browse files
committed
Preserve aggregate wheel compatibility APIs
1 parent 684f4dc commit eef3144

12 files changed

Lines changed: 63 additions & 11 deletions

File tree

source/isaaclab/isaaclab/__init__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,25 @@ def _expose_mujoco_usd_schemas():
131131
__version__ = importlib.metadata.version("isaaclab")
132132
except importlib.metadata.PackageNotFoundError:
133133
__version__ = "0.0.0"
134+
135+
136+
# TODO(myurasov-nv): bootstrap_kernel() is ported from the internal GitLab wheel builder
137+
# for backwards compatibility. It is not called currently, but may be needed if Isaac Sim
138+
# requires explicit kernel bootstrapping before use. Remove once confirmed unnecessary.
139+
def bootstrap_kernel():
140+
"""Import Isaac Sim so it can initialize its kernel when available."""
141+
isaaclab_path = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
142+
if importlib.util.find_spec("isaacsim") is not None:
143+
import isaacsim # noqa: F401
144+
145+
if importlib.util.find_spec("carb") is not None:
146+
import carb
147+
148+
carb.log_info(f"Isaac Lab path: {isaaclab_path}")
149+
150+
151+
def main():
152+
"""Run the ``isaaclab`` command through its compatibility dispatcher."""
153+
from isaaclab.__main__ import main as _main
154+
155+
sys.exit(_main())
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
import tomllib
1313

14+
from isaaclab.paths import ISAACLAB_ROOT
15+
1416
VSCODE_SETTINGS_TEMPLATE = """
1517
{
1618
"editor.rulers": [120],
@@ -115,7 +117,7 @@ def _get_paths(base_path: str, mock_python_modules: bool = False) -> list[str]:
115117
for folder in ["exts", "extscache", "extsDeprecated", "extsUser"]:
116118
extensions_paths.extend(_get_paths(os.path.join(isaacsim_path, folder), mock_python_modules=True))
117119
# - isaaclab
118-
isaaclab_path = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
120+
isaaclab_path = str(ISAACLAB_ROOT)
119121
for folder in ["source"]:
120122
extensions_paths.extend(_get_paths(os.path.join(isaaclab_path, folder), mock_python_modules=True))
121123

source/isaaclab/isaaclab/app/app_launcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333

3434
SimulationApp = getattr(isaacsim, "SimulationApp", None)
3535

36-
from isaaclab._paths import ISAACLAB_ROOT
3736
from isaaclab.app.loading_screen import report_activity
3837
from isaaclab.app.logging_utils import apply_python_logging_level, resolve_python_logging_level
3938
from isaaclab.app.settings_manager import get_settings_manager, initialize_carb_settings
39+
from isaaclab.paths import ISAACLAB_ROOT
4040
from isaaclab.utils._device import set_cuda_device
4141
from isaaclab.utils.renderers import ISAAC_RTX_SHOW_ALL_PARTITIONS_BY_DEFAULT_SETTING
4242

source/isaaclab/isaaclab/benchmark/microbenchmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from pathlib import Path
1414
from types import MappingProxyType
1515

16-
from isaaclab._paths import ISAACLAB_ROOT
1716
from isaaclab.cli.utils import run_python_command
17+
from isaaclab.paths import ISAACLAB_ROOT
1818

1919

2020
@dataclass(frozen=True)

source/isaaclab/isaaclab/benchmark/recorders/record_version_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import subprocess
99
import sys
1010

11-
from isaaclab._paths import ISAACLAB_ROOT
1211
from isaaclab.benchmark.interfaces import MeasurementData, MeasurementDataRecorder
1312
from isaaclab.benchmark.measurements import DictMetadata, StringMetadata
13+
from isaaclab.paths import ISAACLAB_ROOT
1414

1515
# Path to the source checkout or installed wheel resources.
1616
_REPO_ROOT = str(ISAACLAB_ROOT)

source/isaaclab/isaaclab/cli/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from pathlib import Path
1414
from typing import IO, Any
1515

16-
from isaaclab._paths import ISAACLAB_ROOT
16+
from isaaclab.paths import ISAACLAB_ROOT
1717

1818
# Default path to look for Isaac Sim is _isaac_sim symlink.
1919
DEFAULT_ISAAC_SIM_PATH = ISAACLAB_ROOT / "_isaac_sim"

source/isaaclab/isaaclab/utils/assets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
from filelock import FileLock
3131

32-
from isaaclab._paths import ISAACLAB_ROOT
32+
from isaaclab.paths import ISAACLAB_ROOT
3333

3434
logger = logging.getLogger(__name__)
3535

source/isaaclab/test/cli/test_installed_workflow_entrypoints.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212

1313
import pytest
1414

15-
import isaaclab._paths as paths
15+
import isaaclab
16+
import isaaclab.__main__ as package_main
1617
import isaaclab.cli as cli
18+
import isaaclab.paths as paths
1719

1820
pytestmark = pytest.mark.unit
1921

@@ -23,10 +25,30 @@ def test_resolves_partial_source_checkout_root(tmp_path):
2325
package_root = tmp_path / "source" / "isaaclab" / "isaaclab"
2426
package_root.mkdir(parents=True)
2527

26-
with mock.patch.object(paths, "__file__", str(package_root / "_paths.py")):
28+
with mock.patch.object(paths, "__file__", str(package_root / "paths.py")):
2729
assert paths._resolve_isaaclab_root() == tmp_path
2830

2931

32+
def test_top_level_compatibility_api_is_preserved():
33+
"""The flattened package must retain the aggregate wheel's public shims."""
34+
assert callable(isaaclab.bootstrap_kernel)
35+
with mock.patch.object(package_main, "main", return_value=0) as main, pytest.raises(SystemExit, match="0"):
36+
isaaclab.main()
37+
38+
main.assert_called_once_with()
39+
40+
41+
def test_legacy_vscode_option_uses_compatibility_dispatcher():
42+
"""The installed entry point must continue to recognize the legacy VS Code option."""
43+
with (
44+
mock.patch.object(sys, "argv", ["isaaclab", "--generate-vscode-settings"]),
45+
mock.patch.object(package_main, "generate_vscode_settings") as generate,
46+
):
47+
package_main.main()
48+
49+
generate.assert_called_once_with()
50+
51+
3052
@pytest.mark.parametrize(
3153
("command", "runner"),
3254
[

source/isaaclab/test/cli/test_wheel_builder_metadata.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test_wheel_builder_drops_workspace_members(tmp_path):
8181

8282
def test_wheel_console_delegates_to_the_full_isaaclab_cli():
8383
"""The wheel console command must expose the same workflows as a source installation."""
84-
module_path = _repo_root() / "tools" / "wheel_builder" / "res" / "__main__.py"
84+
module_path = _repo_root() / "source" / "isaaclab" / "isaaclab" / "__main__.py"
8585
spec = util.spec_from_file_location("_isaaclab_wheel_main", module_path)
8686
assert spec is not None
8787
assert spec.loader is not None
@@ -94,6 +94,13 @@ def test_wheel_console_delegates_to_the_full_isaaclab_cli():
9494
cli.assert_called_once_with()
9595

9696

97+
def test_wheel_console_uses_compatibility_dispatcher(tmp_path):
98+
"""The generated console script must preserve legacy installed-wheel options."""
99+
generated = _generate_wheel_pyproject(tmp_path)
100+
101+
assert generated["project"]["scripts"]["isaaclab"] == "isaaclab.__main__:main"
102+
103+
97104
def test_wheel_builder_includes_isaacsim_extra(tmp_path):
98105
"""The ``isaacsim`` extra must ship in the generated wheel metadata."""
99106
generated = _generate_wheel_pyproject(tmp_path)

0 commit comments

Comments
 (0)