How to setup pip cache save/restore on a node project?

Hi,

I have a Gatsby/node project, for which I must run aws s3 sync (python/pip/aws cli)

My build script always have to start with “pip install awscli”, which take a few seconds to complete on every single build.

Is there a way to install that awscli once for all and keep it in the cache?

I’ve noticed some others, using Hugo, had pip cache save/restore in their logs:
5:44:09 PM: Started saving pip cache
5:44:09 PM: Finished saving pip cache
Like in this thread: Build failure with hugo - setting hugo version

Is it possible to enable such pip caching on my node site?

Currently my site logs that the following get cached: node version, node modules, yarn cache, go. I don’t need go caching, but I need pip caching and have no idea how to enable this caching so that next builds are faster.

Ok I’ve found out I could put a requirements.txt file at the root of the site and it’s used to install pip deps

Heya @slorber sorry to be slow to see this; our office is pretty much closed over the weekend.

I’m not 100% certain that our python package caching works (I can see we’re trying:

but have never tested myself)…but hopefully you find that it did ?

Yeah it did. It said “found cached version” or something in the logs in next builds. Actually reduced the pip dependencies install from 20s to 10s (as I need only 1) so it was not a game changer :smiley:

1 Like