setup-python icon indicating copy to clipboard operation
setup-python copied to clipboard

Save cache if packages have been updated

Open LoicGrobol opened this issue 2 years ago • 1 comments

Description

Automatically force a post-run cache save if packages have been updated.

Justification

Note: Restored cache will not be used if the requirements.txt file is not updated for a long time and a newer version of the dependency is available which can lead to an increase in total build time.

This is quite inconvenient, since it means that as time goes on, when new compatible versions of the dependencies are released, the cache will become staler and staler. Of course a workaround is to pin to specific versions:

The requirements file format allows for specifying dependency versions using logical operators (for example chardet>=3.0.4) or specifying dependencies without any versions. In this case the pip install -r requirements.txt command will always try to install the latest available package version. To be sure that the cache will be used, please stick to a specific dependency version and update it manually if necessary.

But that doesn't necessarily make sense (e.g. for libraries). It's also adds hassle that's unnecessary, since it's not hard to find out whether the versions of the installed packages have changed (just check the output of pip --list and see if that has changed since the last run). This can be done manually with the cache-save and cache-restore actions but it would be more convenient to have it as part of setup-python.

Are you willing to submit a PR? Yes

LoicGrobol avatar Dec 22 '23 14:12 LoicGrobol

Hello, @LoicGrobol! Thank you for creating this issue, we will investigate further and see what can be done :)

dusan-trickovic avatar Dec 25 '23 08:12 dusan-trickovic