python / python/mypy

Cache test requirements in GitHub actions

Open
#15,301 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature topic-developer topic-tests
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Currently we install them with tox, which is not cached, and appears to take >1 min of the test time. Should we see if caching could reduce it?

One option is to cache .tox -- e.g. https://github.com/lsst-sqre/safir/issues/2

Another is probably to move off tox. (Per About caching workflow dependencies, GitHub workflows would cache dependencies with minimal configuration effort.)

If we called pip directly rather than isolating in tox, something like this could work:

- uses: actions/setup-python@v4
  with:
    ...
    cache: 'pip'
    cache-dependency-path: |
      mypy-requirements.txt
      build-requirements.txt
      test-requirements*.txt

Note that I'm not actively pitching to reduce reliance on tox, merely bringing it up as a possibility.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the GitHub Actions workflows and the tox setup, along with mypy-requirements.txt, build-requirements.txt, and test-requirements*.txt. Compare caching .tox with setup-python's pip cache option. Done means the chosen approach reduces repeated test dependency installation while the test workflow remains passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, python
Domain
ci-cd, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.