Skip to main content

serp-zlib

Compression for Serpentine: zlib-format, raw-DEFLATE and gzip streams, plus crc32/adler32 checksums. Runtime-backed ([R]): native builds use a self-contained DEFLATE implementation in the Serpentine runtime; under CPython the same imports delegate to the stdlib zlib/gzip modules.

from serp_zlib import compress, decompress, crc32

data: bytes = b"hello hello hello"
z: bytes = compress(data, 6)
print(decompress(z) == data)   # True
print(crc32(data))

API

  • crc32(data, value=0) / adler32(data, value=1) — running-checksum value like stdlib zlib.
  • compress(data, level=-1) (zlib format; -1 = default level 6) / decompress(data, wbits=15) — wbits routes the container: 15 zlib, -15 raw DEFLATE, 31 gzip.
  • deflate(data, level=-1) / inflate(data) — raw DEFLATE extras (used by serp-zipfile).
  • gzip_compress(data, level=-1) / gzip_decompress(data).
  • Constants: MAX_WBITS, DEFLATED, Z_DEFAULT_COMPRESSION, Z_BEST_COMPRESSION, Z_BEST_SPEED, Z_NO_COMPRESSION.

Levels are 0 (stored) through 9. Bad levels raise ValueError("Bad compression level"); corrupt streams raise ValueError("invalid compressed data") (CPython raises zlib.error). compressobj/decompressobj are not provided.

Divergence

Compressed output is a valid stream in both worlds and fully interoperable (each world decompresses the other's output), but the exact compressed bytes differ between CPython's zlib and the native runtime's encoder. Only roundtrips, decompressed content and checksums are world-identical.

Metadata

Release files for serp-zlib 0.1.0

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

Source distribution (sdist)

Source distribution for serp-zlib 0.1.0
File Size Uploaded
serp_zlib-0.1.0.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for serp-zlib 0.1.0
File Interpreter ABI Platform
serp_zlib-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / serp_zlib-0.1.0.tar.gz

Download URL serp_zlib-0.1.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
abc6a9e8f45c70ecf8ebc75f604880b8d070c80315739da7482fb857b9013df5
BLAKE2b-256 checksum
How to use checksums
029bb017bf59a4b64ccf352fa1f6049e16686fffb48002f03cb757656619d8b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / serp_zlib-0.1.0-py3-none-any.whl

Download URL serp_zlib-0.1.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1fe47c75a005d27f5b5040e91ab6282e254d1558432ae88aad1ce8333907ff42
BLAKE2b-256 checksum
How to use checksums
ca3af34893e07c15c27c822a34c805f9729d835f871052c6e141db7c1a1ee316
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

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