Skip to content

Commit 9c5f59e

Browse files
committed
make mistletoe optional
1 parent fdcaf61 commit 9c5f59e

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

execnb/shell.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from fastcore.script import call_parse
1010
from fastcore.ansi import ansi2html
1111

12-
import mistletoe,multiprocessing,types,traceback,signal
12+
import multiprocessing,types,traceback,signal
1313
try:
1414
if sys.platform == 'darwin': multiprocessing.set_start_method("fork")
1515
except RuntimeError: pass # if re-running cell
@@ -138,6 +138,8 @@ def run(self:CaptureShell,
138138

139139
# %% ../nbs/02_shell.ipynb
140140
def render_outputs(outputs, ansi_renderer=strip_ansi):
141+
try: import mistletoe
142+
except ImportError: return print('mistletoe not found -- please install it')
141143
def render_output(out):
142144
otype = out['output_type']
143145
if otype == 'stream':

nbs/02_shell.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"from fastcore.script import call_parse\n",
3333
"from fastcore.ansi import ansi2html\n",
3434
"\n",
35-
"import mistletoe,multiprocessing,types,traceback,signal\n",
35+
"import multiprocessing,types,traceback,signal\n",
3636
"try:\n",
3737
" if sys.platform == 'darwin': multiprocessing.set_start_method(\"fork\")\n",
3838
"except RuntimeError: pass # if re-running cell\n",
@@ -817,6 +817,8 @@
817817
"source": [
818818
"#| export\n",
819819
"def render_outputs(outputs, ansi_renderer=strip_ansi):\n",
820+
" try: import mistletoe\n",
821+
" except ImportError: return print('mistletoe not found -- please install it')\n",
820822
" def render_output(out):\n",
821823
" otype = out['output_type']\n",
822824
" if otype == 'stream':\n",

settings.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ author_email = [email protected]
1111
branch = master
1212
version = 0.1.7
1313
min_python = 3.7
14-
requirements = fastcore>=1.5.5 ipython mistletoe
15-
dev_requirements = matplotlib Pillow
14+
requirements = fastcore>=1.5.5 ipython
15+
dev_requirements = matplotlib Pillow mistletoe
1616
console_scripts = exec_nb=execnb.shell:exec_nb
1717
audience = Developers
1818
language = English

0 commit comments

Comments
 (0)