Skip to content

Bugfix/uv shim fallback - #40

Merged
davebelais merged 9 commits into
mainfrom
bugfix/uv-shim-fallback
Jul 30, 2026
Merged

Bugfix/uv shim fallback#40
davebelais merged 9 commits into
mainfrom
bugfix/uv-shim-fallback

Conversation

@davebelais

@davebelais davebelais commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

This pull request improves the fallback logic when the uv executable is present but cannot be run, ensuring more robust handling of package management commands. The main changes include updating both the implementation and documentation to treat OSError (e.g., due to a dangling shebang, corrupted binary, or permission error) as a trigger for falling back to pip, not just CalledProcessError. The test suite is also extended to cover these scenarios.

Fallback Logic Improvements:

  • The fallback from uv to pip in _iter_pip_list and _install_requirement_string now triggers on both CalledProcessError and OSError, ensuring that any execution failure of uv (including unrunnable binaries) results in a retry with pip. [1] [2]
  • Added the _raise_oserror helper to ensure that if uv was not attempted and pip itself fails with OSError, the error is propagated without modification, preserving prior behavior. [1] [2]

Documentation Updates:

  • The fallback design spec is updated to clarify that OSError (not just nonzero exit codes) from uv triggers a fallback to pip, and describes the resulting behavior in detail. [1] [2]

Testing Enhancements:

  • Added _write_broken_uv and _write_installable_package test helpers to simulate both nonzero-exit and unrunnable uv executables, and to create real installable test packages.
  • New tests verify that fallback to pip works when uv is unrunnable (OSError), and that the error handling and recovery logic behave as intended in all cases. [1] [2] [3]

Miscellaneous:

  • Bumped the project version to 1.4.3 in pyproject.toml.
  • Minor code comment and formatting improvements for clarity.

These changes make the fallback mechanism more robust and ensure that package operations do not fail unexpectedly when uv is present but unusable.

@davebelais
davebelais merged commit 2ecb1e8 into main Jul 30, 2026
17 checks passed
@davebelais
davebelais deleted the bugfix/uv-shim-fallback branch July 30, 2026 18:29
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.

1 participant