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

uv cache populate / export cache #6323

Open
adriangb opened this issue Aug 21, 2024 · 3 comments
Open

uv cache populate / export cache #6323

adriangb opened this issue Aug 21, 2024 · 3 comments
Labels
cache Caching of packages and metadata needs-design Needs discussion, investigation, or design

Comments

@adriangb
Copy link

adriangb commented Aug 21, 2024

It would be nice to have the ability to pre-cache dependencies. In particular I would find this useful in a monorepo context to:

  1. Have a docker layer where I populate the cache with all dependencies.
  2. In another service specific layer I do a --cache-from or similar from this cache layer and tell uv to use the cache that was built in that layer.

This is important because if I have services with the following deps:

tensorflow
some-small-package

And

tensorflow
some-other-small-package

If I don't have a "common" step where I download tensorflow I'd end up downloading it twice (once for each service) which is wasteful. Yes you can parallelize it but IMO efficient serial >> inefficient parallel.

Alternatively something like python-poetry/poetry#5983 and functionality in uv to populate that folder of wheels could do the trick.

@charliermarsh charliermarsh added cache Caching of packages and metadata needs-design Needs discussion, investigation, or design labels Aug 21, 2024
@charliermarsh
Copy link
Member

What's the typical mechanism that you'd use to ensure that those two layers use the same TensorFlow version?

@adriangb
Copy link
Author

Currently it's a PITA with all package managers that I know of that support monorepos.

Hence why I think something like:

FROM python:3.12-slim-bullseye AS deps
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
COPY uv.lock .
RUN --mount=type=cache,target=/root/.cache/uv \
  uv cache populate

FROM python:3.12-slim-bullseye AS service
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
COPY . /app
RUN --mount=from=deps,source=/root/.cache/uv,target=/root/.cache/uv \
  uv install --package service

Would be nice.

@samypr100
Copy link
Contributor

samypr100 commented Aug 21, 2024

I'd say this is similar in the venue/spirit of #1681 / #3163 as populating the cache will involve downloading and possibly a build step which is a common workflow achieved with pip wheel or download.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cache Caching of packages and metadata needs-design Needs discussion, investigation, or design
Projects
None yet
Development

No branches or pull requests

3 participants