mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-18 20:11:20 +00:00
Merge pull request #473 from bjackman/ipynb-exporter-tweaks
Ipynb exporter tweaks
This commit is contained in:
commit
5eee03c689
@ -29,6 +29,7 @@ from wlauto import File, Parameter, ResultProcessor
|
|||||||
from wlauto.exceptions import ConfigError, ResultProcessorError
|
from wlauto.exceptions import ConfigError, ResultProcessorError
|
||||||
import wlauto.utils.ipython as ipython
|
import wlauto.utils.ipython as ipython
|
||||||
from wlauto.utils.misc import open_file
|
from wlauto.utils.misc import open_file
|
||||||
|
from wlauto.utils.types import file_path
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_NOTEBOOK_TEMPLATE = 'template.ipynb'
|
DEFAULT_NOTEBOOK_TEMPLATE = 'template.ipynb'
|
||||||
@ -59,6 +60,7 @@ class IPythonNotebookExporter(ResultProcessor):
|
|||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
Parameter('notebook_template', default=DEFAULT_NOTEBOOK_TEMPLATE,
|
Parameter('notebook_template', default=DEFAULT_NOTEBOOK_TEMPLATE,
|
||||||
|
kind=file_path,
|
||||||
description='''Filename of the ipython notebook template. If
|
description='''Filename of the ipython notebook template. If
|
||||||
no `notebook_template` is specified, the example template
|
no `notebook_template` is specified, the example template
|
||||||
above is used.'''),
|
above is used.'''),
|
||||||
@ -72,7 +74,7 @@ class IPythonNotebookExporter(ResultProcessor):
|
|||||||
ending in ``.pdf``.'''),
|
ending in ``.pdf``.'''),
|
||||||
Parameter('show_notebook', kind=bool,
|
Parameter('show_notebook', kind=bool,
|
||||||
description='Open a web browser with the resulting notebook.'),
|
description='Open a web browser with the resulting notebook.'),
|
||||||
Parameter('notebook_directory',
|
Parameter('notebook_directory', kind=file_path,
|
||||||
description='''Path to the notebooks directory served by the
|
description='''Path to the notebooks directory served by the
|
||||||
ipython notebook server. You must set it if
|
ipython notebook server. You must set it if
|
||||||
``show_notebook`` is selected. The ipython notebook
|
``show_notebook`` is selected. The ipython notebook
|
||||||
|
@ -36,7 +36,7 @@ NBFORMAT_VERSION = 3
|
|||||||
|
|
||||||
|
|
||||||
if IPython:
|
if IPython:
|
||||||
if LooseVersion('5.0.0') > LooseVersion(IPython.__version__) >= LooseVersion('4.0.0'):
|
if LooseVersion('6.0.0') > LooseVersion(IPython.__version__) >= LooseVersion('4.0.0'):
|
||||||
import nbformat
|
import nbformat
|
||||||
from jupyter_client.manager import KernelManager
|
from jupyter_client.manager import KernelManager
|
||||||
|
|
||||||
|
@ -83,6 +83,9 @@ def numeric(value):
|
|||||||
return ivalue
|
return ivalue
|
||||||
return fvalue
|
return fvalue
|
||||||
|
|
||||||
|
def file_path(value):
|
||||||
|
"""Handles expansion of paths containing '~'"""
|
||||||
|
return os.path.expanduser(value)
|
||||||
|
|
||||||
def list_of_strs(value):
|
def list_of_strs(value):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user