Skip to content

Conversation

@fujikosu
Copy link
Member

@fujikosu fujikosu commented Mar 17, 2025

Purpose

This PR switches the package management system from pip to uv. uv is a new package manager that is way faster and than pip.
uv is built in Rust, enabling it to outperform pip significantly. Benchmarks indicate that uv runs way faster than pip (https://github.com/astral-sh/uv/blob/main/BENCHMARKS.md). This speed is achieved through parallel downloads, efficient caching mechanisms, and by downloading only necessary metadata instead of entire package files.
Unlike pip, uv uses a lockfile (uv.lock) alongside pyproject.toml to ensure consistent and reproducible installations across different environments. This approach minimizes dependency conflicts and enhances reliability, similar to the functionality provided by tools like Poetry.

To support this switch, the following code changes were made:

  • CI
  • dockerfiles
  • reqruirements.txt -> pyproject.toml, uv.lock
  • reqruirements-dev.txt
    • this is now included in individual pyproject.toml instead of having one at the top as uv needs all dependencies in one pyproject.toml
  • dependabot
    • dependabot added uv supporthttps://github.blog/changelog/2025-03-13-dependabot-version-updates-now-support-uv-in-general-availability/ as of March but several issues were reported in Support updating uv.lock dependabot/dependabot-core#10478 (comment) for the last few months. Major issues seem to be resolved now so I'll check if it's working alright once the next update is made by dependabot for uv in this repo on May 1st.
  • README.md

Does this introduce a breaking change?

  • Yes
  • No

Author pre-publish checklist

  • No PII in logs or output
  • Made corresponding changes to the documentation
  • All new packages used are included in pyproject.toml
  • Functions use type hints, and there are no type hint errors

Pull Request Type

What kind of change does this Pull Request introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes
  • Experiment notebook

@fujikosu fujikosu changed the title Feat/migrate to uv from pip Feat: migrate to uv from pip Apr 13, 2025
@fujikosu fujikosu requested review from bhavikm and Copilot April 13, 2025 08:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 15 out of 21 changed files in this pull request and generated no comments.

Files not reviewed (6)
  • notebooks/.devcontainer/Dockerfile: Language not supported
  • notebooks/.devcontainer/requirements.txt: Language not supported
  • requirements-dev.txt: Language not supported
  • src/sample_cpu_project/.devcontainer/Dockerfile: Language not supported
  • src/sample_pytorch_gpu_project/.devcontainer/Dockerfile: Language not supported
  • src/sample_pytorch_gpu_project/.devcontainer/requirements.txt: Language not supported
Comments suppressed due to low confidence (4)

src/sample_pytorch_gpu_project/.devcontainer/pyproject.toml:2

  • [nitpick] The 'name' field is empty; consider providing a descriptive project name for clarity in the GPU project configuration.
name = ""

src/sample_cpu_project/.devcontainer/pyproject.toml:2

  • [nitpick] The 'name' field is empty; a meaningful project name can help differentiate configurations in the CPU project settings.
name = ""

notebooks/.devcontainer/pyproject.toml:2

  • [nitpick] The project name is not specified; consider adding a descriptive name for better clarity in the notebooks environment.
name = ""

src/sample_pytorch_gpu_project/README.md:137

  • [nitpick] The placeholder version 'x.x.x' for mlflow may be unclear to users; consider using a valid version or indicating explicitly that it is a placeholder.
    mlflow==x.x.x

@fujikosu fujikosu marked this pull request as ready for review April 14, 2025 00:44
@fujikosu fujikosu requested a review from meciwo April 14, 2025 04:04
Copy link

@meciwo meciwo left a comment

Choose a reason for hiding this comment

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

Reviewed all files. It looks good to me except src/common/requirements.txt

As you mentioned

This part can be potentially improved by https://docs.astral.sh/uv/concepts/projects/workspaces/#when-not-to-use-workspaces to move away from requirements.txt and gets its own lock file

What about trying to use workspaces?

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.

3 participants