nbless package¶
Module contents¶
Nbless: a Python package for programmatic Jupyter notebook workflows.
-
nbless.
nbless
(in_files: List[str], kernel: str = 'python3') → nbformat.notebooknode.NotebookNode[source]¶ Create an executed Jupyter notebook from markdown and code files.
- Parameters
in_files – A list of names of markdown and code files.
kernel – The programming language used to run the notebook.
- Returns
An executed
nbformat.NotebookNode
object.
-
nbless.
nbuild
(in_files: List[str]) → nbformat.notebooknode.NotebookNode[source]¶ Create an unexecuted Jupyter notebook from markdown and code files.
- Parameters
in_files – A list of source file names.
- Returns
An unexecuted
nbformat.NotebookNode
object.
-
nbless.
nbexec
(in_file: str, kernel: str = 'python3') → nbformat.notebooknode.NotebookNode[source]¶ Create an executed notebook without modifying the input notebook.
- Parameters
in_file – The name of the Jupyter notebook file to be executed.
kernel – The programming language used to execute the notebook.
- Returns
An executed
nbformat.NotebookNode
object.
-
nbless.
nbconv
(in_file: str, exporter: str = '', out_file: str = '') → Tuple[str, str][source]¶ Convert a notebook into various formats using
nbformat
exporters.- Parameters
in_file – The name of the input notebook file.
out_file – The name of the output file.
exporter – The exporter that determines the output file type.
- Returns
A 2-tuple of the output file’s 1) name and 2) contents.
- Note
The exporter type must be ‘asciidoc’, ‘pdf’, ‘html’, ‘latex’, ‘markdown’, ‘python’, ‘rst’, ‘script’, or ‘slides’. All formats except ‘HTML’ require pandoc. Exporting to pdf requires latex.
-
nbless.
nbdeck
(in_file: str) → nbformat.notebooknode.NotebookNode[source]¶ Set up a Jupyter notebook to be viewed as or converted into slides.
Sets
slide_type
toslide
for markdown cells that start with headers. After runningnbdeck
, you canview Jupyter notebooks on nbviewer or with the RISE extension
create an HTML slideshow with
nbconv
orjupyter nbconvert
.
- Parameters
in_file – The name of the input Jupyter notebook file.
- Returns
An
nbformat.NotebookNode
object with edited slideshow metadata.