From 603c429f5312fb41943e1e66cb03a532aea1ba3f Mon Sep 17 00:00:00 2001 From: Octi Zhang Date: Wed, 20 Aug 2025 12:28:11 -0700 Subject: [PATCH 1/2] disables internal selection when detect isaaclab installed via pip --- .../overview/developer-guide/template.rst | 6 ++-- tools/template/cli.py | 32 ++++++++++++------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/docs/source/overview/developer-guide/template.rst b/docs/source/overview/developer-guide/template.rst index 7c75d27179e2..30dbdcad65e0 100644 --- a/docs/source/overview/developer-guide/template.rst +++ b/docs/source/overview/developer-guide/template.rst @@ -24,9 +24,9 @@ The template generator enables you to create an: .. warning:: - If you installed Isaac Lab via pip, any task generated by template outside of the pip-installed environment may not - be discovered properly. We are working on better support, but please prefer external projects when using - isaac lab pip installation. + Pip installations of Isaac Lab do not support *Internal* templates. + If ``isaaclab`` is loaded from ``site-packages`` or ``dist-packages``, the *Internal* option is disabled + and the *External* template will be used instead. Running the template generator ------------------------------ diff --git a/tools/template/cli.py b/tools/template/cli.py index f9480b461d84..f24c02bc34d9 100644 --- a/tools/template/cli.py +++ b/tools/template/cli.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: BSD-3-Clause import enum +import importlib import os from collections.abc import Callable @@ -147,18 +148,25 @@ def main() -> None: """Main function to run template generation from CLI.""" cli_handler = CLIHandler() - # project type - is_external_project = ( - cli_handler.input_select( - "Task type:", - choices=["External", "Internal"], - long_instruction=( - "External (recommended): task/project is in its own folder/repo outside the Isaac Lab project.\n" - "Internal: the task is implemented within the Isaac Lab project (in source/isaaclab_tasks)." - ), - ).lower() - == "external" - ) + lab_module = importlib.import_module("isaaclab") + lab_path = os.path.realpath(getattr(lab_module, "__file__", "") or (getattr(lab_module, "__path__", [""])[0])) + is_lab_pip_installed = ("site-packages" in lab_path) or ("dist-packages" in lab_path) + + if not is_lab_pip_installed: + # project type + is_external_project = ( + cli_handler.input_select( + "Task type:", + choices=["External", "Internal"], + long_instruction=( + "External (recommended): task/project is in its own folder/repo outside the Isaac Lab project.\n" + "Internal: the task is implemented within the Isaac Lab project (in source/isaaclab_tasks)." + ), + ).lower() + == "external" + ) + else: + is_external_project = True # project path (if 'external') project_path = None From b11fbba28149862fdadb989766d613188a13dd46 Mon Sep 17 00:00:00 2001 From: Octi Zhang Date: Thu, 21 Aug 2025 23:00:02 -0700 Subject: [PATCH 2/2] pass precommit --- docs/source/overview/developer-guide/template.rst | 4 ++-- tools/template/cli.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/overview/developer-guide/template.rst b/docs/source/overview/developer-guide/template.rst index 30dbdcad65e0..f9d954acdf4f 100644 --- a/docs/source/overview/developer-guide/template.rst +++ b/docs/source/overview/developer-guide/template.rst @@ -24,8 +24,8 @@ The template generator enables you to create an: .. warning:: - Pip installations of Isaac Lab do not support *Internal* templates. - If ``isaaclab`` is loaded from ``site-packages`` or ``dist-packages``, the *Internal* option is disabled + Pip installations of Isaac Lab do not support *Internal* templates. + If ``isaaclab`` is loaded from ``site-packages`` or ``dist-packages``, the *Internal* option is disabled and the *External* template will be used instead. Running the template generator diff --git a/tools/template/cli.py b/tools/template/cli.py index f24c02bc34d9..013519f2a89e 100644 --- a/tools/template/cli.py +++ b/tools/template/cli.py @@ -151,7 +151,7 @@ def main() -> None: lab_module = importlib.import_module("isaaclab") lab_path = os.path.realpath(getattr(lab_module, "__file__", "") or (getattr(lab_module, "__path__", [""])[0])) is_lab_pip_installed = ("site-packages" in lab_path) or ("dist-packages" in lab_path) - + if not is_lab_pip_installed: # project type is_external_project = (