Skip to content

fix(update): use 'uv tool install --force' for uv-tool installs#39

Merged
nicolas-rabault merged 1 commit into
mainfrom
fix/update-uv-tool-install
Jun 16, 2026
Merged

fix(update): use 'uv tool install --force' for uv-tool installs#39
nicolas-rabault merged 1 commit into
mainfrom
fix/update-uv-tool-install

Conversation

@nicolas-rabault

Copy link
Copy Markdown
Member

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 via uv 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:

uv tool install --force git+https://github.com/huggingface/leLab.git

--force reinstalls 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 install for uv venvs, python -m pip install for plain pip environments. As before, the displayed command is exactly what Update now executes.

Tests

Added test_update_command_for_uv_tool_install and test_update_command_for_pip_env; full update suite (17) passes, pre-commit clean.

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.
Copilot AI review requested due to automatic review settings June 16, 2026 12:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 checks sys.executable path for the uv/tools segment
  • Extended _build_update_cmd() with a new first-priority branch for uv-tool installs using uv 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.

@nicolas-rabault
nicolas-rabault merged commit 840a970 into main Jun 16, 2026
7 checks passed
@nicolas-rabault
nicolas-rabault deleted the fix/update-uv-tool-install branch June 16, 2026 12:06
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