Skip to main content

python-archive

This package provides a simple, pure-Python interface for handling various archive file formats. Currently, archive extraction is the only supported action. Supported file formats include:

  • Zip formats and equivalents: .zip, .egg, .jar.

  • Tar and compressed tar formats: .tar, .tar.gz, .tgz, .tar.bz2, .tz2.

Example usage

Using the Archive class:

from archive import Archive
a = Archive('files.tar.gz')
a.extract()

Using the extract convenience function:

from archive import extract
# Extract in current directory.
extract('files.tar.gz')
# Extract in directory 'unpack_dir'.
extract('files.tar.gz', 'unpack_dir')

Note that calling extract with safe=True will ensure that the archive is safe prior to extraction: UnsafeArchive exception will be raised when archive contains paths which would be extracted outside of the target directory (e.g. absolute paths):

# Safely extract in directory 'unpack_dir'.
extract('files.tar.gz', 'unpack_dir', safe=True)

Similar tools

Metadata

Release files for Archive 0.3

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

Source distribution (sdist)

Source distribution for Archive 0.3
File Size Uploaded Provenance
Archive-0.3.tar.gz 10.1 kB Without provenance Details

Release files / Archive-0.3.tar.gz

Download URL Archive-0.3.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6ad0d68ea998a69fe2db54a07812b436c86aac4c39e78edabe3d4b09a1c19c86
BLAKE2b-256 checksum
How to use checksums
f737bf86a96c30477011b6a48fa82cfdf0e6a616314ad229a4544b59b70dfd2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for Archive 0.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.3 This release

1 release file No 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