Skip to main content

No project description provided

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_zstd-0.1.2.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_zstd-0.1.2-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file simple_zstd-0.1.2.tar.gz.

File metadata

  • Download URL: simple_zstd-0.1.2.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.3

File hashes

Hashes for simple_zstd-0.1.2.tar.gz
Algorithm Hash digest
SHA256 49a0a295872a64389022fee1fde33f9d666be9bc4d69f700dc6209b9008f7332
MD5 dfff28c114abd6ae5115714a4d3396b4
BLAKE2b-256 63aec0cffa260afc3335a934dd29c0a692f42b7c94f8e7ce79cd978fd70c6883

See more details on using hashes here.

File details

Details for the file simple_zstd-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_zstd-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 400287b5ef9d97db1eaf5ff165cd83877a8908134c3ba367d27c272d4da81cdb
MD5 4fd1d60a34a15fa845d3d94100fced87
BLAKE2b-256 1af9192c1b22b876b6aba480ec6194331e2f1b210eaa4cbfc865d3c576ccf7ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page