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

Should cache of python-build-standalone downloads be invalidated? #10270

Open
tpgillam opened this issue Jan 2, 2025 · 0 comments
Open

Should cache of python-build-standalone downloads be invalidated? #10270

tpgillam opened this issue Jan 2, 2025 · 0 comments
Labels
needs-decision Undecided if this should be done

Comments

@tpgillam
Copy link

tpgillam commented Jan 2, 2025

Context: I was wondering whether astral-sh/python-build-standalone#421 might have helped with #6893 (answer: 'no'). This required me knowing which build of python-build-standalone I was using.

Current uv behaviour seems to be that the version of python-build-standalone isn't included anywhere obvious, and we don't automatically invalidate our cache of downloaded interpreters based on this version.

e.g. we can update to a newer uv and still get an old python build:

> uv --version
uv 0.5.13
> rm -r .venv/
> uv run python -VV
Using CPython 3.12.8
Creating virtual environment at: .venv
Installed 39 packages in 77ms
Python 3.12.8 (main, Dec  6 2024, 19:59:28) [Clang 18.1.8 ]

(Perhaps there's a better way (?) but the only way I could think to figure out what build of python-build-standalone we're using is by looking at the build time included in python -VV, so here December 6th 2024. )

From #7036 (comment), we need to explicitly remove or reinstall all downloaded versions to get the newer build:

> uv python uninstall --all
Searching for Python installations
Uninstalled 4 versions in 181ms
 - cpython-3.11.9-linux-x86_64-gnu
 - cpython-3.12.5-linux-x86_64-gnu
 - cpython-3.12.8-linux-x86_64-gnu
 - cpython-3.13.0-linux-x86_64-gnu
> uv run python -VV
warning: Ignoring existing virtual environment linked to non-existent Python interpreter: .venv/bin/python3 -> python
Using CPython 3.12.8
Removed virtual environment at: .venv
Creating virtual environment at: .venv
Installed 39 packages in 70ms
Python 3.12.8 (main, Dec 19 2024, 14:33:20) [Clang 18.1.8 ]

(NB python now build on December 19th)

Overall I find the existing behaviour a slightly opaque / unintuitive... but also it's a pretty niche problem! Nonetheless, maybe there's scope for a little improvement?

Some assorted ideas / thoughts:

  • add documentation that we don't invalidate managed python downloads here: https://docs.astral.sh/uv/concepts/python-versions/#managed-python-distributions
  • inclusion of python-build-standalone version in uv python list output
  • sometimes (probably rarely!) useful to be able to specify the precise version of python-build-standalone?
  • automatic switching of interpreter build version based on uv version... but this also feels a little unintuitive.
  • if updating a managed python build, what should happen to existing venvs? I'm not too sure.
@charliermarsh charliermarsh added the needs-decision Undecided if this should be done label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-decision Undecided if this should be done
Projects
None yet
Development

No branches or pull requests

2 participants