Unverified Commit 3ca87e98 authored by ooctipus's avatar ooctipus Committed by GitHub

Disables generate internal template when detecting isaaclab install via pip (#3225)

# Description

If Isaac Lab is installed through pip, tasks generated with the Internal
template cannot be placed inside the site-packages directory of that
installation. Since this setup would never work correctly, it makes no
sense to offer the Internal template as an option. This PR therefore
disables that option entirely whenever Isaac Lab is detected as running
from a pip-installed path.



Fixes # (issue)



## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

- Bug fix (non-breaking change which fixes an issue)
- This change requires a documentation update

<!--
Example:

| Before | After |
| ------ | ----- |
| _gif/png before_ | _gif/png after_ |

To upload images to a PR -- simply drag and drop an image while in edit
mode and it should upload the image directly. You can then paste that
source into the above before/after sections.
-->

## Checklist

- [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
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->
parent be083bf1
......@@ -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
------------------------------
......
......@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD-3-Clause
import enum
import importlib
import os
from collections.abc import Callable
......@@ -147,6 +148,11 @@ def main() -> None:
"""Main function to run template generation from CLI."""
cli_handler = CLIHandler()
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(
......@@ -159,6 +165,8 @@ def main() -> None:
).lower()
== "external"
)
else:
is_external_project = True
# project path (if 'external')
project_path = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment