kitchen

raw JSON →
1.2.6 verified Mon Apr 27 auth: no python maintenance

Kitchen is a Python library containing a cornucopia of useful code, including utilities for text handling, iterables, data structures, and Python version compatibility. Current version 1.2.6 has no active development; the library is in maintenance mode. Release cadence: sporadic, last release 2016.

pip install kitchen
error ModuleNotFoundError: No module named 'kitchen.text.converters'
cause Incorrect import path; the module is `kitchen.text.text_converters`.
fix
Use from kitchen.text import text_converters
error TypeError: to_unicode() got an unexpected keyword argument 'encoding'
cause Function signature differs between versions; in 1.2.6, `to_unicode` expects `encoding` as second positional argument, not keyword.
fix
Use positional call: text_converters.to_unicode(b'hello', 'utf-8')
deprecated kitchen has not been updated since 2016 and is in maintenance mode. Many utilities have been superseded by standard library features (e.g., six, functools). Consider migrating to actively maintained alternatives.
fix Replace with modern equivalents: use six for compatibility, or native Python 3 features.
gotcha The `kitchen.text` module uses old-style unicode handling. In Python 3, avoid using `kitchen.text.text_converters.to_unicode` on native strings as it may raise errors.
fix Use Python 3's built-in `str` method or `codecs.decode` instead.
gotcha Import paths are not always intuitive. Many users mistakenly import `iterate` from `kitchen.text` instead of `kitchen.iterutils`.
fix Correct import: `from kitchen.iterutils import iterate`

Import and use basic utilities from kitchen.

from kitchen.iterutils import iterate
from kitchen.text import text_converters

# Example: iterate over nested lists
for item in iterate([1, [2, 3], 4]):
    print(item)

# Example: convert bytes to unicode
unicode_str = text_converters.to_unicode(b'hello', encoding='utf-8')
print(unicode_str)