bizstd
An append-only container for records that arrive continuously and are read back in bulk.
pip install bizstd
A file is a fixed binary preamble, a text header zone edited in place, and a data section of independent zstd frames followed by an uncompressed tail. Records are appended to the tail as they arrive; when a period ends the tail is compressed into a frame. Both steps are crash-safe, and every frame carries a checksum.
Writing
import bizstd
schema = bizstd.Schema(
"samples@1",
[
bizstd.FieldSpec("time_nanos", "u64", 0),
bizstd.FieldSpec("value", "f64", 8),
],
bizstd.RecordLayout.fixed(16),
)
with bizstd.create("samples.bizstd", schema, source="sensor", writer="demo") as file:
for record in incoming:
file.append(record)
file.close_frame(0)
Reading
with bizstd.open_read("samples.bizstd") as file:
print(file.headers["_schema"], file.record_count)
for record in file:
...
Frames are addressed by position, not by id: ids belong to the writer and
writers repeat them. file.frame(0) is the first frame; file.frame_by_id(3)
is there for when you mean one particular frame.
Errors
Every failure is a subclass of BizstdError, and the subclasses are the
distinctions worth acting on:
| Exception | Means |
|---|---|
BizstdMalformedError |
the file is not a well-formed container |
BizstdUsageError |
the calling code asked for something it may not |
BizstdZoneFullError |
the header zone is full — repack with a larger one |
BizstdCompressionError |
zstd refused |
OSError |
the operating system said no |
Typing
Fully typed, py.typed in both packages, checked with mypy --strict. The
extension module ships hand-written stubs that a test compares against the real
module, so they cannot drift quietly.
Concurrency
One writer per file, and enforcing that is your job — nothing here takes a lock, and two writers on one path corrupt it silently. Readers are unrestricted among themselves.
Packages
bizstd is pure Python and depends on bizstd-binary, which is the compiled
extension and nothing else. The split means a platform without a prebuilt wheel
fails with a clear message instead of hunting for a compiler, and it means this
package can be read and patched without a build matrix.
MIT. Source, the format specification and the benchmarks behind the choice of zstd: https://github.com/aliaksandr-master/bizstd_rs
Release files for bizstd 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bizstd-2.1.0.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bizstd-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.1 kB
Release files / bizstd-2.1.0.tar.gz
| Download URL | bizstd-2.1.0.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5329b1312e95b9759fd0f278c97de7598da7cf6bad9a757a2ae1965a9af63e6f
|
|
BLAKE2b-256 checksum How to use checksums |
82ec4af93f136998e51c5f8dde13d23294279fc40b9e392480d42e48a4398bbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.12
|
Release files / bizstd-2.1.0-py3-none-any.whl
| Download URL | bizstd-2.1.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
767812d51c8bba972d14a92a70c0ea66e795941d8680db5ae4720125f4097298
|
|
BLAKE2b-256 checksum How to use checksums |
e2acd967fe8438da9ac4d022a962c3ccd0b905954c29bd9a2eb5ec6e89a19986
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.12
|