Skip to main content

(former python-lz4)

https://travis-ci.org/sigman78/python-lz4.svg?branch=master

Overview

This package provides bindings for the lz4 compression library by Yann Collet.

Code specific to this project is covered by the BSD 3-Clause License

Install

The package is hosted on PyPI:

$ pip install lz4
$ easy_install lz4

Usage

The library is pretty simple to use:

>>> import lz4
>>> compressed_data = lz4.dumps(data)
>>> data == lz4.loads(compressed_data)
True
>>>

Methods and Constants

The bindings provides some aliases too:

>>> import lz4
>>> lz4.LZ4_compress == lz4.compress == lz4.dumps
True
>>> lz4.LZ4_uncompress == lz4.uncompress == z4.decompress == lz4.loads
True
>>> lz4.VERSION == lz4.__version__  # e.g. "0.7.0"
True
>>>

Is it fast ?

Yes. Here are the results on my 2011 Macbook Pro i7 with lz4.c as input data:

$ python tests/bench.py
Data Size:
  Input: 24779
  LZ4: 10152 (0.41)
  Snappy: 9902 (0.40)
  LZ4 / Snappy: 1.025247
Benchmark: 200000 calls
  LZ4 Compression: 9.737272s
  Snappy Compression: 18.012336s
  LZ4 Decompression: 2.686854s
  Snappy Decompression : 5.146867s

Important note

Because LZ4 doesn’t define a container format, the python bindings will insert the original data size as an integer at the start of the compressed payload, like most bindings do anyway (Java…)

Release files for lz4ext 0.7.4

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

Source distribution (sdist)

Source distribution for lz4ext 0.7.4
File Size Uploaded
lz4ext-0.7.4.zip 34.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lz4ext 0.7.4
File Interpreter ABI Platform
lz4ext-0.7.4-cp27-none-win32.whl CPython 2.7 none Windows x86-32 Details

Total release size:51.2 kB

Release files / lz4ext-0.7.4.zip

Download URL lz4ext-0.7.4.zip
Size 34.3 kB
Tags Source
SHA-256 checksum
How to use checksums
034b97275238c479b733fc30e7bc1133389ee60066be657df6b6e3d0aae7c29a
BLAKE2b-256 checksum
How to use checksums
68ba8c8eecf20f3198eeb78bd4cda7bdeb5d0b29f84972920f3d65f88bd63b18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / lz4ext-0.7.4-cp27-none-win32.whl

Download URL lz4ext-0.7.4-cp27-none-win32.whl
Size 16.9 kB
Tags CPython 2.7 Windows x86-32
SHA-256 checksum
How to use checksums
df142411aeab3b9cc838339199fb0c47d86231c2a8ae162c5ab3be26cabac50c
BLAKE2b-256 checksum
How to use checksums
331469cca71a3208fcac1b2fa118e7dbd9115b65a9c0464f066b1cc5d6440c30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.7.4 This release

2 release files

0.7.3

2 release files

0.7.2

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