Skip to main content

SimpleZstd

This library provides simple Pythonic interface of zstd algorithm like Python's builtin gzip library, by wrapping the zstandard library.

Further more, it provides builtin session support to take advantage of zstd's powerful training mode without additional user effort, by auto collecting training samples (10 by default) during compression/decompression.

In [1]: c = open("poetry.lock").read().encode("utf-8")

In [2]: len(c)
Out[2]: 73946

In [3]: from simple_zstd import compress, decompress

In [4]: for i in range(10):
   ...:     x = compress(c)
   ...:     print(len(x), len(x) / len(c))
   ...:     assert decompress(x) == c
   ...:
22259 0.3010169583209369
22259 0.3010169583209369
22259 0.3010169583209369
22259 0.3010169583209369
22259 0.3010169583209369
7123 0.09632704946853109
7123 0.09632704946853109
7123 0.09632704946853109
7123 0.09632704946853109
7123 0.09632704946853109

Note that user can also choose to have dedicated session instead of default one.

In [1]: c = open("poetry.lock").read().encode("utf-8")

In [2]: from simple_zstd import Session

In [3]: session = Session()

In [4]: x = session.compress(c)

In [5]: assert session.decompress(x) == c

For simpler usage, you can also just import zstd instead of simple_zstd.

Dictionary is exposed under session object. You need to store it for later decompression by passing when creating session.

Metadata

Release files for simple-zstd 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-zstd 0.1.2
File Size Uploaded
simple_zstd-0.1.2.tar.gz 27.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-zstd 0.1.2
File Interpreter ABI Platform
simple_zstd-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 31.1 kB

Release files / simple_zstd-0.1.2.tar.gz

Download URL simple_zstd-0.1.2.tar.gz
Size 27.8 kB
Tags Source
SHA-256 checksum
How to use checksums
49a0a295872a64389022fee1fde33f9d666be9bc4d69f700dc6209b9008f7332
BLAKE2b-256 checksum
How to use checksums
63aec0cffa260afc3335a934dd29c0a692f42b7c94f8e7ce79cd978fd70c6883
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.3

Release files / simple_zstd-0.1.2-py3-none-any.whl

Download URL simple_zstd-0.1.2-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
400287b5ef9d97db1eaf5ff165cd83877a8908134c3ba367d27c272d4da81cdb
BLAKE2b-256 checksum
How to use checksums
1af9192c1b22b876b6aba480ec6194331e2f1b210eaa4cbfc865d3c576ccf7ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page