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 tool should self-manage Python executable dependencies #7651

Closed
jayqi opened this issue Sep 24, 2024 · 3 comments
Closed

uv tool should self-manage Python executable dependencies #7651

jayqi opened this issue Sep 24, 2024 · 3 comments
Labels
question Asking for clarification or support

Comments

@jayqi
Copy link

jayqi commented Sep 24, 2024

This is related to #7634 and #1640 but not quite the same thing.

Currently, uv tool creates virtual environments that symlink to the absolute path of the active Python executable. This means that there is a dependency on a Python that is installed by some other program, e.g. Homebrew, pyenv, mise, asdf, etc. This is a place for things to break if a user upgrades or uninstalls that particular instance of Python.

Since uv already supports installing python (with uv python), having uv also manage the Python interpreter would be better. That means everything involved in the tool installation would be controlled by uv.

FWIW, this was always something that I found kludgy about pipx. Pipx installations are never fully independent and isolated because of the dependencies on some other externally-managed Python interpreters.

@zanieb
Copy link
Member

zanieb commented Sep 24, 2024

I think this basically exists, you can use uv tool install --python-preference only-managed or change your global preference to only-managed. We also already use managed interpreter over the system ones (if the required version is installed). I don't think we'll change the default / make this required, but we will continue to improve the behavior of tool installations when we control the interpreter e.g. #7287

@jayqi
Copy link
Author

jayqi commented Sep 24, 2024

Ah, thanks for pointing to that option and to the ability to set it as a global preference.

I think it might be helpful to have something in Tools doc that highlights this option and points users to the Python versions for more info. I had looked at migrating my tools from pipx before having looked at migrating my Python installation management, so I hadn't encountered the explanation of these options.

Now that I'm experimenting with uv-managed Python, I think my remaining UX concerns are covered by #7287.

@charliermarsh charliermarsh added the question Asking for clarification or support label Sep 24, 2024
@jayqi
Copy link
Author

jayqi commented Sep 24, 2024

I've opened #7673 to add more documentation about Python versions for tools.

Otherwise, I still have a remaining concern that tool environments have leaky isolation even when the Python version is managed by uv. uv tool doesn't track this dependency, so removing the Python version with uv python would still break the tool environment. However, I think this concern is basically a duplicate of #7287.

I don't think there's anything else so I think this issue can be closed.

@jayqi jayqi closed this as completed Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

3 participants