Note
This extension is not associated with astral!
Automatically select the Python interpreter path given by uv based on the current file. This will execute one of the following commands and set its output as the current interpreter:
uv python find --script $scriptnameif a PEP 723 compatible script-tag is found (within the first 50 lines). Note that this only works if the environment has been already created (by runninguv run $scriptnameat least once)uv python findotherwise
Per default, this will happen every time a different file is activated. This behaviour can be changed over the toggle in the status bar. Additionally, there is a command to manually trigger setting the interpreter.
uvscode requires uv to be installed and in the path.
uvscode adds the following commands:
uvscode.toggleTrackingActiveFile: Toggles whether to automatically select the interpreter based on the current file when changing filesuvscode.setInterpreter: Sets the interpreter for the currently active fileuvscode.run: Runs the current file with uv
This extension contributes the following settings:
uvscode.autoSetInterpreter: Automatically set the interpreter when switching files
- The environment must have been created by calling
uv run $scriptnamefirst - If no workspace is opened, the public API of the Python extension does not allow changing the interpreter
Initial release of uvscode