Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not throw error in pip cache purge when there are no cache packages to remove #10451

Closed
1 task done
dclong opened this issue Sep 8, 2021 · 2 comments · Fixed by #10459
Closed
1 task done

Do not throw error in pip cache purge when there are no cache packages to remove #10451

dclong opened this issue Sep 8, 2021 · 2 comments · Fixed by #10459
Labels
C: cache Dealing with cache and files in it state: awaiting PR Feature discussed, PR is needed type: feature request Request for a new feature

Comments

@dclong
Copy link

dclong commented Sep 8, 2021

What's the problem this feature will solve?

pip cache purge throws error when no cache packages are not found. This causes issues in automation scripts. For example, when building a Docker image, it is appealing to call pip cache purge to clean pip caches to reduce Docker image size. However, this command might fail depending whether pip cache packages are found.

Describe the solution you'd like

Do not throw errors when no cache packages are found. In the highlighted part of the screenshot below, just return (instead of throwing an exception).

image

Alternative Solutions

An alternative (and more complicated) way is to add an option to disable error throwing so that users can control the behavior of pip cache purge when no caching packages are found.

Additional context

NA

Code of Conduct

@dclong dclong added S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature labels Sep 8, 2021
@pradyunsg
Copy link
Member

Sounds reasonable to me!

@pradyunsg pradyunsg added C: cache Dealing with cache and files in it state: awaiting PR Feature discussed, PR is needed and removed S: needs triage Issues/PRs that need to be triaged labels Sep 8, 2021
@uranusjr
Copy link
Member

uranusjr commented Sep 9, 2021

For example, when building a Docker image, it is appealing to call pip cache purge to clean pip caches to reduce Docker image size.

For this use case specifically I think || true is pretty common? (Not saying your proposal is not a good idea.)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: cache Dealing with cache and files in it state: awaiting PR Feature discussed, PR is needed type: feature request Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants