Skip to main content
https://travis-ci.org/Changaco/python-libarchive-c.svg

A Python interface to libarchive. It uses the standard ctypes module to dynamically load and access the C library.

Installation

pip install libarchive-c

Compatibility

python

python-libarchive-c is currently tested with python 3.6, 3.7, 3.8, and 3.9.

If you find an incompatibility with older versions you can send us a small patch, but we won’t accept big changes.

libarchive

python-libarchive-c may not work properly with obsolete versions of libarchive such as the ones included in MacOS. In that case you can install a recent version of libarchive (e.g. with brew install libarchive on MacOS) and use the LIBARCHIVE environment variable to point python-libarchive-c to it:

export LIBARCHIVE=/usr/local/Cellar/libarchive/3.3.3/lib/libarchive.13.dylib

Usage

Import:

import libarchive

To extract an archive to the current directory:

libarchive.extract_file('test.zip')

extract_memory extracts from a buffer instead, and extract_fd extracts from a file descriptor.

To read an archive:

with libarchive.file_reader('test.7z') as archive:
    for entry in archive:
        for block in entry.get_blocks():
            ...

memory_reader reads from a memory buffer instead, and fd_reader reads from a file descriptor.

To create an archive:

with libarchive.file_writer('test.tar.gz', 'ustar', 'gzip') as archive:
    archive.add_files('libarchive/', 'README.rst')

memory_writer writes to a memory buffer instead, fd_writer writes to a file descriptor, and custom_writer sends the data to a callback function.

You can also find more thorough examples in the tests/ directory.

License

CC0 Public Domain Dedication

Metadata

Release files for libarchive-c 3.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 libarchive-c 3.0
File Size Uploaded
libarchive-c-3.0.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for libarchive-c 3.0
File Interpreter ABI Platform
libarchive_c-3.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 23.3 kB

Release files / libarchive-c-3.0.tar.gz

Download URL libarchive-c-3.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6f12fa9cf0e44579e5f45bbf11aa455a930fbfdb13ea0ce3c3dfe7b9b9a452ba
BLAKE2b-256 checksum
How to use checksums
af3f2f1147f1ef538f282340daa6109093d46c7287699d3a10c7f359b916dc7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release files / libarchive_c-3.0-py2.py3-none-any.whl

Download URL libarchive_c-3.0-py2.py3-none-any.whl
Size 12.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b0cbb7d838c58359e8bdba619c45e3e12369d185bffe86474bfb3f01d16ac234
BLAKE2b-256 checksum
How to use checksums
8ec882f86aadaa9fbca630d562185b2ed89e1d63e2fd3317a6b54591351424c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release history Release notifications | RSS feed

5.3

2 release files

5.2

2 release files

5.1

2 release files

5.0

2 release files

4.0

2 release files

3.2

2 release files

3.1

2 release files

This release

3.0 This release

2 release files

2.9

2 release files

2.8

2 release files

2.7

2 release files

2.6

2 release files

2.5

2 release files

2.4

2 release files

2.3

2 release files

2.2

2 release files

2.1

2 release files

2.0

2 release files

1.1

2 release files

1.0

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