fastar

High-performance Python tar archives powered by Rust

Library
PyPI
v0.11.0
34stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
45/100Fair
Development Activity52
Maintenance56
Community20
Maturity32
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
75/100Good
Architecture78
Code Quality76
Innovation70
Learning Curve86

fastar is a Python library that provides high-level bindings to the Rust tar, flate2, and zstd crates, giving you a fast way to create and extract tar archives — with optional gzip or zstandard compression — from Python. Its API deliberately echoes the standard library’s tarfile, with a fastar.open() context manager and append/unpack methods.

Because the heavy lifting happens in compiled Rust, fastar delivers strong throughput while keeping a small, dependency-free Python surface. It ships prebuilt wheels for CPython and PyPy across a wide range of Python versions, so most users can pip install fastar and start archiving without a toolchain.

What You Get

  • A fastar.open() context manager mirroring the standard tarfile interface
  • append and unpack methods for writing and extracting archives
  • Write modes for uncompressed (w), gzip (w:gz), and zstandard (w:zst) archives
  • Automatic compression detection on read
  • Prebuilt wheels for CPython and PyPy with a bundled type stub (fastar.pyi)

Common Use Cases

  • Creating and extracting tar archives faster than pure-Python tarfile
  • Producing gzip- or zstandard-compressed tarballs from Python
  • Packaging project files for upload or distribution (as used by deploy tooling)
  • High-throughput archive workloads where Python’s GIL-bound tar handling is a bottleneck

Under The Hood

Architecture - fastar is a native extension: the Python-facing API is a thin layer over a Rust core in src/, split into lib.rs (module + open entrypoint), reader.rs and writer.rs (the archive read/write objects exposed to Python), and errors.rs (exception mapping). A single fastar.pyi stub describes the typed surface to Python consumers. The Rust side delegates to the tar, flate2, and zstd crates for the actual archive and compression work.

Tech Stack - A Rust extension module (built via a Cargo project with Cargo.toml/Cargo.lock) bound to Python, with zero Python runtime dependencies. It targets Python 3.8+ and ships wheels for both CPython and PyPy; performance is tracked with CodSpeed benchmarking in CI.

Code Quality - The project is small but disciplined: it carries a typed stub, a tests/ directory that doubles as usage documentation, and continuous performance benchmarking. Rust ownership handles resource cleanup, and errors are surfaced as proper Python exceptions via errors.rs.

API Design - The public API intentionally mirrors the standard-library tarfilefastar.open(path, mode) as a context manager plus append/unpack — so the learning curve is minimal, and compression is selected through the familiar w:gz/w:zst mode strings. The README’s runnable example gets a user productive immediately.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search