Skip to content

Conversation

@fbeltrao
Copy link
Contributor

Description

Adds uv support to the Windows batch script isaaclab.bat to match the functionality already available in the bash version isaaclab.sh.

All changes are in isaaclab.bat file:

  • Modified extract_python_exe: Added detection for VIRTUAL_ENV environment variable to support uv virtual environments
  • Added extract_pip_command: Detects uv environments and returns appropriate pip command (uv pip install vs python -m pip install)
  • Added extract_pip_uninstall_command: Similar detection logic for uninstall operations
  • Added setup_uv_env: Creates and configures uv environments with Isaac Lab settings
  • Added -u/--uv arguments: Create uv environments with optional name parameter (defaults to "env_isaaclab")

Fixes #3438

Type of change

  • New feature (non-breaking change which adds functionality)

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

Signed-off-by: Francisco Beltrao <[email protected]>
Signed-off-by: Francisco Beltrao <[email protected]>
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 12, 2025

Greptile Overview

Greptile Summary

This PR successfully adds UV package manager support to the Windows batch script (isaaclab.bat), bringing feature parity with the existing bash implementation (isaaclab.sh).

Key Changes:

  • Added extract_pip_command and extract_pip_uninstall_command functions that detect UV environments by checking VIRTUAL_ENV and pyvenv.cfg
  • Added setup_uv_env function that creates UV virtual environments and configures activation scripts with Isaac Lab and Isaac Sim environment variables
  • Modified extract_python_exe to detect UV environments via VIRTUAL_ENV variable
  • Added -u/--uv command-line arguments to create UV environments with optional custom names
  • Updated all pip install/uninstall calls throughout the script to use the detected pip command (either uv pip or python -m pip)
  • Updated help text and error messages to reference UV alongside Conda

Implementation Quality:
The implementation closely follows the bash version's logic while adapting appropriately for Windows batch scripting (e.g., using Scripts\activate.bat instead of bin/activate, doskey for aliases, proper Windows path separators). The code correctly handles UV environment detection, environment creation, and activation script configuration.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - it adds new functionality without modifying existing workflows
  • Score of 4 reflects well-structured implementation that mirrors the tested bash version, with proper error handling and environment detection logic. Minor deduction because: (1) the bash version has an unused python_path parameter in setup_uv_env that suggests the feature may be incomplete in both scripts, and (2) Windows batch testing is harder to automate, so manual testing verification is important
  • No files require special attention - isaaclab.bat changes are additive and well-isolated

Important Files Changed

File Analysis

Filename Score Overview
CONTRIBUTORS.md 5/5 Added author name to contributors list - straightforward alphabetically-ordered addition
isaaclab.bat 4/5 Added UV environment support with pip detection, environment creation, and activation script configuration - mirrors bash functionality with Windows-specific adaptations

Sequence Diagram

sequenceDiagram
    participant User
    participant isaaclab.bat
    participant UV
    participant Python

    User->>isaaclab.bat: Execute with -u/--uv flag
    isaaclab.bat->>isaaclab.bat: Check if UV installed
    alt UV not found
        isaaclab.bat-->>User: Error: UV not installed
    end
    
    isaaclab.bat->>isaaclab.bat: Check _isaac_sim symlink
    alt Missing symlink & no pip install
        isaaclab.bat-->>User: Warning message
    end
    
    isaaclab.bat->>UV: Create environment (uv venv --clear)
    UV-->>isaaclab.bat: Environment created
    
    isaaclab.bat->>isaaclab.bat: Verify activate.bat exists
    alt Activation script missing
        isaaclab.bat-->>User: Error: Failed to create activation script
    end
    
    isaaclab.bat->>isaaclab.bat: Append ISAACLAB_PATH to activate.bat
    isaaclab.bat->>isaaclab.bat: Append doskey alias to activate.bat
    isaaclab.bat->>isaaclab.bat: Append RESOURCE_NAME to activate.bat
    
    isaaclab.bat->>isaaclab.bat: Call extract_isaacsim_path
    alt Isaac Sim path exists
        isaaclab.bat->>isaaclab.bat: Append Isaac Sim env vars to activate.bat
    end
    
    isaaclab.bat-->>User: Success message with activation instructions
    
    Note over User,Python: When installing packages
    User->>isaaclab.bat: Execute with -i flag
    isaaclab.bat->>isaaclab.bat: Call extract_pip_command
    
    alt UV environment detected
        isaaclab.bat->>isaaclab.bat: Check VIRTUAL_ENV/pyvenv.cfg for "uv"
        isaaclab.bat->>UV: Use "uv pip install"
    else Standard environment
        isaaclab.bat->>Python: Use "python -m pip install"
    end
Loading

Copy link
Contributor

@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.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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

Labels

enhancement New feature or request infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] Add UV support for Windows

1 participant