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

Auto-exec compatible uv version when required-version doesn't match #11869

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aarondobbing
Copy link

Implements #11065

Summary

When a project has a required-version constraint in its pyproject.toml
that doesn't match the current uv version, automatically use uv tool run
to execute a compatible version instead of exiting with an error.

This allows developers with newer uv versions to still work with projects
that need older versions, without having to manually use uv tool run
for each command to ensure a consistent development experience.

:chef_kiss:

Test Plan

Unit tests covering the cases described in issue #11065

Verified locally in sample python projects matching the described issues outlined by @mjpieters

  When a project has a required-version constraint in its pyproject.toml
  that doesn't match the current uv version, automatically use `uv tool run`
  to execute a compatible version instead of exiting with an error.

  This allows developers with newer uv versions to still work with projects
  that need older versions, without having to manually use `uv tool run`
  for each command.

  Fixes astral-sh#11833
@zanieb zanieb self-assigned this Mar 1, 2025
@zanieb
Copy link
Member

zanieb commented Mar 1, 2025

Cool! I'll give this a look.

Did you explore calling into the tool_run implementation directly instead of spawning a subprocess?

@aarondobbing
Copy link
Author

I didn't explore it - Not familiar with the uv project in general, was just looking to pick a first issue that would support me in my day to day 😅

Totally makes sense as an approach - Will give it a spin locally and throw in an update up if I can get something tenable together later.

Thanks for feedback 🙏

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.

2 participants