diff --git a/docs/source/setup/installation/include/src_clone_isaaclab.rst b/docs/source/setup/installation/include/src_clone_isaaclab.rst index 844cac2f3fd..fbefad0e31e 100644 --- a/docs/source/setup/installation/include/src_clone_isaaclab.rst +++ b/docs/source/setup/installation/include/src_clone_isaaclab.rst @@ -53,7 +53,7 @@ respectively that provides utilities to manage extensions. -d, --docs Build the documentation from source using sphinx. -n, --new Create a new external project or internal task from template. -c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'. - -u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'. + -u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'. Use delimiter -- to pass additional arg to uv. .. tab-item:: :icon:`fa-brands fa-windows` Windows :sync: windows @@ -75,4 +75,3 @@ respectively that provides utilities to manage extensions. -d, --docs Build the documentation from source using sphinx. -n, --new Create a new external project or internal task from template. -c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'. - -u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'. diff --git a/docs/source/setup/installation/include/src_python_virtual_env.rst b/docs/source/setup/installation/include/src_python_virtual_env.rst index 7757e40ca31..306cc2359f0 100644 --- a/docs/source/setup/installation/include/src_python_virtual_env.rst +++ b/docs/source/setup/installation/include/src_python_virtual_env.rst @@ -50,8 +50,11 @@ instead of *./isaaclab.sh -p* or *isaaclab.bat -p*. # Option 1: Default environment name 'env_isaaclab' ./isaaclab.sh --uv # or "./isaaclab.sh -u" - # Option 2: Custom name + # Option 2: Custom environment name ./isaaclab.sh --uv my_env # or "./isaaclab.sh -u my_env" + # Option 3: Custom environment name with additional args to uv + # the following command set the path to python interpreter and use verbose output + ./isaaclab.sh --uv my_env -- --python ${HOME}/isaacsim50/kit/python/bin/python3 --verbose .. code:: bash diff --git a/isaaclab.sh b/isaaclab.sh index 34a3035a124..9519c614512 100755 --- a/isaaclab.sh +++ b/isaaclab.sh @@ -406,9 +406,9 @@ setup_conda_env() { # setup uv environment for Isaac Lab setup_uv_env() { - # get environment name from input local env_name="$1" - local python_path="$2" + shift 1 + local extra_uv_args=("$@") # check uv is installed if ! command -v uv &>/dev/null; then @@ -429,7 +429,18 @@ setup_uv_env() { local env_path="${ISAACLAB_PATH}/${env_name}" if [ ! -d "${env_path}" ]; then echo -e "[INFO] Creating uv environment named '${env_name}'..." - uv venv --clear --python "${python_path}" "${env_path}" + # make the command + declare -a uv_cmd=("uv" "venv") + uv_cmd+=("$env_path") + uv_cmd+=("${extra_uv_args[@]}") + # print the command + printf '[INFO] Executing:' + for arg in "${uv_cmd[@]}"; do + printf ' %q' "$arg" + done + echo + # run the command + "${uv_cmd[@]}" else echo "[INFO] uv environment '${env_name}' already exists." fi @@ -496,7 +507,7 @@ print_help () { echo -e "\t-d, --docs Build the documentation from source using sphinx." echo -e "\t-n, --new Create a new external project or internal task from template." echo -e "\t-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'." - echo -e "\t-u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'." + echo -e "\t-u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'. Use delimiter -- to pass additional arg to uv." echo -e "\n" >&2 } @@ -590,18 +601,32 @@ while [[ $# -gt 0 ]]; do shift # past argument ;; -u|--uv) - # use default name if not provided - if [ -z "$2" ]; then - echo "[INFO] Using default uv environment name: env_isaaclab" - uv_env_name="env_isaaclab" - else - echo "[INFO] Using uv environment name: $2" - uv_env_name=$2 - shift # past argument + shift + uv_env_name="env_isaaclab" + extra_args=() + + # look for delimiter -- + while [[ $# -gt 0 ]]; do + case "$1" in + --) shift; extra_args=("$@"); break ;; # everything after -- goes to uv + -*) + echo "[Error] Unknown option for --uv: $1" + exit 1 + ;; + *) + uv_env_name="$1" + shift + ;; + esac + done + + echo "[INFO] Using env name: ${uv_env_name}" + if [[ ${#extra_args[@]} -gt 0 ]]; then + echo "[INFO] Forwarding extra uv args: ${extra_args[*]}" fi - # setup the uv environment for Isaac Lab - setup_uv_env ${uv_env_name} - shift # past argument + + setup_uv_env "${uv_env_name}" "${extra_args[@]}" + break ;; -f|--format) # reset the python path to avoid conflicts with pre-commit