[Python-ideas] tarfile.extractall progress

Oleg Broytman phd at phdru.name
Fri Sep 1 08:04:09 EDT 2017


Hi!

On Fri, Sep 01, 2017 at 01:50:13PM +0200, Tarek Ziad?? <tarek at ziade.org> wrote:
> Hey,
> 
> For large archives, I want to display a progress bar while the archive
> is being extracted with:
> 
> https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extractall
> 
> I could write my own version of extractall() to do this, or maybe we
> could introduce a callback option that gets called
> everytime .extract() is called in extractall()
> 
> The callback can receive the tarinfo object and where it's being
> extracted. This is enough to plug a progress bar
> and avoid reinventing .extractall()

   What is "where" here? I think it should be 2 parameters -- position
in the file (in bytes) and total file size; the total could be None if
the size is unknown (the tar is piped from network or a (g/bz)zip
subprocess).

> I can add a ticket and maybe a patch if people think this is a good
> little enhancement

   Definitely a good idea!

> Cheers
> Tarek
> 
> -- 
> 
> Tarek Ziad?? | coding: https://ziade.org | running: https://foule.es |
> twitter: @tarek_ziade

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            phd at phdru.name
           Programmers don't die, they just GOSUB without RETURN.


More information about the Python-ideas mailing list