--- id: wurlitzer version: "3.1.1" license: MIT license_treatment: permissive maintenance: active --- # wurlitzer — Capture C-level output in context managers License: permissive · Maintenance: active · Downloads: 1.8M/mo ## 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 above — 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 pip install wurlitzer uv add wurlitzer poetry add wurlitzer ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 1.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags capture c output python, redirect native library output, intercept c stdout stderr, pipes context manager, c level output redirection, os.dup2 wrapper, jupyter cell output capture, c-interop, io-redirection, jupyter-integration [View on SkillFed](https://skillfed.io/packages/wurlitzer) · [View on PyPI](https://pypi.org/project/wurlitzer/)