{"id":27126,"library":"lz4tools","title":"LZ4 Tools","description":"Python bindings and tools for LZ4 compression, providing LZ4Frame compression/decompression utilities. Current version 1.3.1.2, released 2019-10-30. Last uploaded 2020-10-20. Low release cadence, effectively in maintenance mode.","status":"maintenance","version":"1.3.1.2","language":"python","source_language":"en","source_url":"https://github.com/darkdragn/lz4file","tags":["compression","lz4","library","python"],"install":[{"cmd":"pip install lz4tools","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"lz4tools is a separate package from lz4. Do not confuse with the 'lz4' package.","wrong":"from lz4.frame import LZ4Frame","symbol":"LZ4Frame","correct":"from lz4tools import LZ4Frame"},{"note":"LZ4File is the main utility class.","symbol":"LZ4File","correct":"from lz4tools import LZ4File"},{"note":"compress is a top-level function, not a module attribute.","wrong":"import lz4tools; lz4tools.compress()","symbol":"compress","correct":"from lz4tools import compress"}],"quickstart":{"code":"from lz4tools import compress, decompress, LZ4Frame\n\n# Compress bytes\ndata = b\"Hello, LZ4!\"\ncompressed = compress(data)\nprint(f\"Compressed: {compressed}\")\n\n# Decompress\ndecompressed = decompress(compressed)\nprint(f\"Decompressed: {decompressed}\")\n\n# Using LZ4Frame context\nframe = LZ4Frame()\npacked = frame.compress(data)\nunpacked = frame.decompress(packed)\nprint(f\"Frame roundtrip: {unpacked}\")","lang":"python","description":"Basic compression and decompression using package-level functions and the LZ4Frame class. Ensure you have the data as bytes."},"warnings":[{"fix":"Use 'from lz4tools import LZ4Frame' instead of 'from lz4.frame import LZ4Frame'.","message":"The package lz4tools is NOT the same as lz4 (python-lz4). Importing from lz4.frame will use a different library with incompatible format.","severity":"breaking","affected_versions":"all"},{"fix":"For new projects, prefer 'pip install lz4' and use 'from lz4.frame import LZ4Frame'.","message":"Library has not been updated since 2019. There is no active development. Consider using 'lz4' (python-lz4) for better performance and maintenance.","severity":"deprecated","affected_versions":">=1.3.0"},{"fix":"Encode strings to bytes before compression: data.encode('utf-8').","message":"The 'compress' and 'decompress' functions work only with bytes, not strings. Passing a str will raise TypeError.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install lz4tools: pip install lz4tools. Then import from lz4tools: from lz4tools import LZ4Frame.","cause":"Installed the wrong package: 'lz4' instead of 'lz4tools'. Or tried to import from 'lz4' package.","error":"ImportError: cannot import name 'LZ4Frame' from 'lz4'"},{"fix":"Encode your string: compress(data.encode('utf-8')).","cause":"Passing a string to compress/decompress functions which expect bytes.","error":"TypeError: a bytes-like object is required, not 'str'"},{"fix":"Run: pip install lz4tools. Or if using a virtualenv, ensure it is activated.","cause":"Package not installed or installed in different environment.","error":"ModuleNotFoundError: No module named 'lz4tools'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}