A wrapper around tarfile which is deliberatly limited and simple. The package sequential_tar is meant to ease the writing and reading of tarfiles where the payload of the files within the tarfile is maent to go through the program’s memory. Here, only regular files can be written to a tarfile and blocks different from regular files are ignored while reading. This package is a good start when one plans to use tarfiles as containers for programs to read data from directly into their memory without seeking or the creation of temporary files.
modes
When writing the next file to the tarfile, one can set the mode to choose either text "t" or binary "b". Further a compression can be applied by adding "|gz" to the mode. In the same manner, a mode can be set when reading a file from the tarfile. This way, possible decompression and text/binary conversions can be taken care of with just a few characters in the mode parameter.
import sequential_tar as seqtar import os path = "test.tar"
Set the mode for each file while writing to the tarfile.
with seqtar.open(path, "w") as tar:
tar.write(
name="1.txt",
payload="I am text number 1.",
mode="wt",
)
tar.write(
name="2.txt.gz",
payload="I am text number 2.",
mode="wt|gz",
)
tar.write(
name="3.bin.gz",
payload=b"0123456789",
mode="wb|gz",
)
tar.write(
name="4.bin",
payload=b"123-123-123-123-123-123-123",
mode="wb",
)
Set the mode for each file while reading from the tarfile.
with seqtar.open(path, "r") as tar:
item = next(tar)
assert item.name == "1.txt"
assert item.read(mode="rt") == "I am text number 1."
item = next(tar)
assert item.name == "2.txt.gz"
assert item.read(mode="rt|gz") == "I am text number 2."
item = next(tar)
assert item.name == "3.bin.gz"
assert item.read(mode="rb|gz") == b"0123456789"
item = next(tar)
assert item.name == "4.bin"
assert item.read(mode="rb") == b"123-123-123-123-123-123-123"
Metadata
Release files for sequential-tar 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sequential_tar-0.0.4.tar.gz | 4.4 kB | Without provenance | Details for sequential_tar-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sequential_tar-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for sequential_tar-0.0.4-py3-none-any.whl |
Total release size: 9.1 kB
Release files / sequential_tar-0.0.4.tar.gz
| Download URL | sequential_tar-0.0.4.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53f99cfe7c6790ae850e7db3a0d14def945093d80059809821a4be56276a4e3c
|
|
BLAKE2b-256 checksum How to use checksums |
84d12b41419e1c5862c5300b5fd0c2379befa0e422fad581541cd2d9c4db816a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.5
|
Release files / sequential_tar-0.0.4-py3-none-any.whl
| Download URL | sequential_tar-0.0.4-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12f6ee4edf591bb0112c49e23bf4c0c4c1ae829337b2a9b742d5a31ed04afd1f
|
|
BLAKE2b-256 checksum How to use checksums |
cd3873da7d67a75170cb6c39cf994a3c2262aa1732e2ab1a02638ebc461a4bf4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.5
|
Security for sequential-tar 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.