You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to be able to specify a similar header in the jupyter notebook as in R. wBuild would then parse this configuration and run the notebook. The notebook can be parametrized and executed using the following code
importsubprocessimportosdefjupyter_nbconvert(input_ipynb):
""" .ipynb -> .html """subprocess.call(["jupyter",
"nbconvert",
input_ipynb,
"--to", "html"])
defrender_ipynb(template_ipynb, rendered_ipynb, params=dict()):
"""Render the ipython notebook Args: template_ipynb: template ipython notebook where one cell defines the following metadata: {"tags": ["parameters"]} render_ipynb: output ipython notebook path params: parameters used to execute the ipython notebook """importpapermillaspm# Render the ipython notebookos.makedirs(os.path.dirname(rendered_ipynb), exist_ok=True)
pm.execute_notebook(
template_ipynb, # input templaterendered_ipynb,
kernel_name="python3", # default kernelparameters=params
)
jupyter_nbconvert(rendered_ipynb)
rulecompile_notebook:
"""Run the notebook and convert it to html """input:
example='example_file_{some_param}.csv',
ipynb="src/<ipynb-path>.ipynb"output:
ipynb="output/<ipynb-path>.ipynb",
html="output/<ipynb-path>.html"run:
render_ipynb(input.ipynb, output.ipynb,
params=dict(example=input.example,
some_param=wildcards.some_param))
jupyter_nbconvert(output.ipynb)
The text was updated successfully, but these errors were encountered:
Avsecz
changed the title
Allow ipynb's in the a similar way as spin R / Rmd scripts
Execute and render ipynb's similar to spin R / Rmd scripts
Nov 25, 2018
Just for reference:
JupyText is a jupyterlab extension which allows to transparently convert .ipynb to .Rmd.
This way, Jupyter notebooks can be directly versioned via git and executed with wbuild.
It would be nice to be able to specify a similar header in the jupyter notebook as in R. wBuild would then parse this configuration and run the notebook. The notebook can be parametrized and executed using the following code
Required packages
Related
The text was updated successfully, but these errors were encountered: