wurlitzer
Capture C-level output in context managers
What it is and what it does
Wurlitzer lets you capture output produced directly by C code and native libraries—output that normally bypasses Python's sys.stdout and sys.stderr. It works by using os.dup2 to redirect file descriptors at the OS level, making it possible to intercept output from compiled extensions, system calls, and third-party C libraries that write directly to stdout/stderr.
The package provides context managers (pipes, sys_pipes) and integrates with Python's logging module and file objects. It's particularly useful in Jupyter notebooks and IPython environments where you want to display C-level output in cell results, and in testing scenarios where you need to verify or suppress output from native code.
Use it for:
- Capture and verify output from C extensions or compiled libraries in unit tests.
- Display C-level output in Jupyter notebooks by enabling the wurlitzer IPython extension.
- Redirect native library output to Python loggers for centralized log management.
- Suppress or forward output from blocking C functions that hold the GIL.
- Debug integration issues between Python and native code by inspecting captured output.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Captures C-level stdout and stderr output in Python using os.dup2, allowing you to intercept and redirect output from native libraries and compiled code that bypasses Python's standard I/O.
Yes. Wurlitzer solves a specific, hard problem (capturing C-level I/O) with a clean API, has no dependencies, is actively maintained, carries an MIT license, and has no known vulnerabilities. Install it if you work with native extensions, compiled libraries, or need output capture in Jupyter—otherwise it's not necessary.
Install
wurlitzer on PyPI
pip
pip install wurlitzeruv
uv add wurlitzerpoetry
poetry add wurlitzerInstalling wurlitzer
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained with recent commits and a stable release history since 2016.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install wurlitzer
from wurlitzer import pipes
with pipes() as (out, err):
call_some_c_function()
stdout_text = out.read()
Requires Python 3.5 or later; os.dup2 is Unix-like systems only (Linux, macOS, BSD), not available on Windows.
Verify before relying
- Whether the package works correctly on all modern Python versions up to 3.12+ despite the 3.5 minimum requirement.
- Performance overhead or GIL interaction when capturing high-volume C output in production workloads.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.5) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 793 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,832,013/month — #3,510 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: wurlitzer-3.1.1-py3-none-any.whl
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
subprocess-multiteeMultiplexes subprocess stdout/stderr to…
unclear · top 15,000 on PyPI
logistrologistro wraps Python's standard logging module…
permissive · top 5,000 on PyPI
scripttestscripttest runs command-line applications in…
permissive · top 15,000 on PyPI
EasyProcessEasyProcess wraps Python's subprocess module to…
permissive · top 5,000 on PyPI
execnbExecutes Jupyter notebook code and captures…
permissive · top 15,000 on PyPI
subprocess-teeA drop-in replacement for subprocess.run that…
permissive · top 5,000 on PyPI
pytest-catchlogA pytest plugin that automatically captures log…
permissive · top 15,000 on PyPI
subprocess.runProvides a simplified interface to run shell…
permissive · top 15,000 on PyPI
subprocrunnerWraps Python's subprocess module to simplify…
permissive · top 15,000 on PyPI
spurProvides a unified Python interface to run…
permissive · top 15,000 on PyPI