Repository navigation
Add a uv package manager for Python CLI tools - #5801
Open
kai (yezhengkai) wants to merge 11 commits into
Open
kai (yezhengkai) wants to merge 11 commits into
kai (yezhengkai) wants to merge 11 commits into
Conversation
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.
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
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.
What this adds
This PR adds a package manager for Astral's uv, focused on the
uv toolsubcommand. 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.Uvproject (iduv) follows the existing manager structure: aPackageManagerimplementation, 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 onepypi_simple_index.cacheand 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
CompareVersionswith PEP 440 (PythonVersioninUniGetUI.Core.Tools). This orders1.0.0rc1below1.0.0and reads1.0.0-1as an implicit post-release, which the numeric default comparator would get backwards.PyPIProjectClient.ParseVersionsdrops a release only when every file in it is yanked, so a partially yanked release stays listed.PinUpdateToNewVersion), andUpdateVersionPintargets it exactly.--prerelease allowwhen the option is set (verified against uv 0.13.8). The version list for update selection includes pre-releases, matching Pip.uv python list --output-format jsonis the catalogue: a row with a non-nullpathis installed, one with a non-nullurlis downloadable. The chosen request is persisted asInstallOptions.Uv_PythonRequest,Uv_ManagedPythonandUv_NoPythonDownloads, andUvToolInstallRecordsremembers the request an install used, so an upgrade repeats it instead of silently switching interpreters.SupportsProxy = YesandSupportsProxyAuth = true, like Pip. uv honoursHTTPS_PROXY, includinguser:pass@host.Testing
Measured at
cca3c5604on Windows x64.Local
The focused suite (uv, Pip, reinstall-on-update, skipped-major updates) passes on both target frameworks:
That is 202 tests on
net10.0and 210 onnet10.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 runsuv python listfor 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 needsSeCreateSymbolicLinkPrivilege, andPowerShellOperationLauncherTests.TheScopeRetryMarkersSurviveTheLauncherreads a PowerShell error message that wraps differently under the longerx64output path. None touchUv,PyPIorPip.Both formatters exit 0:
dotnet format whitespace src --folderanddotnet format style src/UniGetUI.Windows.slnx --no-restore.GitHub Actions
.NET Testspasses on run 44879830307 atcca3c5604.Closes #3696
Generated with OpenCode