pip-action icon indicating copy to clipboard operation
pip-action copied to clipboard

Add caching

Open dudicoco opened this issue 4 years ago • 2 comments
trafficstars

Hi,

Currently i'm using run: pip install ... within my workflow. I was hoping I could use this action so it would cache the pip packages but now I see that it doesn't.

What is the advantage of using this action vs just running pip install? Is there a plan for adding caching?

Thanks

dudicoco avatar Apr 06 '21 18:04 dudicoco

Hi! You're correct in saying that this action doesn't cache your pip packages. Although I'm sure caching could be implemented, I think that using the actions/cache action explicitly is better for code-readability. I'm not entirely opposed to implementing it, however I don't have any plans for doing so, and I think it would need to be done in a way that is not only explicit and understandable, but also support different Python installations and locations for the packages (I know the actions environment uses a non-standard file structure for some tools like Python, but I'm not sure if the directory is the same every time).

The main advantage of using this action is that it provides a symbolic representation in the workflow file. All this action really does is take the arguments passed to it and calls pip with them, so if you prefer to just call pip install, that's totally up to you. However, using this action may provide a more readable and understandable workflow than calling pip install with a bunch of arguments.

Hope this helps!

BSFishy avatar Apr 06 '21 19:04 BSFishy

actions/setup-python@v4 has caching support, you can use that instead:

    - uses: actions/setup-python@v4
      with:
        python-version: '3.10'
        cache: pip
        cache-dependency-path: pyproject.toml

flying-sheep avatar Oct 21 '22 15:10 flying-sheep