Coder Social home page Coder Social logo

setup-cached-uv's Issues

Suggestion: if statement for caching

Adding cached-uv sped up my pypy jobs (yay!), but slowed down all the other jobs, as it takes 2-10 seconds to restore the cache, and uv's just as fast without it if it doesn't have to build anything (so slower if you include the cache restore time, its almost always double the time). PyPy (and probably Python 3.13, forgot to check) need to build, so I'd like to have an with: use-cache: field that I could put a template into that would be true if I need the cache, and false if not (the cache is ~70MB per job, and I have a lot of jobs, so it would be nice to just do the important bits).

I can do this with something like this:

    - name: Setup uv (uncached)
      uses: yezz123/setup-uv@v4
      if: "!startsWith(matrix.python-version, 'pypy')"

    - name: Setup uv (cached)
      uses: hynek/setup-cached-uv@v1
      if: "startsWith(matrix.python-version, 'pypy')"
      with:
        cache-suffix: -${{ matrix.python-version }}

but it's not as pretty to require two separate actions, IMO.

(FWIW, caching doesn't seem to be worth it for pixi or uv unless they have to build (which pixi never does...)

Suggestion: allow pinning uv version and cache it if given

Hi ๐Ÿ‘‹

This action could allow pinning the uv version, to avoid always getting the latest version with a potential breaking change. Something like:

    steps:
      - uses: hynek/setup-cached-uv@v1
        with:
          version: 0.1.31

Two side-effects of this feature to consider:

  1. The installation process might need to download the binary directly or use pip install to allow installing a specific version.
  2. The installed uv can be cached by using the uv version as part of the key, so next runs with the same uv version can take advantage of the cache instead of downloading/installing again.

Implement `cache-dependency-path` equivalent

I was about to post this issue over in baipp but this might be a better place for it.

The default cache key ${{runner.os}}-uv is not fine-grained enough to work with a heterogeneous CI/CD pipeline with separated build and test steps, because the requirements to build may be very different from the requirements to run and test. since baipp runs first, it will have a cache miss and save the uv cache for the build step, then any subsequent run using setup-cached-uv will have a cache hit, but only primed for the build dependencies and unable to update the cache with additional test dependencies.

Hopefully setup-python will eventually have cache: uv but until then it would be swell if I could add:

- uses: hynek/setup-cached-uv
  with:
    cache-dependency-path: '**/requirements-dev.txt'

which would result in cache keys like:

setup-cached-uv-Linux-22.04-Ubuntu-python-3.12.2-de25a2691d32d697d64ac0f45eb15fbab0ef7c4ca684a123bb5ec913fb6498d0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.