Summary
When no Python interpreter is found on the user's machine, offer to install Python using uv - a fast, cross-platform Python installer and package manager.
Motivation
Users new to Python or setting up a fresh machine often don't have Python installed. Currently, they need to manually install Python before using the extension. We can streamline this experience by leveraging uv to automatically install Python.
Proposed Behavior
Scenario 1: No Python found, no uv found
- Detect that no Python interpreter is available
- Prompt user: "No Python found. Would you like to install Python using uv?"
- If user agrees:
- Install
uv using platform-appropriate method:
- Windows:
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
- macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
- Run
uv python install to install the latest Python version
- Refresh environment detection
Scenario 2: No Python found, uv already installed
- Detect that no Python interpreter is available but
uv is present
- Prompt user: "No Python found. Would you like to install Python using uv?"
- If user agrees:
- Run
uv python install to install the latest Python version
- Refresh environment detection
Benefits of using uv
- Cross-platform: Single consistent approach for Windows, macOS, and Linux
- No bootstrap problem: uv can install Python without requiring Python first
- Fast: Rust-based, significantly faster than traditional installers
- Multiple versions: Users can later install additional Python versions with
uv python install 3.x
- Maintained: Actively developed by Astral (creators of Ruff)
Implementation Considerations
References
Summary
When no Python interpreter is found on the user's machine, offer to install Python using
uv- a fast, cross-platform Python installer and package manager.Motivation
Users new to Python or setting up a fresh machine often don't have Python installed. Currently, they need to manually install Python before using the extension. We can streamline this experience by leveraging
uvto automatically install Python.Proposed Behavior
Scenario 1: No Python found, no uv found
uvusing platform-appropriate method:powershell -c "irm https://astral.sh/uv/install.ps1 | iex"curl -LsSf https://astral.sh/uv/install.sh | shuv python installto install the latest Python versionScenario 2: No Python found, uv already installed
uvis presentuv python installto install the latest Python versionBenefits of using uv
uv python install 3.xImplementation Considerations
uvis already installed (check PATH)References