Streams notebook code exec output in realtime, cleaning logs and rendering results for Jupyter sessions via client.
# Source: https://github.com/FoundationAgents/MetaGPT | License: MIT | Copyright 2024 Chenglin Wu # Provided via justclaw.it.com; keep this notice with the code. # -*- encoding: utf-8 -*- """ @Date : 2023/11/17 14:22:15 @Author : orange-crow @File : execute_nb_code.py """ from __future__ import annotations import asyncio import base64 import re from typing import Literal, Tuple import nbformat from nbclient import NotebookClient from nbclient.exceptions import CellExecutionComplete, CellTimeoutError, DeadKernelError from nbclient.util import ensure_async from nbformat import NotebookNode from nbformat.v4 import new_code_cell, new_markdown_cell, new_output, output_from_msg from rich.box import MINIMAL from rich.console import Console, Group from rich.live import Live from ric ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key