pip icon indicating copy to clipboard operation
pip copied to clipboard

`pip cache purge` show freed space

Open janosh opened this issue 1 year ago • 2 comments

What's the problem this feature will solve?

Current report

Files removed: 364

is a bit meaningless.

Describe the solution you'd like

Much more interesting to see how much disk space was freed.

Alternative Solutions

Get cache dir location first and run du -sh on it before and after.

Additional context

I think freed disk space should be added to the default report, not hidden behind e.g. a verbose flag.

Code of Conduct

janosh avatar Jul 22 '23 20:07 janosh

FYI, having written disk space utilities in Python one of the issues is the size of the files cleared is not the disk space usage, in fact depending how the file system and OS are setup you might be removing no space from the disk.

And Pip can't invoke a tool like du as it's not portable.

That said other tools get around this by just saying "x {size unit} of files removed".

I'm not a Pip maintainer but I'm sure a PR would be welcomed for something like this.

notatallshaw avatar Jul 22 '23 20:07 notatallshaw

PRs would be welcomed, indeed.

ichard26 avatar May 07 '24 20:05 ichard26