
IceCream
A Python debugging helper that prints variables, expressions, and code location better than print().
- Stars
- 10.1k
- Forks
- 237
- Licence
- MIT
- Language
- Python
- Last update
- 17 days ago
- Type
- Library
What it is
IceCream provides a function called ic() that you call on a variable or expression. It prints the expression's text along with its value, formatted and syntax highlighted, and can optionally add the filename, line number, and parent function. It is meant as a more convenient replacement for adding print() statements while debugging Python code.
- Print a variable and its expression text at once, such as ic(foo(123)) showing the call and result
- Trace which branches of a function run by calling ic() with no arguments to show file, line, and function
- Disable all debug output with ic.disable() and re-enable it later with ic.enable()
- Customize the output prefix or route output to a logger using configureOutput()
Great for
- Python developers who add print() statements to debug code
- Students learning how values change while a program runs
- Developers who want debug output that can be turned off without removing calls
- Developers who want to wrap existing code without changing its behavior, since ic() returns its arguments
Not ideal for
- Production logging needs, since the README suggests a standard logger via ic.format() and notes built-in log levels are not provided
- Non-Python projects, since this is a Python library
How to get it
- 1
Install with a package manager
You'll need: Python 3
Install with pip
pip install icecream - 2
Run it
- Install with pip install icecream
- Add from icecream import ic at the top of your file
- Call ic() on a variable, for example ic(my_variable)
- Run your program and read the ic| output in stderr
- 3
Get the most out of it
- Use install() to make ic() available in every file without importing it each time, then uninstall() when done
- Use the graceful fallback import snippet so production code runs without icecream installed
- Set includeContext=True and contextAbsPath=True to get clickable file paths in editors like VSCode
- Register custom formatters with argumentToString.register() for types like numpy arrays
Downloads
Strengths
- Shows both the expression text and its value, which plain print() does not
- Returns its arguments, so it can be inserted into existing code without breaking it
- Can be toggled off globally with ic.disable() and ic.enable()
Trade-offs
- The README does not describe built-in log level support; users are pointed to ic.format() with a logger instead
- Advanced customization like argToStringFunction requires reading the configuration section carefully
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| icecream (this) | 10.1k | Library | beginner | 17 days ago | Python developers who add print() statements to debug code |
| debug | 11.5k | Library | beginner | 22 days ago | Node.js developers who want named, toggleable log output instead of plain console.log calls |
| imgui | 76.9k | Library | intermediate | 6 days ago | Game developers who want an in-engine debug or tools panel |
| rich | 57.7k | Library | beginner | 5 months ago | Python developers who write command-line scripts and want clearer output |
| ccxt | 44.7k | Library | intermediate | 4 days ago | Developers building trading bots or algorithmic trading software |
| typer | 20.2k | Library | beginner | 5 days ago | Python developers writing small or medium command-line tools |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.