cytoolz provides a high-performance, Cython-implemented version of the functional utilities found in the toolz library. It offers drop-in replacements for many common `toolz` functions, primarily focusing on iteration and composition for speed improvements. The current version is 1.1.0. Release cadence generally follows significant updates or releases of the upstream `toolz` library.
pip install cytoolzVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic usage of `compose`, `pipe`, `map`, and `filter` from `cytoolz.functoolz` and `cytoolz.itertoolz`. These functions provide a functional programming style with potential performance benefits over their pure Python equivalents, especially for iterable operations.
Profile your application to determine if `cytoolz` provides a meaningful performance improvement for your specific bottlenecks. Don't assume all functions will be faster.
Refer to the official `toolz` documentation for the primary source of API information. Monitor `toolz` release notes for breaking changes when upgrading.
Always ensure `pip install cytoolz` is sufficient, as it should pull in `toolz` automatically. If issues arise, explicitly install `toolz` (`pip install toolz`).
Ensure `cytoolz` is installed by running: `pip install cytoolz`
First, ensure you have a C compiler (like build-essential on Linux, Xcode command line tools on macOS, or Visual C++ build tools on Windows). Then, try installing `Cython` separately before `cytoolz`: `pip install cython` followed by `pip install cytoolz`.
When using tools like PyInstaller, you might need to add hidden imports (e.g., `--hidden-import=cytoolz.itertoolz`). For deployment to environments like AWS Lambda or when using zip files, ensure that the compiled `.so` or `.pyd` files for the Cython modules are correctly packaged and accessible in the Python path, often by building the deployment package in a compatible environment (e.g., a Docker container simulating the target Lambda environment).
If this error originates from a third-party library, check if there's an updated version that's compatible with `cytoolz`. If you have control over the code, you might need to adapt it not to rely on the `__module__` attribute of `Compose` objects from `cytoolz` or implement a workaround to provide this attribute if absolutely necessary.