ipython / ipython/ipykernel

Directing output of out external threads/processes to specific cells

未关闭
#1,199 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
734
派生
412
平均合并
1 天 5 小时
30 天内合并 PR
8

描述

https://github.com/ipython/ipykernel/pull/1186 made output of Python threads and asyncio tasks go to right cells. It would be interesting, although challenging to make it work for any thread/process (e.g. created from a C++ dependency).

Here are two possible options to consider:
- (a) define format (e.g. JSON-RPC) where each write to the stdio/stderr would be a packed with both target cell ID and a blob message (slight challenges related to buffering and format choice) - this is how LSP works.
- (b) allow to open file descriptors per-cell (*2 for stdout/stderr) and make their IDs easily accessible to the external processes for writing (this could use virtual filesystem on Linux), either by having an API return the file descriptor or by having them in predictable locations (e.g. relative to kernel runtime); of course the challenges here would be around OS-specific limits for watching files and the allowed number of open file descriptors.

Any thoughts on whether any of these would be in scope?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。