A Python library that enhances print debugging by automatically printing variable names and values with syntax highlighting.
IceCream is a Python library that provides an `ic()` function to simplify print-based debugging. It automatically prints both the expression being evaluated and its result, eliminating the need to manually format debug statements. It solves the problem of repetitive and error-prone `print()` calls during development.
Python developers who frequently use `print()` statements for debugging, especially those working in interactive or script-based environments where quick inspection is needed.
Developers choose IceCream because it drastically reduces debugging time by auto-printing expressions and values, offers pretty-printed output with syntax highlighting, and integrates seamlessly into existing code without side effects.
🍦 Never use print() to debug again.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The `ic()` function automatically prints both the expression and its evaluated value, saving developers from manually formatting debug strings like `print("foo(123)", foo(123))`.
Provides pretty printing for data structures and syntax highlighting in terminals, making complex outputs easier to scan, as shown with dictionary and class attribute examples.
Returns its arguments unchanged, allowing it to be inserted into existing code without breaking functionality, demonstrated in examples like `b = half(ic(a))`.
Offers extensive customization via `configureOutput()`, including custom prefixes, output redirection to logging, and context inclusion for tracing execution flow.
The README admits that using icecream with Python's logging module is 'a bit clunky' and lacks built-in log level support, requiring manual workarounds like `ic.format()`.
Adds a third-party package dependency, which may not be suitable for environments with strict dependency policies or minimal setups, unlike using built-in `print()`.
The automatic expression inspection and pretty printing introduce slight performance overhead, and configuration options like `install()` for global access add complexity compared to straightforward `print()`.