일단 커밋. 오랫동안 커밋을 안해서 꼬였다.

리팩토리 중.
This commit is contained in:
2025-11-15 15:59:49 +09:00
parent 5a47b792d6
commit d79c10b975
12909 changed files with 2070539 additions and 285 deletions

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Min RK
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,101 @@
Metadata-Version: 2.1
Name: wurlitzer
Version: 3.1.1
Summary: Capture C-level output in context managers
Home-page: https://github.com/minrk/wurlitzer
Author: Min RK
Author-email: benjaminrk@gmail.com
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.5
Description-Content-Type: text/markdown
License-File: LICENSE
# Wurlitzer
Capture C-level stdout/stderr pipes in Python via `os.dup2`.
For more details on why this is needed, please read [this blog post](https://eli.thegreenplace.net/2015/redirecting-all-kinds-of-stdout-in-python/).
## Install
pip install wurlitzer
## Usage
Capture stdout/stderr in pipes:
```python
from wurlitzer import pipes
with pipes() as (out, err):
call_some_c_function()
stdout = out.read()
```
Capture both stdout and stderr in a single StringIO object:
```python
from io import StringIO
from wurlitzer import pipes, STDOUT
out = StringIO()
with pipes(stdout=out, stderr=STDOUT):
call_some_c_function()
stdout = out.getvalue()
```
Forward C-level stdout/stderr to Python sys.stdout/stderr,
which may already be forwarded somewhere by the environment, e.g. IPython:
```python
from wurlitzer import sys_pipes
with sys_pipes():
call_some_c_function()
```
Forward C-level output to Python Logger objects (new in 3.1).
Each line of output will be a log message.
```python
from wurlitzer import pipes, STDOUT
import logging
logger = logging.getLogger("my.log")
logger.setLevel(logging.INFO)
logger.addHandler(logging.FileHandler("mycode.log"))
with pipes(logger, stderr=STDOUT):
call_some_c_function()
```
Forward C-level output to a file (avoids GIL issues with a background thread, new in 3.1):
```python
from wurlitzer import pipes, STDOUT
with open("log.txt", "ab") as f, pipes(f, stderr=STDOUT):
blocking_gil_holding_function()
```
Or even simpler, enable it as an IPython extension:
```
%load_ext wurlitzer
```
To forward all C-level output to IPython (e.g. Jupyter cell output) during execution.
## Acknowledgments
This package is based on stuff we learned with @takluyver and @karies while working on capturing output from the [Cling Kernel](https://github.com/root-mirror/cling/tree/master/tools/Jupyter/kernel) for Jupyter.
## Wurlitzer?!
[Wurlitzer](https://en.wikipedia.org/wiki/Wurlitzer) makes pipe organs. Get it? Pipes? Naming is hard.

View File

@@ -0,0 +1,9 @@
__pycache__/wurlitzer.cpython-312.pyc,,
wurlitzer-3.1.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
wurlitzer-3.1.1.dist-info/LICENSE,sha256=JDxpX8PafBjYNbhXjrTLkkssGj-DCA2PGQ47Djy6XeY,1073
wurlitzer-3.1.1.dist-info/METADATA,sha256=O8uyVeHTTnCIvYT_x6chO362Xcrkx6NSp4o3tN9QyHA,2501
wurlitzer-3.1.1.dist-info/RECORD,,
wurlitzer-3.1.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
wurlitzer-3.1.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
wurlitzer-3.1.1.dist-info/top_level.txt,sha256=O9qOU7tp1U4XJ5AUnTFnauGFIBkbiDxOdAQldTCgk0o,10
wurlitzer.py,sha256=FgwSlisPCHo-M1q8KWvwZ_wRSf_HNFaYqyofx8e-1Ik,18963

View File

@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.43.0)
Root-Is-Purelib: true
Tag: py3-none-any

View File

@@ -0,0 +1 @@
wurlitzer