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.

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.1.tar.gz (26.0 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.1-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for simple_zstd-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ff32999f7e3a52f7e76651a2078f95621dc956df78952058eb6bed95a5f23f21
MD5 9e8299be304304948e5f2f97d7ab57f5
BLAKE2b-256 e6335fbffe462edb18d24a74378e5c8940716380a5bd4c97cabc33404dc9ffdc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simple_zstd-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 576e46fbffa3953a6c966c5c677a77ffdd1f8fe8c09cbbb4172e99d322afe77a
MD5 11443b75b64df3ac7f0eaa8de6f7dd59
BLAKE2b-256 b502aafb5b7ce5db8ea41dffc33df280163e7609b37f207422211d7c5071611e

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