Skip to content

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

Closed
aarondobbing wants to merge 2 commits intoastral-sh:mainfrom
aarondobbing:required-version-fix
Closed

Auto-exec compatible uv version when required-version doesn't match#11869
aarondobbing wants to merge 2 commits intoastral-sh:mainfrom
aarondobbing:required-version-fix

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 🙏

@zanieb
Copy link
Member

zanieb commented Apr 16, 2025

Hey! Just wondering if you're still poking at this?

@zanieb
Copy link
Member

zanieb commented May 27, 2025

Closing as stale, feel free to pick this back up!

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