Skip to content

Commit

Permalink
discard stdout and stderr from Jupyter kernel processes (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpoore committed Jul 8, 2022
1 parent 9b72825 commit 8021066
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
* Fixed an encoding bug that prevented `svg` rich output from being displayed.
Added `svg` to the collection of rich output formats that are automatically displayed (#53).

* stdout and stderr from Jupyter kernel processes are no longer included in
Codebraid's stdout and stderr. Some kernels such as IJulia write messages
to output streams during startup. This was causing error messages in
Codebraid Preview and incorrect documents when Codebraid outputs to stdout.

* Fixed a bug that prevented Jupyter kernels from being used when the kernel
name, kernel display name, and kernel language were not all different from
each other.
Expand Down
5 changes: 3 additions & 2 deletions codebraid/codeprocessors/exec_jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@

import base64
import collections
import pathlib
import queue
import re
import subprocess
import time
import pathlib
try:
import jupyter_client
except ImportError:
Expand Down Expand Up @@ -119,7 +120,7 @@ async def exec(session: Session, *, cache_key_path: pathlib.Path, progress: Prog

kernel_manager = jupyter_client.AsyncKernelManager(kernel_name=kernel_name)
try:
await kernel_manager.start_kernel()
await kernel_manager.start_kernel(stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
except jupyter_client.kernelspec.NoSuchKernel:
msg = f'No Jupyter kernel was found for "{session.jupyter_kernel}"'
session.errors.append(message.SysConfigError(msg))
Expand Down
2 changes: 1 addition & 1 deletion codebraid/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-

from .fmtversion import get_version_plus_info
__version__, __version_info__ = get_version_plus_info(0, 10, 0, 'dev', 5)
__version__, __version_info__ = get_version_plus_info(0, 10, 0, 'dev', 6)

0 comments on commit 8021066

Please sign in to comment.