fix(update): use 'uv tool install --force' for uv-tool installs#39
Merged
Conversation
The standard install is `uv tool install git+...`, which is an isolated uv tool env, not a venv. The previous pip/uv-pip command targeted the wrong place and wouldn't actually update such installs. Detect a uv-tool install (the interpreter lives under uv/tools) and update it in place with `uv tool install --force`, which re-fetches the latest commit. Keep uv-pip and plain-pip fallbacks for venv/pip environments.
There was a problem hiding this comment.
Pull request overview
This PR fixes the update notifier (from PR #38) to correctly handle the standard uv tool install deployment method. Previously, the update command assumed a pip/venv install, which wouldn't actually update a uv-tool environment. Now it detects a uv-tool install by checking if the running interpreter lives under a uv/tools/ path segment, and uses uv tool install --force accordingly.
Changes:
- Added
_is_uv_tool_install()detection function that checkssys.executablepath for theuv/toolssegment - Extended
_build_update_cmd()with a new first-priority branch for uv-tool installs usinguv tool install --force - Added two tests covering the new uv-tool path and the pip fallback path
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lelab/update.py | Added _is_uv_tool_install() helper and a new branch in _build_update_cmd() for uv-tool environments |
| tests/test_update.py | Added test_update_command_for_uv_tool_install and test_update_command_for_pip_env tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The update notifier (#38) assumed a pip/venv install, but the standard install is
uv tool install git+https://github.com/huggingface/leLab.git— an isolated uv tool environment, not an activated venv.For those installs, the previous command (
uv pip install --python … --force-reinstall …/pip install …) targets the wrong environment: there's no active venv, and the tool's env isn't managed viauv pip. So the displayed command and the Update now button would not actually update a standard install.Fix
Detect a uv-tool install — the running interpreter lives under
…/uv/tools/<name>/— and update it in place with:--forcereinstalls even though the version string is unchanged (0.1.0), so it re-fetches the latest commit. This mirrors the install command, just with--force.Fallbacks are unchanged:
uv pip installfor uv venvs,python -m pip installfor plain pip environments. As before, the displayed command is exactly what Update now executes.Tests
Added
test_update_command_for_uv_tool_installandtest_update_command_for_pip_env; full update suite (17) passes, pre-commit clean.