Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uv run --isolated does not use .python-version #5740

Closed
bluss opened this issue Aug 2, 2024 · 2 comments · Fixed by #5741
Closed

uv run --isolated does not use .python-version #5740

bluss opened this issue Aug 2, 2024 · 2 comments · Fixed by #5741
Assignees
Labels
bug Something isn't working preview Experimental behavior

Comments

@bluss
Copy link
Contributor

bluss commented Aug 2, 2024

From the description, it could be expected that uv run --isolated derives some of its settings from the active project, like python version. Here's a strange situation, with an active virtualenv, but it was from a real situation.

I was thinking uv run is anchored in the project and an active virtualenv should not matter for its behaviour.

Problem seen here: uv run python launches py 3.12, but uv run --isolated python runs 3.11.
Why this could be a problem: the current project is requires-python>=3.12, and we want to run it, so we should start in that end (?)

uv init uvpy12 -p 3.12
cd uvpy12/
uv python pin 3.12
uv venv -p 3.11 py311
# Using Python 3.11.9
# Creating virtualenv at: py311
# Activate with: source py311/bin/activate
source py311/bin/activate
# (py311)
uv run python
# Python 3.12.4 (main, Jul 25 2024, 22:42:01) [Clang 18.1.8 ] on linux
# Type "help", "copyright", "credits" or "license" for more information.
# >>> ^D

uv run --isolated python
warning: `uv run` is experimental and may change without warning
  × No solution found when resolving dependencies:
  ╰─▶ Because the current Python version (3.11.9) does not satisfy Python>=3.12 and uvpy12==0.1.0
      depends on Python>=3.12, we can conclude that uvpy12==0.1.0 cannot be used.
      And because only uvpy12==0.1.0 is available and you require uvpy12, we can conclude that the
      requirements are unsatisfiable.

Version: uv 0.2.33

@charliermarsh
Copy link
Member

I think --isolated should still discover a .python-version, that was the intent at least. Will look into it.

@charliermarsh charliermarsh self-assigned this Aug 2, 2024
@charliermarsh charliermarsh added bug Something isn't working preview Experimental behavior labels Aug 2, 2024
@charliermarsh
Copy link
Member

Nice bug, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working preview Experimental behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants