-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
All my companies projects are on a specific Python version, 3.13. So on my company laptop I set the default globally to 3.13 using uv python pin --global 3.13
However if I now run a script that is using another python version, using uv run, which specifies explicitly its own python version, it complains about the globally set python version and it uses that version instead of its own. This is unexpected: I would expect scripts that specify their own python version to use that, overriding a global default but apparently this is not the case.
If I create a project with a specific python version, this does work as expected. Only with scripts I see this problem.
$ uv init --script foo.py --python 3.14
$ cat foo.py
# /// script
# requires-python = ">=3.14"
# dependencies = []
# ///
import sys
def main() -> None:
print("Hello from foo.py!")
print(".".join(map(str, sys.version_info[:3])))
if __name__ == "__main__":
main()
$ uv run foo.py
warning: The Python request from `.python-version` resolved to Python 3.13.11, which is incompatible with the script's Python requirement: `>=3.14`
Hello from foo.py!
3.13.11
Platform
Linux 6.8.0-90-generic x86_64 GNU/Linux
Version
uv 0.9.27
Python version
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working