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 Common errors
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') Warnings
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`
Imports
- iterutils wrong
from kitchen.text import iteratecorrectfrom kitchen.iterutils import iterate - text_converters wrong
from kitchen.text.converters import to_unicodecorrectfrom kitchen.text import text_converters
Quickstart
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)