securetar
Python module to handle tarfile backups.
What it is and what it does
Secure Tar is a Python library that extends the standard tarfile module with encryption and secure file handling. It provides a streaming wrapper around tarfile that lets you create encrypted tar archives and handle file backups securely. The library supports both plain and encrypted archives, optional gzip compression, and a pattern for nesting multiple tar files within an outer tar container—all without writing intermediate files to disk.
The package depends on cryptography and PyNaCl for encryption operations and requires Python 3.11.0 or later. It's designed for backup workflows where you need to create encrypted archives programmatically, with a simple context-manager API that mirrors the standard tarfile interface. The library is actively maintained and has no known security vulnerabilities.
Use it for:
- Create encrypted backup archives of application data or configuration directories with a single API call.
- Build nested backup structures (outer tar containing multiple inner compressed tars) without intermediate file writes.
- Add file filtering during archive creation to exclude sensitive or temporary files from backups.
- Automate secure backup pipelines that require encryption without managing raw cryptography details.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Secure Tar wraps Python's tarfile module to add encryption and secure file handling for tar archives, supporting both unencrypted and encrypted backup creation with optional compression.
Yes. Secure Tar is a straightforward, actively maintained wrapper for encrypted tar backups with low install friction and no known vulnerabilities. Install it if you need to create encrypted tar archives in Python 3.11+ and want a simpler API than managing cryptography directly. The Apache-2.0 license poses no restrictions for most use cases.
Install
securetar on PyPI
pip
pip install securetaruv
uv add securetarpoetry
poetry add securetarInstalling securetar
Before you install
Low install friction with a pure-Python wheel. Active maintenance with a recent commit on 2026-07-29 and regular releases; currently at version 2026.4.1 released 2026-04-07.
License in practice
Apache-2.0 is permissive, allowing commercial and private use with minimal restrictions; you may use, modify, and distribute this package freely as long as you include the license notice.
Quickstart
pip install securetar
from securetar import SecureTarFile, atomic_contents_add
from pathlib import Path
with SecureTarFile("backup.tar", "w", b"AES128_KEY_SIZE") as tar:
atomic_contents_add(tar, Path("."), arcname=".")
Requires Python 3.11.0 or later; cryptography and PyNaCl must be installed as runtime dependencies.
Verify before relying
- Whether the encryption key size (e.g., 'AES128_KEY_SIZE') is validated or if arbitrary byte strings are accepted.
- Performance characteristics when handling large archives or streaming very large files.
- Whether atomic_contents_add supports recursive directory traversal by default or requires explicit configuration.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.11.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — cryptography, PyNaCl |
| Maintenance | actively maintained — 129 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 577,298/month — #5,925 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: securetar-2026.4.1-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
tarsafeTarsafe wraps Python's tarfile module to…
permissive · top 15,000 on PyPI
fastarFastar provides high-performance tar archive…
permissive · top 1,000 on PyPI
backports.tarfileProvides a backport of Python's tarfile module…
permissive · top 1,000 on PyPI
rpmfileInspect and extract files from RPM archive…
permissive · top 5,000 on PyPI
unix-arReads and writes AR archive files (Unix static…
permissive · top 5,000 on PyPI
tzsttzst creates and extracts tar archives…
permissive · top 15,000 on PyPI
android_backupUnpacks and repacks Android backup files (.ab…
permissive · top 15,000 on PyPI
pyunpackUnpacks archive files in Python with support…
permissive · top 15,000 on PyPI
sendsafelyIntegrates SendSafely secure file transfer and…
permissive · top 15,000 on PyPI
pyzipperpyzipper replaces Python's standard zipfile…
permissive · top 5,000 on PyPI