Skip to content

Comments

[REFACTOR][CI] Modernize Python dependency management with uv#18812

Open
mshr-h wants to merge 3 commits intoapache:mainfrom
mshr-h:migrate-to-uv
Open

[REFACTOR][CI] Modernize Python dependency management with uv#18812
mshr-h wants to merge 3 commits intoapache:mainfrom
mshr-h:migrate-to-uv

Conversation

@mshr-h
Copy link
Contributor

@mshr-h mshr-h commented Feb 23, 2026

This PR modernizes Python tooling in CI by migrating Python interpreter installation, venv creation and package installation to uv.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @mshr-h, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the project's Python dependency management by adopting uv as the primary tool for package installation and locking. This change impacts various aspects of the development workflow, including Docker image builds, CI/CD pipelines, and local development setup, aiming for improved performance and reliability in handling Python environments. The shift to uv simplifies the dependency resolution process and standardizes package management practices across the repository.

Highlights

  • Python Dependency Management Modernization: Migrated Python package installation and dependency locking from pip and poetry to uv across Dockerfiles, installation scripts, and CI workflows.
  • CI/CD Streamlining: Removed the dedicated GitHub Action for Conda setup, simplifying the CI environment configuration.
  • Docker Image Optimization: Introduced global disabling of uv cache in Dockerfiles and updated Python installation steps to leverage uv for faster and more consistent builds.
  • Documentation Updates: Modified documentation examples in README.md, pull_request.rst, and from_source.rst to reflect the new uv usage.
  • Test Suite Adjustment: Added a specific pytest.xfail condition for certain parameters in test_frontend_onnx.py to handle a known runtime error.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .github/actions/setup/action.yml
    • Removed the entire GitHub Actions workflow for Conda setup.
  • docker/Dockerfile.ci_arm
    • Added an environment variable to globally disable uv cache.
  • docker/Dockerfile.ci_cpu
    • Added an environment variable to globally disable uv cache.
  • docker/Dockerfile.ci_gpu
    • Added an environment variable to globally disable uv cache.
    • Removed the command to globally disable pip cache.
  • docker/Dockerfile.ci_lint
    • Added an environment variable to globally disable uv cache.
    • Replaced pip3 install with uv pip install for linting tool dependencies.
  • docker/install/ubuntu_install_coreml.sh
    • Replaced pip3 install with uv pip install for coremltools.
  • docker/install/ubuntu_install_cuda_python.sh
    • Replaced pip3 install with uv pip install for cuda-python.
  • docker/install/ubuntu_install_dgl.sh
    • Replaced pip3 install with uv pip install for dgl.
  • docker/install/ubuntu_install_gluoncv.sh
    • Replaced pip3 install with uv pip install for gluoncv.
  • docker/install/ubuntu_install_jax.sh
    • Replaced pip3 install with uv pip install for jax and flax installations.
  • docker/install/ubuntu_install_nnef.sh
    • Replaced pip3 install with uv pip install for nnef.
  • docker/install/ubuntu_install_onnx.sh
    • Replaced pip3 install with uv pip install for onnx, onnxruntime, onnxoptimizer, torch, and torchvision.
  • docker/install/ubuntu_install_python.sh
    • Removed pip update and configuration steps.
    • Installed uv into the build virtual environment.
    • Configured UV_NO_CACHE=1 for Python package installations.
    • Replaced pip install with uv pip install for base packages.
    • Modified the pip and pip3 wrapper scripts to route commands through uv.
  • docker/install/ubuntu_install_python_package.sh
    • Replaced pip3 install with uv pip install for common Python packages.
  • docker/install/ubuntu_install_redis.sh
    • Replaced pip3 install with uv pip install for xgboost.
  • docker/install/ubuntu_install_sphinx.sh
    • Replaced pip3 install with uv pip install for Sphinx-related packages.
  • docker/install/ubuntu_install_tensorflow.sh
    • Replaced pip3 install with uv pip install for tensorflow.
  • docker/install/ubuntu_install_tensorflow_aarch64.sh
    • Replaced pip3 install with uv pip install for numpy and tensorflow.
  • docker/install/ubuntu_install_tflite.sh
    • Replaced pip3 install with uv pip install for flatbuffers.
  • docker/python/bootstrap/generate.sh
    • Refactored the dependency locking mechanism to use uv pip compile instead of poetry.
    • Updated the requirements.in file content to include uv and remove poetry.
  • docker/python/bootstrap/lockfiles/constraints-3.10.txt
    • Updated the generated constraints file to reflect uv as the locking tool, significantly reducing its size and changing its content to include uv.
  • docker/python/bootstrap/lockfiles/requirements-3.10.txt
    • Removed poetry and added uv to the list of required packages.
  • docs/README.md
    • Updated documentation examples to use uv pip install instead of python3 -m pip install or pip install.
  • docs/contribute/pull_request.rst
    • Updated documentation example to use uv pip install for pytest and Cython installation.
  • docs/install/from_source.rst
    • Updated documentation examples to use uv pip install for installing tvm-ffi and other Python dependencies.
  • python/.gitignore
    • Added new entries to ignore apache_tvm_ffi-*, tvm_ffi/*, typing_extensions.py, typing_extensions-*.dist-info, and bin/.
  • tests/python/relax/test_frontend_onnx.py
    • Added a pytest.xfail condition for test_unique when num_outputs is 3 or 4 and axis is None, addressing a known runtime error.
  • tests/scripts/ci.py
    • Updated documentation requirements installation to use uv pip install.
  • tests/scripts/task_python_docs.sh
    • Updated tvm-ffi setup to use uv pip.
  • tests/scripts/task_python_hexagon.sh
    • Updated tvm-ffi setup to use uv pip.
  • tests/scripts/task_python_integration.sh
    • Updated tvm-ffi setup to use uv pip.
  • tests/scripts/task_python_nightly.sh
    • Updated tvm-ffi setup to use uv pip.
  • tests/scripts/task_python_unittest.sh
    • Updated tvm-ffi setup to use uv pip.
  • tests/scripts/task_web_wasm.sh
    • Updated tvm-ffi setup to use uv pip.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/main.yml
Activity
  • The pull request is marked as 'Work In Progress' (WIP) by the author, mshr-h.
  • The pull request description is brief, indicating that the changes are still under active development.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a significant and welcome refactoring to modernize Python dependency management by replacing pip, conda, and poetry with uv. The changes are consistently applied across Dockerfiles, installation scripts, and documentation, leading to a much simpler and more maintainable CI setup. The simplification of the lockfile generation process is particularly noteworthy. I have one minor suggestion regarding documentation formatting. Overall, this is an excellent improvement.

docs/README.md Outdated
'uv pip install --quiet tlcpack-sphinx-addon==0.2.1 && uv pip freeze' > frozen-requirements.txt

pip install -r frozen-requirements.txt
uv pip install -r frozen-requirements.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The indentation for this command appears to be inconsistent with the rest of the code block. For better readability, it should be aligned with the ./docker/bash.sh command on line 50.

Suggested change
uv pip install -r frozen-requirements.txt
uv pip install -r frozen-requirements.txt

@mshr-h mshr-h force-pushed the migrate-to-uv branch 2 times, most recently from d4236c7 to a9e418f Compare February 23, 2026 10:32
@mshr-h mshr-h changed the title [WIP][Refactor][CI] Modernize Python dependency management with uv [WIP][Refactor][Python][CI] Modernize Python dependency management with uv Feb 23, 2026
@mshr-h mshr-h self-assigned this Feb 24, 2026
@mshr-h mshr-h marked this pull request as ready for review February 24, 2026 08:30
@mshr-h mshr-h changed the title [WIP][Refactor][Python][CI] Modernize Python dependency management with uv [Refactor][Python][CI] Modernize Python dependency management with uv Feb 24, 2026
@mshr-h
Copy link
Contributor Author

mshr-h commented Feb 24, 2026

cc @tqchen @yongwww

@mshr-h mshr-h changed the title [Refactor][Python][CI] Modernize Python dependency management with uv [REFACTOR][CI] Modernize Python dependency management with uv Feb 24, 2026
Copy link
Member

@guan404ming guan404ming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is really a big improvement for dev experience.

cython \
mypy \
uv pip install --upgrade \
"Pygments~=2.19" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a dumb question, how do we get the the deps pins (e.g., Pygments/cloudpickle/cython/mypy/pytest/requests/scipy/Jinja2/ml_dtypes, etc.) here?

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.

4 participants