| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Add utilities to construct package specs and installer commands (supporting uv then pip) and import shutil/sys. Update MainWindow to run update commands in sequence: store a queue of backends, start each with _start_next_update_command, accumulate attempt outputs and backend names, and retry fallbacks when one backend fails. Improve error messages and logging, adjust progress/cleanup behavior, and surface a consolidated failure dialog if no backend succeeds.
Add unit tests for deeplabcut.gui.utils functions package_specs_for_update and build_update_commands. Tests verify package_specs_for_update adds the GUI extra to 'deeplabcut', preserves other packages, and strips surrounding whitespace. Tests for build_update_commands assert backend ordering and that 'uv' is used when available, the exact command arguments (including use of sys.executable), and that a pip fallback is always present; monkeypatching of shutil.which is used to simulate installer availability.
There was a problem hiding this comment.
This PR refactors the GUI auto-updater to support multiple installer backends, preferring uv when available with a pip fallback, and ensures DeepLabCut updates from the GUI always include the [gui] extra so GUI dependencies stay in sync.
Changes:
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| deeplabcut/gui/utils.py | Adds helpers to build package specs (injecting [gui]) and generate backend-specific update commands (uv → pip). |
| deeplabcut/gui/window.py | Updates GUI auto-update execution to try backends in order and improve logging/error reporting across attempts. |
| tests/gui/test_auto_update.py | Adds tests for package spec normalization and backend command prioritization/fallback behavior. |
tests/gui/test_auto_update.py:38
({}, ["pip"]),
({"uv": "/mock/bin/uv"}, ["uv", "pip"]),
(
{"uv": "/mock/bin/uv"},
["uv", "pip"],
),
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
Initialize _update_process_output to an empty list when tearing down the update process to avoid carrying over stale output after process deletion. Also make the GUI auto-update test skip when PySide6 is not installed by adding pytest.importorskip("PySide6") to tests/gui/test_auto_update.py, preventing failures in environments without the GUI dependency.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Add robust handling for the update QProcess to avoid races and leaks. Introduces _disconnect_update_process to safely disconnect signals, updates _drain_update_process_output to accept a process (and resolve sender()), and adds sender checks in error/finished handlers so only the current process is handled. Ensures signals are disconnected before deleteLater and prevents acting on stale or unrelated processes.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Good fix! Just some minor comments and suggestions.
Sorry, something went wrong.
| if not self._start_next_update_command(): | ||
| self._cleanup_update_process() | ||
| QtWidgets.QMessageBox.warning( | ||
| self, | ||
| "Update failed", | ||
| "No available installer backend was found.", | ||
| ) | ||
|
|
There was a problem hiding this comment.
build_update_commands unconditionally appends the pip fallback so the list if never empty. This means that this code is unreachable, correct?
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, right now it;s more of a future guard. I changed the message a bit, I think it's useful to have
Sorry, something went wrong.
Rename public update helper functions to private (_package_specs_for_update, _build_update_commands) to indicate internal API and update all imports/usages in deeplabcut/gui/window.py and tests. Adjust MainWindow process handling: add None checks when comparing sender/process, call deleteLater() on the local process variable, and remove a redundant progress_bar.hide() on successful update. Update tests to reference the new private function names.
| Back | FazBrowse Home | New Git URL |
Scope
Adds new utility functions for building update commands, refactors the update process to try preferred installers first with fallbacks, and adds tests for these.
Automated summary
Update backend improvements:
Testing and reliability:
Dependency management: