Skip to content

Migrate Python environment management from pip to uv - #5

Closed
rominf wants to merge 2 commits into
powderluv:jam/updatesfrom
rominf:uv-migration-work
Closed

Migrate Python environment management from pip to uv#5
rominf wants to merge 2 commits into
powderluv:jam/updatesfrom
rominf:uv-migration-work

Conversation

@rominf

@rominf rominf commented Jun 10, 2026

Copy link
Copy Markdown

Summary

  • Replace pip with uv for all Python package installations (ComfyUI dependencies, TheRock SDK/torch wheels, managed venv setup)
  • Switch managed Python provisioning from python-build-standalone downloads to uv python install
  • Enable native-certs feature on ureq so TLS uses system certificate stores on all platforms
  • Rename the internal runtime format tag from pip to wheel to better reflect what it installs

Why: 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 install requires 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. The pip_cache_dir field on ComfyUiManifest is retained as Option<PathBuf> (set to None) for forwards/backwards serialisation compatibility with existing manifests on disk.

Test plan

  • Smoke test updated to assert rocm-cache/uv (not rocm-cache/pip) is absent on first run
  • therock_sdk_install_test.py updated to pass --format wheel and assert format: wheel in output
  • Unit test uv_install_base_targets_venv_python verifies uv_pip_install_base produces a correctly targeted arg list

rominf added 2 commits June 10, 2026 17:19
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
rominf force-pushed the uv-migration-work branch from 0d1744c to f609681 Compare June 10, 2026 14:27
@rominf
rominf marked this pull request as ready for review June 10, 2026 14:27
@rominf rominf closed this Jun 12, 2026
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