Skip to main content

zipwalk

A very simple walker that recursively walks through nested zipfiles

About

This project was created because I needed a way to iterate over nested zipfiles without unzipping them.

Install

pip install zipwalk

Usage

It has a similar interface to os.walk:

from zipwalk import zipwalk

for root, zips, files in zipwalk('tests/1.zip'):
    print('root:', root.filename)
    print('zips:', zips)
    print('files:', files)

# output:
# root: tests/1.zip
# zips: {'2.zip'}
# files: {'1c.txt', 'dir/d1.txt', '1b.txt', '1a.txt'}
# root: 2.zip
# zips: set()
# files: {'2c.txt', '2b.txt', '2a.txt'}

root is an ZipFile instance opened on read mode, r. All zip files are opened using with context manager and will be closed once the generator is exhausted.

You can use the zip walker like the following:

from pathlib import Path
from zipfile import ZipFile

from zipwalk import zipwalk

zipwalk(ZipFile('tests/1.zip'))
zipwalk(Path('tests/1.zip'))
zipwalk('tests/1.zip')

Release files for zipwalk 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zipwalk 0.1.4
File Size Uploaded
zipwalk-0.1.4.tar.gz 1.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zipwalk 0.1.4
File Interpreter ABI Platform
zipwalk-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size:3.5 kB

Release files / zipwalk-0.1.4.tar.gz

Download URL zipwalk-0.1.4.tar.gz
Size 1.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e4df4b41d9502c9b39e56c4d815561a79ce304a9c707abb0a8fb4f8389cda7d4
BLAKE2b-256 checksum
How to use checksums
d87b63683a2300417ce70972aaa1338b97e509263423e5a6b87a3171aff2f323
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / zipwalk-0.1.4-py3-none-any.whl

Download URL zipwalk-0.1.4-py3-none-any.whl
Size 1.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0317ae333e304e9fc2a7caf50e2e5198aaca8a022baa17d87335cb207133262c
BLAKE2b-256 checksum
How to use checksums
0e7fe160da735e5d3106ac15502e5a0a73384b0109576f61185ce170f153ea9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page