Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using uv in CircleCI #9203

Open
bolinocroustibat opened this issue Nov 18, 2024 · 3 comments
Open

Using uv in CircleCI #9203

bolinocroustibat opened this issue Nov 18, 2024 · 3 comments
Labels
documentation Improvements or additions to documentation wish Not on the immediate roadmap

Comments

@bolinocroustibat
Copy link

There is great documentation about using uv in GitHub Actions and in GitLab CI, along with a uv GitHub Actions setup.

Is there any plan for a documentation about how to use uv in CircleCI?

@zanieb
Copy link
Member

zanieb commented Nov 18, 2024

There's no particular plan for it, but if someone is interested in contributing a guide I will review and edit it.

@zanieb zanieb added documentation Improvements or additions to documentation wish Not on the immediate roadmap labels Nov 18, 2024
@antoniomdk
Copy link

I'm trying to get uv as an "officially" supported package manager for CircleCI:
CircleCI-Public/python-orb#124
CircleCI-Public/cimg-python#257

But I feel it will take a while for those changes to get to the mainstream (I think CircleCI performs quarterly releases of their base images).

In the meantime, I've been able to integrate with CircleCI using something like this:

  uv_install_packages:
    parameters:
      cache_key:
        type: string
      cache_dir:
        type: string
        default: /home/circleci/.cache/uv
    steps:
      - restore_cache:
          name: Restore python cache
          keys:
            - <<parameters.cache_key>>-uv-cache-{{ checksum "uv.lock" }}
            - <<parameters.cache_key>>-uv-cache-
      - run:
          name: Install python dependencies
          command: |
            mkdir -p "<<parameters.cache_dir>>" && \
            uv sync --frozen --compile-bytecode --cache-dir <<parameters.cache_dir>>
      - run:
          name: Clean pre-built wheels
          command: uv cache prune --ci --cache-dir <<parameters.cache_dir>>
      - save_cache:
          name: Save cache
          key: <<parameters.cache_key>>-uv-cache-{{ checksum "uv.lock" }}
          paths:
            - "<<parameters.cache_dir>>"

@bolinocroustibat
Copy link
Author

Amazing, very helpful, thank you.
I still have issues on uv command not being recognized in next jobs, even though the uv install job persists to workspaces and the next jobs attaches it, but I guess it's about fixing my CircleCI config...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation wish Not on the immediate roadmap
Projects
None yet
Development

No branches or pull requests

3 participants