Support PEP 723 when detecting python interpreter & virtualenv #24916
Labels
feature-request
Request for new features or functionality
needs proposal
Need to make some design decisions
https://peps.python.org/pep-0723/
Python has adopted a format for putting dependencies into a script header and python tooling has implemented ways to run it!
here is an example of uv being used to run a script. It will parse the
/// script
header, use the specified version of python, create a virtual environment, install dependencies, and then execute the script.right now vscode-python doesn't really know how to handle several aspects of this.
first is language detection. scripts often don't have a file extension so it would be nice to detect
uv
orpipx
in the shabang line to mean "probably python". you could also do more advanced parsing of the entire/// script
block.next is code intelligence, without
pythonInterpreter
detection there are red squiggles everywhere. when run scripts get their own venv created in a temp location, unfortunately this behavior is tool specific. maybe vscode could create/manage its own!thanks!
The text was updated successfully, but these errors were encountered: