3 ms·
The regular CPython installer on Windows installs the py launcher and associates it with .py files. The py launcher supports shebang lines. This was covered in
by sorenjan 2y ago
The regular CPython installer on Windows installs the py launcher and associates it with .py files. The py launcher supports shebang lines.
This was covered in a blog post about this same topic that was posted here a few days ago. According to that you have to omit the -S: https://thisdavej.com/share-python-scripts-like-a-pro-uv-and-pep-723-for-easy-deployment/ https://thisdavej.com/share-python-scripts-like-a-pro-uv-and...
https://news.ycombinator.com/item?id=43500124 https://news.ycombinator.com/item?id=43500124
I haven't tried it myself, I simply changed the file association so all .py files are opened with uv run as standard.
https://docs.python.org/3/using/windows.html#python-launcher-for-windows https://docs.python.org/3/using/windows.html#python-launcher...
https://peps.python.org/pep-0397/ https://peps.python.org/pep-0397/
- dharmab 2y agoInteresting. The workflow I've been using skips the CPython installer and only uses uv.
- sorenjan 2y agoWindows doesn't support shebang lines as you probably know, but if you associate uv with .py files you'll get the same result. I think it should be something like this: ftype Python.File=C:\Path\to\uv.exe run %L %* If you don't use the CPython installer the Python.File file type might not be defined, so you might need to set that with `assoc` first: assoc .py=Python.File