skillfed

securetar

Python module to handle tarfile backups.

securetar v2026.4.1 577.3K downloads/30d#5,925 on PyPI13
Permissive license Apache-2.0 Active released

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 securetar

uv

uv add securetar

poetry

poetry add securetar

Installing 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

Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Software Development :: Libraries :: Python Modules

Tags

encrypted tar archivesecure tarfile backupencrypted file backup pythontar encryption wrappersecure tar streamingencrypted backup library
encryptionbackuparchive

More Python Modules packages