Python module to handle tarfile backups.
Project description
Secure Tar
Secure Tarfile library
It's a streaming wrapper around python tarfile and allow secure handling files and support encryption.
from securetar import SecureTarFile, atomic_contents_add
from pathlib import Path
path_to_add = Path(".")
with SecureTarFile("test.tar", "w") as tar_file:
atomic_contents_add(
tar_file,
path_to_add,
file_filter=lambda _: False,
arcname=".",
)
with SecureTarFile("test.tar", "w", b"AES128_KEY_SIZE") as tar_file:
atomic_contents_add(
tar_file,
path_to_add,
file_filter=lambda _: False,
arcname=".",
)
A common pattern is to create an outer uncompressed tarfile that contains a variety of inner tar files. This can be accomplished without writing out multiple files with the following pattern.
from securetar import SecureTarFile, atomic_contents_add
from pathlib import Path
path_1 = Path("path1")
path_2 = Path("path2")
outer_secure_tar_file = SecureTarFile("pkg.tar", "w", gzip=False)
with outer_secure_tar_file as outer_tar_file:
with outer_secure_tar_file.create_inner_tar(
"./backup1.tar.gz", gzip=True
) as inner_tar_file:
atomic_contents_add(
inner_tar_file,
path_1,
file_filter=lambda _: False,
arcname=".",
)
with outer_secure_tar_file.create_inner_tar(
"./backup2.tar.gz", gzip=True
) as inner_tar_file:
atomic_contents_add(
inner_tar_file,
path_2,
file_filter=lambda _: False,
arcname=".",
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file securetar-2025.12.0.tar.gz.
File metadata
- Download URL: securetar-2025.12.0.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3193a4af88b2e2a4a67213b25320f6970dd69d60dd2d649a2d967c7d179b48e
|
|
| MD5 |
92d1fe9df54ea1d55e9adff001fbd458
|
|
| BLAKE2b-256 |
d8d534cba360b6cc410af19874402bcc11e555292d2dbabc6562635fb057d8b0
|
File details
Details for the file securetar-2025.12.0-py3-none-any.whl.
File metadata
- Download URL: securetar-2025.12.0-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87a1798912e9dcb4116c4b6629cb6f0a553599a9af28d7ef65fb59f86531815d
|
|
| MD5 |
d89c255981e8ed8178d776ec3e2bc655
|
|
| BLAKE2b-256 |
b61eba75b86777b6d6febddb039b06ba81b8b987fdd06b3727148f30aeb160ed
|