Migrate Python environment management from pip to uv - #5
Closed
rominf wants to merge 2 commits into
Closed
Conversation
Add a shared uv module in rocm-core that auto-downloads the standalone uv binary for the host platform and provides uv venv/pip-install/freeze arg builders used by both apps/rocm and the pytorch engine. Convert all managed-runtime provisioning from python -m venv + ensurepip + python -m pip install to uv venv --python + uv pip install --python. Drop the ensurepip bootstrap step entirely. Rename the "pip" install-format identifier to "wheel" across the CLI (--format wheel), enums (InstallFormat::Wheel, InstallSdkFormat::Wheel), JSON tool schemas, manifest serialization, on-disk path layout (runtimes/wheel/), assistant validation messages, and all tests and script fixtures. The manifest struct retains a pip_cache_dir: Option field for backward compatibility with existing serialized JSON but it is no longer populated.
…dalone Replace the bespoke python-build-standalone download flow (GitHub API fetch, asset selection, flate2+tar extraction, find_python_executable traversal) with two uv subcommands: `uv python install <version>` and `uv python find <version>`. uv sources from the same astral-sh/python-build-standalone releases but handles all the download, caching, extraction, and path resolution internally. ManagedPythonManifest loses source_url, release_tag, and asset_name (no longer tracked). The default version changes from the pinned "3.12.10" patch to the minor-version "3.12" selector, letting uv pick the latest patch within that line. Remove the now-dead fetch_python_standalone_release, select_python_standalone_asset, managed_python_asset_version_prefix, python_standalone_platform_triple, extract_managed_python_archive, and find_python_executable helper chain.
rominf
force-pushed
the
uv-migration-work
branch
from
June 10, 2026 14:27
0d1744c to
f609681
Compare
rominf
marked this pull request as ready for review
June 10, 2026 14:27
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.
Summary
pipwithuvfor all Python package installations (ComfyUI dependencies, TheRock SDK/torch wheels, managed venv setup)python-build-standalonedownloads touv python installnative-certsfeature onureqso TLS uses system certificate stores on all platformspiptowheelto better reflect what it installsWhy: uv is dramatically faster than pip for dependency resolution and installation, and handles venv creation + Python installation in a single unified tool. This removes several bespoke helpers (pip cache, pip timeout/retry knobs, pip arg builders) in favour of uv's built-in equivalents.
Non-obvious:
uv pip installrequires targeting the venv via--python <venv_python>rather than activating it;uv_pip_install_base()encodes this so call-sites don't have to think about it. Thepip_cache_dirfield onComfyUiManifestis retained asOption<PathBuf>(set toNone) for forwards/backwards serialisation compatibility with existing manifests on disk.Test plan
rocm-cache/uv(notrocm-cache/pip) is absent on first runtherock_sdk_install_test.pyupdated to pass--format wheeland assertformat: wheelin outputuv_install_base_targets_venv_pythonverifiesuv_pip_install_baseproduces a correctly targeted arg list