skillfed

ncompress

LZW compression and decompression

ncompress v1.0.2 177.2K downloads/30d#10,218 on PyPI4
Permissive license This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a… (full text in the JSON record) DORMANT released

What it is and what it does

ncompress is a Python binding to LZW compression, ported from the classic (N)compress CLI tool. It exposes two main functions—compress() and decompress()—that work with either raw bytes or BytesIO objects, returning compressed or decompressed data respectively. The library is implemented in C++ with Python bindings, offering a direct port of the original compress algorithm with minimal changes.

The package has no runtime dependencies and ships as pre-compiled wheels for Python 3.8+ across macOS, Linux, and Windows on multiple architectures. It's designed for straightforward use: pass data in, get compressed or decompressed output back. The BytesIO variants are slightly faster because they avoid an intermediate copy during bytes-to-string conversion.

Use it for:

  • Compress or decompress data using the classic LZW algorithm when compatibility with (N)compress format is needed.
  • Integrate LZW compression into Python applications without external CLI tool dependencies.
  • Process large BytesIO streams with minimal memory overhead by using the BytesIO-based compress/decompress functions.
  • Archive or transmit data using a well-established, lossless compression format.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides LZW compression and decompression functions that accept bytes or BytesIO objects and return compressed or decompressed data.

Yes, if you need LZW compression specifically or must work with (N)compress-compatible data. The permissive license, zero runtime dependencies, and broad platform support make it low-friction to add. However, maintenance is dormant (last release 927 days ago), so consider whether you need active support or would prefer a more actively maintained compression library for general-purpose use.

Install

ncompress on PyPI

pip

pip install ncompress

uv

uv add ncompress

poetry

poetry add ncompress

Installing ncompress

Before you install

Medium install friction due to compiled wheels; however, wheels are pre-built for Python 3.8+ across all major platforms and architectures, making installation straightforward. Maintenance is dormant—last release was 927 days ago, though the repository remains active.

License in practice

Released under the Unlicense (public domain dedication) with permissive treatment, meaning you can use, modify, and distribute it freely with no restrictions. A small portion (BytesIO wrapper) is adapted from cctbx under the Lawrence Berkeley National Labs BSD variant license; see the source file for details.

Quickstart

pip install ncompress

from ncompress import compress, decompress

original = b'hello world'
compressed = compress(original)
decompressed = decompress(compressed)

Requires Python 3.8 or later.

Verify before relying

  • Performance characteristics compared to other LZW or general-purpose compression libraries in typical use cases.
  • Whether the 15% speed advantage of BytesIO-based functions over bytes conversion is significant for your data sizes.

Package facts

License This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.8)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance dormant — 927 days since the last release
Last repo commit
First released
Downloads 177,236/month — #10,218 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ncompress-1.0.2-cp310-cp310-macosx_10_14_universal2.whl; ncompress-1.0.2-cp310-cp310-macosx_10_14_x86_64.whl; ncompress-1.0.2-cp310-cp310-macosx_11_0_arm64.whl; ncompress-1.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; ncompress-1.0.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl; ncompress-1.0.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; ncompress-1.0.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl; ncompress-1.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; ncompress-1.0.2-cp310-cp310-musllinux_1_1_aarch64.whl; ncompress-1.0.2-cp310-cp310-musllinux_1_1_i686.whl; ncompress-1.0.2-cp310-cp310-musllinux_1_1_ppc64le.whl; ncompress-1.0.2-cp310-cp310-musllinux_1_1_s390x.whl; ncompress-1.0.2-cp310-cp310-musllinux_1_1_x86_64.whl; ncompress-1.0.2-cp310-cp310-win32.whl; ncompress-1.0.2-cp310-cp310-win_amd64.whl; ncompress-1.0.2-cp310-cp310-win_arm64.whl; ncompress-1.0.2-cp311-cp311-macosx_10_14_universal2.whl; ncompress-1.0.2-cp311-cp311-macosx_10_14_x86_64.whl; ncompress-1.0.2-cp311-cp311-macosx_11_0_arm64.whl; ncompress-1.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Keywords: LZW, compression

License :: OSI Approved :: The Unlicense (Unlicense)Operating System :: OS IndependentProgramming Language :: Python :: 3

Tags

LZW compression decompressioncompress decompress bytes pythonlossless data compression libraryfile compression utilitydata compression algorithm
compressionlzwdata-encoding

More Utilities packages