mllam/neural-lam

Speed up CI by caching dependencies and virtual environment

Open

#605 opened on Apr 15, 2026

View on GitHub
 (1 comment) (0 reactions) (1 assignee)Python (276 forks)auto 404
cicdgood first issue

Repository metrics

Stars
 (282 stars)
PR merge metrics
 (PR metrics pending)

Description

Summary Right now, our CI reinstalls all dependencies from scratch on every run, which adds a lot of unnecessary time. We can speed things up significantly by caching both the downloaded packages (pip/uv) and the virtual environment. This becomes especially important if we want to run notebook tests on every PR without slowing CI down too much.

Proposed Solution We can introduce a two-layer caching approach:

  1. Cache package downloads Avoid re-downloading dependencies from PyPI on every run. For pip:
- name: Set up Python
  uses: actions/setup-python@v5
  with:
    python-version: '3.13'
    cache: 'pip'

For uv:

- name: Install uv
  uses: astral-sh/setup-uv@v1
  with:
    enable-cache: true
2. Cache the virtual environment (.venv)

Cache the installed environment so we only reinstall when dependencies actually change. The cache key should be based on uv.lock, not pyproject.toml. As discussed on Slack, hashing pyproject.toml isn’t reliable, dependencies can change upstream without any changes to that file. Using a lockfile ensures the cache is tied to exact, reproducible dependency versions.

Config:

- name: Cache virtual environment
  uses: actions/cache@v4
  with:
    path: .venv
    key: venv-${{ runner.os }}-${{ hashFiles('uv.lock') }}

Blockers

#600: This depends on resolving the Torch installation workaround. We can’t generate or commit a stable uv.lock until that’s fixed.

Contributor guide