Skip to main content

Python bindings for the ARCX archive format — fast selective extraction

Project description

arcx

Python bindings for the ARCX archive format. Native Rust speed via PyO3.

Install

pip install arcx

Build from source

Requires Rust toolchain and maturin:

pip install maturin
maturin develop --release

Usage

Pack a directory

import arcx

arcx.pack("my_project/", "my_project.arcx")

Get a single file

data = arcx.get("archive.arcx", "src/main.rs")
print(len(data), "bytes")

List files

files = arcx.list("archive.arcx")
for f in files:
    print(f["path"], f["size"], f["sha256"])

Extract all files

arcx.extract("archive.arcx", "output_dir/")

Archive info

info = arcx.info("archive.arcx")
print(f"{info['files']} files, {info['blocks']} blocks, ratio={info['ratio']:.1%}")

Archive class (context manager)

For multiple operations on the same archive, use the Archive class to keep the manifest cached in memory:

with arcx.Archive("archive.arcx") as ar:
    data = ar.get("src/main.rs")
    files = ar.list()
    ar.extract("output/")
    info = ar.info()

API Reference

Functions

Function Description
arcx.pack(input_dir, output) Pack a directory into an .arcx archive
arcx.get(archive, file_path) -> bytes Extract a single file as bytes
arcx.list(archive) -> list[dict] List files (each dict has path, size, sha256)
arcx.extract(archive, output_dir) Extract all files to a directory
arcx.info(archive) -> dict Archive metadata (files, blocks, chunks, ratio, etc.)

Archive class

Method Description
Archive(path) Open an archive (use as context manager)
.get(file_path) -> bytes Extract a single file
.list() -> list[dict] List all files
.extract(output_dir) Extract all files
.info() -> dict Archive metadata

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

getarcx-0.1.0-cp311-cp311-win_amd64.whl (464.4 kB view details)

Uploaded CPython 3.11Windows x86-64

File details

Details for the file getarcx-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: getarcx-0.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 464.4 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for getarcx-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 96b7c83e78e28dc559b6192b19fc9565cec00baebff004f72b79edb4607d374e
MD5 4a134b522f0c161cf32b83182b9f1ffa
BLAKE2b-256 f183e7c714bc5da58182fb787b1b4fd251a251405f3c47bfa913fa7690b40b81

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page