Skip to content

Commit 6d321f3

Browse files
committed
fixed bug in processing Jupyter YAML metadata
1 parent a1c75b4 commit 6d321f3

4 files changed

Lines changed: 6 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
* Markup and code can now be displayed `raw`. Previously, only `verbatim` was
1212
permitted.
1313

14+
* Fixed a bug that caused Jupyter kernels to be used if there were any
15+
Jupyter settings in the YAML metadata, including `jupyter: false`.
16+
1417

1518

1619
# v0.10.1 (2022-07-11)

codebraid/code_collections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def append(self, code_chunk: CodeChunk):
175175
code_chunk.warnings.register_status(self.status)
176176
first_chunk_options = code_chunk.options['first_chunk_options']
177177
if code_chunk.index == 0:
178-
if any(k.startswith('jupyter') for k in first_chunk_options) or 'jupyter' in self.codebraid_defaults:
178+
if any(k.startswith('jupyter') for k in first_chunk_options) or self.codebraid_defaults.get('jupyter'):
179179
self.repl = False
180180
self.jupyter_kernel = first_chunk_options.get(
181181
'jupyter_kernel',

codebraid/codebraid_defaults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
'jupyter': (
3535
lambda x: (
3636
isinstance(x, bool) or
37-
(isinstance(x, dict) and all(k in ('kernel', 'timeout') for k in x) and
37+
(isinstance(x, dict) and x and all(k in ('kernel', 'timeout') for k in x) and
3838
isinstance(x.get('kernel', ''), str) and isinstance(x.get('timeout', 0), int))
3939
),
4040
'bool, or dict containing "kernel" (string) and/or "timeout" (int)'

codebraid/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# -*- coding: utf-8 -*-
22

33
from .fmtversion import get_version_plus_info
4-
__version__, __version_info__ = get_version_plus_info(0, 10, 2, 'dev', 2)
4+
__version__, __version_info__ = get_version_plus_info(0, 10, 2, 'dev', 3)

0 commit comments

Comments
 (0)