skillfed

libarchive-c

Python interface to libarchive

libarchive-c v5.3 396.8K downloads/30d#6,968 on PyPI84
Permissive license CC0 AGING released

What it is and what it does

libarchive-c is a thin ctypes wrapper around the libarchive C library, exposing archive operations to Python without requiring compiled extensions. It lets you extract, read, and create archives in multiple formats—tar, zip, 7z, bz2, gz—by calling Python functions that delegate to the underlying C library.

The package is designed for straightforward archive manipulation: extract files to disk, iterate over archive contents and read blocks, or build new archives from files and in-memory data. It supports reading from files, file descriptors, memory buffers, or custom callbacks, and writing to similar destinations. You can control extraction security flags, preserve or resolve symbolic links, and specify metadata codecs for non-UTF-8 filenames.

Use it for:

  • Extract multi-format archives (zip, tar, 7z) in a single codebase without format-specific libraries
  • Read archive contents without extracting to disk, iterating over entries and blocks for streaming processing
  • Create tar or zip archives programmatically with custom metadata, permissions, and timestamps
  • Handle archives in memory buffers or from file descriptors rather than files on disk
  • Process large archives with progress tracking using the bytes_read attribute

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

libarchive-c provides a Python interface to libarchive, a C library for reading, writing, and extracting archives in formats including tar, zip, 7z, and others via ctypes bindings.

Yes. libarchive-c is a solid, permissively licensed wrapper with no runtime Python dependencies, low install friction, and broad archive format support. It's aging but actively maintained and carries no known vulnerabilities. Install it if you need multi-format archive handling and are comfortable with the system libarchive dependency.

Install

libarchive-c on PyPI

pip

pip install libarchive-c

uv

uv add libarchive-c

poetry

poetry add libarchive-c

Installing libarchive-c

Before you install

Installation is straightforward with no runtime dependencies beyond the system libarchive library. The package is aging (last release 449 days ago) but remains actively maintained with recent commits; compatibility is tested against Python 3.12 and 3.13.

License in practice

Released under CC0 Public Domain Dedication, placing it in the permissive category with no restrictions on use, modification, or redistribution.

Quickstart

pip install libarchive-c

import libarchive

# Extract an archive
os.chdir('/path/to/target')
libarchive.extract_file('test.zip')

# Read an archive
with libarchive.file_reader('test.tar.gz') as archive:
    for entry in archive:
        print(entry.pathname)

Requires libarchive system library to be installed and accessible; on macOS with obsolete versions, set LIBARCHIVE environment variable to point to a recent installation.

Verify before relying

  • Whether performance is acceptable for very large archives or high-throughput scenarios
  • Completeness of support for all libarchive features and edge cases in the Python wrapper

Package facts

License CC0 (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 449 days since the last release
Last repo commit
First released
Downloads 396,790/month — #6,968 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: libarchive_c-5.3-py3-none-any.whl

Keywords: archive, libarchive, 7z, tar, bz2, zip, gz

Tags

archive extraction pythontar zip 7z reader writerlibarchive python bindingsread write archivesmulti-format archive handling
archive-formatsctypes-binding

More Software Development packages