Skip to content

Add a uv package manager for Python CLI tools - #5801

Open
kai (yezhengkai) wants to merge 11 commits into
Devolutions:mainfrom
yezhengkai:feat/uv-manager
Open

kai (yezhengkai) wants to merge 11 commits into
Devolutions:mainfrom
yezhengkai:feat/uv-manager

Conversation

@yezhengkai

@yezhengkai kai (yezhengkai) commented Nov 19, 2026 •

Copy link
Copy Markdown
  • I have read the contributing guidelines, and I agree with the Code of Conduct.
  • Have you checked that there aren't other open pull requests for the same changes?
  • Have you tested that the committed code can be executed without errors?
  • Have you confirmed that this issue is caused by UniGetUI itself, and not by the package manager or the package involved? N/A: this PR adds a new package-manager integration; there is no pre-existing defect to attribute to UniGetUI.

What this adds

This PR adds a package manager for Astral's uv, focused on the uv tool subcommand. It lists, installs, updates and uninstalls Python CLI tools that uv keeps in isolated tool environments, and lets the install-options dialog pick which Python a tool runs on.

The new UniGetUI.PackageEngine.Managers.Uv project (id uv) follows the existing manager structure: a PackageManager implementation, one details helper, one operation helper, and a source helper.

A new shared project, UniGetUI.PackageEngine.Managers.Generic.PyPI, holds the PyPI index and project lookups. Pip now reads its index through the same service, so both managers share one pypi_simple_index.cache and rank search results the same way.

The TUI ships the manager too. uv stands in the fake data set, and the E2E suite updates a uv package through the fake manager process.

Decisions

  • Version comparison. uv versions come from PyPI, so the manager overrides CompareVersions with PEP 440 (PythonVersion in UniGetUI.Core.Tools). This orders 1.0.0rc1 below 1.0.0 and reads 1.0.0-1 as an implicit post-release, which the numeric default comparator would get backwards.
  • Yanked releases. PyPIProjectClient.ParseVersions drops a release only when every file in it is yanked, so a partially yanked release stays listed.
  • Skipped major updates. uv updates to an exact version, so with the existing "Skip major updates" option the manager offers the newest stable version within the installed major (PinUpdateToNewVersion), and UpdateVersionPin targets it exactly.
  • Pre-releases. Install and update pass --prerelease allow when the option is set (verified against uv 0.13.8). The version list for update selection includes pre-releases, matching Pip.
  • Python interpreter choice. uv python list --output-format json is the catalogue: a row with a non-null path is installed, one with a non-null url is downloadable. The chosen request is persisted as InstallOptions.Uv_PythonRequest, Uv_ManagedPython and Uv_NoPythonDownloads, and UvToolInstallRecords remembers the request an install used, so an upgrade repeats it instead of silently switching interpreters.
  • Proxy. SupportsProxy = Yes and SupportsProxyAuth = true, like Pip. uv honours HTTPS_PROXY, including user:pass@host.

Testing

Measured at cca3c5604 on Windows x64.

Local

The focused suite (uv, Pip, reinstall-on-update, skipped-major updates) passes on both target frameworks:

dotnet test src/UniGetUI.PackageEngine.Tests/UniGetUI.PackageEngine.Tests.csproj --filter "FullyQualifiedName~UvManagerTests|FullyQualifiedName~UvInstallOptionsTests|FullyQualifiedName~PipManagerTests|FullyQualifiedName~ReinstallOnUpdate|FullyQualifiedName~SkipMajorUpdates"

That is 202 tests on net10.0 and 210 on net10.0-windows10.0.26100.0.

The install-options dialog is covered through a headless Avalonia session that drives the real InstallOptionsControl: 3 tests. The interpreter test runs uv python list for real, and reports an empty catalogue when the build machine has no uv.

The whole solution, dotnet test src/UniGetUI.Windows.slnx -p:Platform=x64 -maxcpucount:1, reports 10797 passed, 3 failed and 25 skipped. All three come from this machine rather than from the branch: two tests create a symlink, which needs SeCreateSymbolicLinkPrivilege, and PowerShellOperationLauncherTests.TheScopeRetryMarkersSurviveTheLauncher reads a PowerShell error message that wraps differently under the longer x64 output path. None touch Uv, PyPI or Pip.

Both formatters exit 0: dotnet format whitespace src --folder and dotnet format style src/UniGetUI.Windows.slnx --no-restore.

GitHub Actions

.NET Tests passes on run 44879830307 at cca3c5604.


Closes #3696

Generated with OpenCode

The install-options dialog grows a Python section for managers that declare
SupportsCustomPythonInterpreters: an interpreter list built from
`uv python list --output-format json`, a uv-managed or system choice, and a
"Do not download Python interpreters" toggle. The choice travels as
InstallOptions.Uv_PythonRequest, Uv_ManagedPython and Uv_NoPythonDownloads;
ApplyOperationOverrides copies it onto the package on both the local and the
broker path, and UvToolInstallRecords keeps the original request so an
upgrade reuses it.

GetStandaloneParameters hands the options to the helper without applying
them to the package, which is the path the dialog previews through, so the
helper reads options.Uv_* before the package overrides. The command shown
while the dialog is open then carries the flags the same dialog would start.
`uv python` is a top-level subcommand, so its listing neither carries the
`tool` call arguments nor omits --output-format json.
The parser fixtures are text uv actually printed for `uv tool list`,
`uv outdated` and `uv python list`, so a new uv release that changes the
shape shows up as a failing test instead of a silent mismatch.
PyPI drops yanked releases and orders pre-releases below their final
release. The manager leaves a release out only when every file in it is
yanked, lists stable releases in the version dropdown while keeping
pre-releases available to within-major selection, and pins a skipped
major update to a version that is still eligible.
The install records call the JSON serializer through JsonTypeInfo, the
license table knows uv's Apache license, and the TUI expectations follow
the package counts the uv fake data adds.
@github-actions github-actions Bot added pip new-feature A new feature that could be useful in WingetUI labels Nov 19, 2026
Keep the PyPI index and version-lookup changes from upstream in the shared PyPI service: the idle release, the byte-array parse and the failure reporting now live in PyPIIndexClient and Pip, so nothing moved back into Pip.cs.
# Conflicts:
#	src/UniGetUI.PackageEngine.Tests/PipManagerTests.cs

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature A new feature that could be useful in WingetUI pip

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] add uv as an alternative to pip and pipx

1 participant