Skip to main content

archivey

CI

Python library for reading, streaming, and safely extracting archives (ZIP, TAR, RAR, 7z, ISO, and more) through a unified interface.

Features

  • One interface for every format: ZIP, TAR (plain or compressed with gzip, bzip2, xz, zstd, lz4 or Unix compress), 7z, RAR, ISO 9660, plain directories, and single-file streams (gzip, bzip2, xz, lzip, LZMA, zstd, lz4, zlib, Brotli, Unix compress). List members, read one, or stream them all in one pass, the same way for each.
  • Automatic format detection from the file's content, so a misnamed file still opens.
  • Safe extraction by default: path traversal, symlink and hardlink escapes, special files and archive bombs are blocked unless you opt out.
  • Resource limits on listing size, decoder memory, password key-derivation work and temporary files, so a hostile archive fails with ResourceLimitError instead of exhausting the machine.
  • Verified reads: a member whose stored checksum fails raises CorruptionError, and the bad chunk is withheld. Reading past a truncation raises TruncatedError. Integrity errors come from reads, never from close().
  • Built for streaming: stream_members() hands out each member as a stream, in archive order and in one pass, so a solid 7z or RAR is decoded once and a large member is read in chunks rather than held in memory. TAR, ZIP and the single-file formats also read straight from a pipe.
  • Encrypted archives: ZipCrypto and WinZip AES in ZIP, AES in 7z, and RAR encryption.
  • Native 7z and RAR metadata readers. 7z data decodes in-process; RAR data needs RARLAB unrar or rar, or unar.
  • Zero-dependency core for ZIP, TAR, 7z with the common codecs, RAR listing, directories and the standard-library codecs, plus an archivey command for listing, testing and extracting from the shell.
  • Tested on Python 3.11 to 3.14 on Linux, and on 3.11 and 3.14 on macOS and Windows.

The API is not frozen until 1.0, but no major changes are expected.

Install and use

pip install archivey                 # zero-dependency core
pip install "archivey[recommended]"  # every format and codec that installs everywhere
import archivey

# Extract safely: traversal, link escapes and bombs are blocked by default.
with archivey.open_archive("untrusted.zip") as reader:
    reader.extract_all("out/")

# List and read members, whatever the format.
with archivey.open_archive("photos.tar.gz") as reader:
    for member, stream in reader.stream_members():
        if member.is_file:
            print(member.name, len(stream.read()))

Documentation

https://davitf.github.io/archivey/

The cheat sheet has the main calls, their errors and the zipfile and tarfile equivalents on one page. Coding agents can read the docs as Markdown, starting from llms.txt, or all in one file from llms-full.txt.

Install · Opening an archive · Choosing how to read · Extracting · Security · Formats and extras · Migrating from other libraries · API reference

How it is built

Almost all of archivey's code, tests and documentation are written by AI coding agents (Claude Code and Cursor). The maintainer designs the library, makes the decisions, directs the work and reviews the code, especially the architecture and the tricky parts. Changes are tested on Linux, macOS and Windows and reviewed by a separate AI session that reads them from zero, and several reviews of the whole codebase hunt for bugs, unclear or dead code, and API problems. If you are wary of AI-written code, that is reasonable: How it is built says how changes are made and checked, and what the process does not promise.

Contributing and security

  • CONTRIBUTING.md — coding / testing standards
  • VISION.md — priorities and trade-offs; authoritative contracts live in openspec/specs/
  • SECURITY.md — private vulnerability reporting

Metadata

Release files for archivey 0.2.0

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

Source distribution (sdist)

Source distribution for archivey 0.2.0
File Size Uploaded Provenance Actions
archivey-0.2.0.tar.gz 1.2 MB With provenance Details for archivey-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 2.5 MB

Release files / archivey-0.2.0.tar.gz

Download URL archivey-0.2.0.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
45e0112a191af273adb963fb69fdadc2de4193549bb8b059d5591a96aff9b533
BLAKE2b-256 checksum
How to use checksums
bbf636aeb1ca3e43ce88ba2232c7e0683c2ea0b5f31941318f2343d70f7263d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / archivey-0.2.0-py3-none-any.whl

Download URL archivey-0.2.0-py3-none-any.whl
Size 1.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
eddc49758a55b91688587afa0ce4da55150d039a8e41295e753064393f4b3920
BLAKE2b-256 checksum
How to use checksums
bd0616b2458f1462772250a9cfd4dc9dc4a390418ad2c5ea1f8393a16295897d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for archivey 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for archivey-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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