Skip to content

Conversation

edgarrmondragon
Copy link
Contributor

Closes #2901.

This PR updates the interpreter discovery logic to look for uv-managed Python installations.

They currently take priority over Python interpreters in PATH but I'm not 100% sure that makes sense so let me know what you think!

An alternative to this PR that I found after starting work for this PR is implementing a discovery plugin. I see pyenv discovery has not been implemented as a builtin discovery option, so let me know if there are good reasons to also keep uv-managed Pythons outside of virtualenv's scope.

Thanks for contributing, make sure you address all the checklists (for details on how see development documentation)

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation

@edgarrmondragon edgarrmondragon marked this pull request as draft July 5, 2025 17:50
@edgarrmondragon edgarrmondragon marked this pull request as ready for review July 5, 2025 18:18
Copy link
Contributor

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to fix the CI first though, can you open a parallel PR for that?

Copy link
Contributor

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong button 😆

@edgarrmondragon
Copy link
Contributor Author

We need to fix the CI first though, can you open a parallel PR for that?

Saw you started #2904. Want to take a stab in a different PR?

@gaborbernat
Copy link
Contributor

Yeah I started but solution turned out something complicated... At some point might get back to it.

@esafak
Copy link
Contributor

esafak commented Jul 16, 2025

We need to fix the CI first though, can you open a parallel PR for that?

What's the problem with it?

@gaborbernat
Copy link
Contributor

We need to fix the CI first though, can you open a parallel PR for that?

What's the problem with it?

Seems the way the free threaded Python interpeter was provided broke, and tox can no longer discover it.

@edgarrmondragon
Copy link
Contributor Author

We need to fix the CI first though, can you open a parallel PR for that?

What's the problem with it?

See https://github.com/pypa/virtualenv/actions/runs/16314042782/job/46075567108.

@edgarrmondragon
Copy link
Contributor Author

@gaborbernat
Copy link
Contributor

Might not be needed anymore: astral-sh/uv@0.8.0 (release).

Can still be helpful as users might not add that folder to their PATH 😊

@gaborbernat gaborbernat merged commit 430eb4b into pypa:main Jul 21, 2025
42 checks passed
@nedbat
Copy link

nedbat commented Aug 11, 2025

I wrote an issue in the tox repo: tox-dev/tox#3580

As workarounds what you can do past make sure you have a compatible Python on your path before uv..

In my case, the uv Python isn't on the PATH at all, yet virtualenv finds it instead of the Python 3.13 that is on the path. Should I open an issue in this repo?

@nedbat
Copy link

nedbat commented Aug 11, 2025

They currently take priority over Python interpreters in PATH but I'm not 100% sure that makes sense so let me know what you think!

I don't understand the logic of this. If I wanted to use uv interpreters, I would put them in the PATH.

@gaborbernat
Copy link
Contributor

That's not generally true. On Windows we support PEP-514 even without those being on PATH.

In my case, the uv Python isn't on the PATH at all, yet virtualenv finds it instead of the Python 3.13 that is on the path. Should I open an issue in this repo?

If uv takes priority over PATH I'd consider that a bug, and PR/issue welcome.

@nedbat
Copy link

nedbat commented Aug 11, 2025

If uv takes priority over PATH I'd consider that a bug, and PR/issue welcome.

That's exactly the behavior as explained in the description of this PR.

@edgarrmondragon edgarrmondragon deleted the uv-managed-python branch August 11, 2025 17:44
@edgarrmondragon
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Find uv-managed Pythons with the --python flag
4 participants