cmeel-zlib
`cmeel-zlib` is a specialized Python package that provides a distribution of the `zlib` C library, packaged using `cmeel` (a CMake-based build system for Python wheels). Its primary purpose is to serve as a build dependency for other Python packages that are also built with `cmeel` and require the `zlib` C library. It does not offer a direct Python API. The current version is 1.3.1, with minor releases typically occurring every 2-3 months.
Common errors
-
ModuleNotFoundError: No module named 'cmeel_zlib'
cause Attempting to directly import `cmeel_zlib` as a Python module.fix`cmeel-zlib` does not provide direct Python imports. Its purpose is to provide the underlying C library for other `cmeel`-built Python extensions. For zlib functionality, use the standard library `import zlib`. -
CMake Error: The following variables are initialized to the empty string: ZLIB_LIBRARY
cause Another `cmeel`-based Python project failed to find the `zlib` C library during its build process, indicating the dependency was not met.fixEnsure `cmeel-zlib` is installed in the build environment via `pip install cmeel-zlib`. This package is specifically designed to provide `zlib` as a CMake target for other `cmeel` projects. -
cannot find -lz
cause A C extension requiring `zlib` failed to link because the `zlib` library could not be found by the linker during compilation.fixInstall `cmeel-zlib` via `pip install cmeel-zlib`. This provides the `zlib` C library in a way that `cmeel` and other build systems can locate it for linking.
Warnings
- gotcha `cmeel-zlib` is not a direct Python API library; it does not export any Python symbols for direct import or use. Its primary function is to provide the `zlib` C library as a build dependency for other Python packages built using the `cmeel` build system.
- gotcha When `cmeel-zlib` is installed, it provides its own distribution of the `zlib` C library. This can potentially interact with or override other system-provided `zlib` installations, leading to unexpected behavior or build conflicts if not managed carefully in complex environments.
Install
-
pip install cmeel-zlib
Imports
- No direct Python symbols exported by `cmeel_zlib`
from cmeel_zlib import compress
This package facilitates the use of the `zlib` C library by other `cmeel`-based Python extensions. For Python-level `zlib` functionality, use the standard library `import zlib`.
Quickstart
import zlib
data = b"Hello, cmeel-zlib compression example!" * 10
compressed_data = zlib.compress(data)
decompressed_data = zlib.decompress(compressed_data)
print(f"Original size: {len(data)} bytes")
print(f"Compressed size: {len(compressed_data)} bytes")
print(f"Decompressed data matches original: {data == decompressed_data}")
# cmeel-zlib ensures that the underlying zlib C library is available
# and correctly linked for the standard library's zlib module and other
# cmeel-based extensions, potentially offering optimized performance.