Registry / serialization / fastar

fastar

JSON →
library0.9.0pypypi✓ verified 52d ago

The fastar library provides high-level Python bindings for the Rust `tar`, `flate2`, and `zstd` crates, offering a high-performance solution for working with compressed and uncompressed tar archives. It is currently at version 0.9.0 and has a consistent release cadence, with updates addressing features and underlying Rust library versions.

serializationdata
pip install fastar
Install & Compatibility
Where this runs
tested against v0.11.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.930 runs
installs and imports cleanly · install 0.0s · import 0.000s · 20.2MB
glibc
py 3.103.930 runs
installs and imports cleanly · install 1.7s · import 0.000s · 20MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fastar
import fastar
The primary way to interact with the library is through the top-level 'fastar' module.

This quickstart demonstrates how to create a simple text file, add it to an uncompressed tar archive using `fastar.open` in write mode, and then extract its contents using read mode. It highlights the basic `append` and `unpack` operations.

from pathlib import Path import fastar import os # Create a dummy file input_file = Path("file.txt") input_file.write_text("Hello, Fastar!") # Create a tar archive (uncompressed) with fastar.open("archive.tar", "w") as archive: archive.append(input_file) # Extract the tar archive output_dir = Path("output") output_dir.mkdir(exist_ok=True) with fastar.open("archive.tar", "r") as archive: archive.unpack(output_dir) unpacked_file = output_dir / "file.txt" print(f"Unpacked file content: {unpacked_file.read_text()}") # Clean up (optional) input_file.unlink() Path("archive.tar").unlink() output_dir.rmdir()
Debug
Known issues
breakingVersions prior to 0.9.0 may contain security vulnerabilities (CVE-2026-32766 and CVE-2026-33056) inherited from underlying Rust crates like `rust-tar`.
fix
Upgrade to fastar version 0.9.0 or later to ensure these security fixes are applied: `pip install --upgrade fastar`.
affects: <0.9.0
gotchaThe `fastar.open` method supports various modes for compression (`w`, `w:gz`, `w:zst`, `r`, `r:`, `r:gz`, `r:zst`). Using the wrong mode for a compressed archive can lead to errors or corrupted data.
fix
Always explicitly specify the compression mode (e.g., 'w:gz' for gzip, 'w:zst' for Zstandard) when creating compressed archives, or use 'r' for automatic detection when reading.
affects: All versions
gotchaAfter extracting archives with `fastar`, attempting to remove the target directory with `pathlib.Path.rmdir()` will fail if the directory is not empty. This commonly happens if extracted files or subdirectories remain.
fix
To safely remove directories that may contain extracted files, use `shutil.rmtree(path)` for recursive deletion instead of `pathlib.Path.rmdir()`, or ensure all individual files are deleted prior to calling `rmdir()`.
affects: All versions
gotchaWhen using `fastar` to extract content into a directory, users should be aware that standard Python functions like `pathlib.Path.rmdir()` will fail if the directory is not empty. This is expected behavior for `rmdir()`. To reliably remove directories that `fastar` has populated with files, `shutil.rmtree()` should be used instead.
fix
Use `shutil.rmtree(path)` from the `shutil` module instead of `path.rmdir()` to remove directories after `fastar` has extracted content into them.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'fastar'
The 'fastar' library is not installed in the Python environment where the code is being executed.
fix
Install the library using pip: `pip install fastar`
FileNotFoundError: [Errno 2] No such file or directory: 'non_existent_archive.tar'
The specified archive file or output directory for a 'fastar' operation does not exist at the given path.
fix
Verify that the archive file exists at the provided path, or ensure the target directory for extraction or creation is correct. Use absolute paths or confirm the current working directory.
PermissionError: [Errno 13] Permission denied: 'output_directory'
The program lacks the necessary file system permissions to read the source archive, or to create/write files or directories at the specified destination using 'fastar'.
fix
Adjust the file system permissions for the relevant files or directories, or run the Python script with appropriate elevated privileges.
ValueError: Invalid compression mode 'wx' given. Please use one of 'w', 'w:gz', 'w:zst', 'r', 'r:gz', 'r:zst'.
An unsupported or incorrectly formatted compression mode string was provided to the `fastar.open()` method.
fix
Use a valid compression mode, such as 'w' for uncompressed writing, 'w:gz' for gzip compressed writing, or 'r' for reading with automatic compression detection, as documented.
Upgrade
Version history
0.11.0latest on PyPI
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
6
seranking-bot
4
ahrefsbot
3
Meta
1
amazonbot
1
Resources