Python API reference

nbreport.compute

The nbreport.compute module supports running Jupyter notebooks to compute output cells.

Functions

compute_notebook_file(path[, as_version]) Compute an ipynb notebook file and save it in place.
compute_notebook(notebook[, dirname, …]) Compute a notebook object.

nbreport.processing

The nbreport.processing module provides internal helpers for the command line apps.

Functions

is_url(path_or_url) Test if the token represents a URL or a local path.
create_instance(report_repo[, instance_id, …]) Create a report instance.

nbreport.repo

The nbreport.repo module provides APIs for managing report repositories.

Classes

ReportRepo(dirname) Report repository.
ReportConfig(path[, data]) Configuration for a report repository or instance (the nbreport.yaml file).

nbreport.templating

The nbreport.templating module provides APIs for rendering templated cells in Jupyter notebooks.

Each cell in a notebook has a source member. This source is what a user edits in the Jupyter notebook, be it a Markdown cell or a code (Python) cell. nbreport treats each cell’s source as a Jinja template.

Functions

render_notebook(notebook, context, jinja_env) Render the Jinja-templated cells of a notebook.
render_cell(cell, context, jinja_env) Render the Jinja-templated source of a single notebook cell.
load_template_environment([context_path, …]) Load the context (cookiecutter.json) and Jinja template environment.

nbreport.userconfig

The nbreport.userconfig module provides interfaces to the ~/.nbreport.yaml file, which is used to store GitHub credentials.

Functions

create_empty_config() Create an empty configuration object.
read_config([path]) Read an existing nbreport YAML-formatted configuration file.
get_config_path([path]) Get the path to the configuration file.
write_config(config[, path]) Write the configuration data to a YAML file
insert_github_config(config, username, token) Insert a github field into the configuration data with GitHub authentication information (username and personal access token).