-
Notifications
You must be signed in to change notification settings - Fork 44
Support uv run as an optional default run action. #1281
Copy link
Copy link
Open
Labels
area-environmentEnvironment, interpreter related issues.Environment, interpreter related issues.feature-requestRequest for new features or functionalityRequest for new features or functionalityhelp wantedIssues identified as good community contribution opportunitiesIssues identified as good community contribution opportunitiesneeds community feedback
Metadata
Metadata
Assignees
Labels
area-environmentEnvironment, interpreter related issues.Environment, interpreter related issues.feature-requestRequest for new features or functionalityRequest for new features or functionalityhelp wantedIssues identified as good community contribution opportunitiesIssues identified as good community contribution opportunitiesneeds community feedback
Type
Fields
Give feedbackNo fields configured for issues without a type.
Currently, the Run Python File in Terminal play button (and the default python debugger) is hardcoded to run the current python file using the activated environment.
For uv scripts with dependencies this causes an issue.
If it were possible to configure this as a setting to run using
uv run ${file}instead, it would allow seamless integration for rust scripts, same for the debugger.I've come from related issues: astral-sh/uv#8558, astral-sh/uv#7803, and astral-sh/ty-vscode#353, but realised it's not possible to implement this feature anywhere other than the vscode-python repo.
Debugging can work with a custom launch.json specifying
uv run --with-requirments ${file} python, but this has the caveat that it will fail for scripts with no inline dependencies defined. Being able to use justuv runas the actual command would allow it to always work. Though my guess is this requires work on debugpy itself to better support uv.