yezz123 / setup-uv

Set up your GitHub Actions workflow with a specific version of uv
https://github.com/astral-sh/uv
MIT License
35 stars 2 forks source link

Docs request: why use this over `pip install uv` #52

Closed jamesbraza closed 1 month ago

jamesbraza commented 2 months ago

Can you add to the README.md why one would want to use this GitHub Action over just:

steps:
  - uses: actions/checkout@v4
  - uses: actions/setup-python@v5
    with:
      python-version: 3.12
  - run: pip install uv
  # Or
  - run: pip install uv==0.2.22

Like can you add what are the gains with this GHA vs a native pip install?

yezz123 commented 1 month ago

Hey @jamesbraza thanks for raising this, here is a simple answer:

Benefits of using setup-uv action vs. native pip install:

Faster installation: The setup-uv action installs uv, a fast Python package installer and resolver. It's significantly quicker than pip, especially for larger projects with complex dependencies.

Check: https://github.com/yezz123/authx/actions/runs/9894689417/job/27332811035

Improved caching: The setup-uv action includes built-in caching mechanisms, which can significantly speed up subsequent runs of your workflow.

Reduced disk space usage: uv is more efficient in managing disk space, which can benefit CI environments with limited storage.

Built-in virtual environment management: uv includes features for managing virtual environments, simplifying your workflow setup.

By using the setup-uv action instead of a native pip install, we gain these advantages, leading to faster, more reliable, and more efficient CI/CD pipelines.

jamesbraza commented 1 month ago

Thanks for clarifying, though most of what you stated applies to uv vs pip, and is unrelated to this GitHub Action. Can you detail the benefits specific to setup-uv (and not uv in general)?

The setup-uv action includes built-in caching mechanisms, which can significantly speed up subsequent runs of your workflow.

I use cache aspect of setup-python (docs). How does setup-uv do caching?

What I mean is if one has this:

  - uses: actions/setup-python@v5
    with:
      cache: pip
  - run: pip install uv
  - run: uv pip install ...

And migrates to this:

  - uses: actions/setup-python@v5
  - uses: yezz123/setup-uv@v4
  - run: uv pip install ...

What are the gains there?