zipp

3.23.0 · active · verified Sat Mar 28

zipp is the official backport of the pathlib-compatible zipfile.Path object from the Python standard library. It provides a Traversable/pathlib-like interface for navigating and reading ZIP archives (zipp.Path), with new features introduced here first and later merged into CPython. Current version is 3.23.0, released June 2025, with a very active cadence of roughly one release per month maintained by Jason R. Coombs (jaraco).

Warnings

Install

Imports

Quickstart

Create an in-memory ZIP, wrap it with zipp.Path, iterate entries, read file content, and glob for files — all using a pathlib-style API.

import io
import zipfile
import zipp

# Build an in-memory zip
data = io.BytesIO()
with zipfile.ZipFile(data, 'w') as zf:
    zf.writestr('hello.txt', 'Hello, zipp!')
    zf.writestr('sub/world.txt', 'World!')
    zf.filename = 'example.zip'

# Navigate with zipp.Path (pathlib-style)
root = zipp.Path(data)
for item in root.iterdir():
    print(item.name, item.is_file())

# Read a nested file
file_path = root / 'hello.txt'
print(file_path.read_text())  # 'Hello, zipp!'

# Glob support
for txt in root.glob('**/*.txt'):
    print(txt)

view raw JSON →