libarchive-c
Python interface to libarchive
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-cuv
uv add libarchive-cpoetry
poetry add libarchive-cInstalling 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
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
extractcodeExtracts a wide range of archive formats (tar,…
permissive · top 15,000 on PyPI
py7zrpy7zr is a pure-Python library for reading,…
copyleft · top 5,000 on PyPI
pyunpackUnpacks archive files in Python with support…
permissive · top 15,000 on PyPI
rarfileReads RAR archive files (RAR3 and RAR5 formats)…
permissive · top 5,000 on PyPI
arParses and reads ar archive files (.a),…
permissive · top 15,000 on PyPI
extractcode-libarchiveProvides a prebuilt native libarchive binary as…
permissive · top 15,000 on PyPI
unrarProvides Python access to RAR archive files…
copyleft · top 15,000 on PyPI
tzsttzst creates and extracts tar archives…
permissive · top 15,000 on PyPI
arpyArpy reads and extracts files from ar archives…
permissive · top 15,000 on PyPI
harfileWrites HTTP Archive (HAR) files in Python with…
permissive · top 5,000 on PyPI