ReportRepo

class nbreport.repo.ReportRepo(dirname)

Bases: object

Report repository.

Parameters:
dirname : pathlib.Path or str

Path to the report repository directory. This directory is a clone of the report’s Git repository on the local filesystem.

Attributes:
asset_paths

Paths to assets associated with a report template (list of pathlib.Path).

config

Notebook repository configuration (ReportConfig).

config_path

Path to the nbreport.yaml configuration file (pathlib.Path).

context_path

Path to the cookiecutter.json template context file (pathlib.Path).

dirname

Directory path of the cloned report repository (pathlib.Path).

ipynb_path

Path to report’s notebook template (pathlib.Path).

Methods

git_clone(url[, clone_base_dir, checkout, …]) Create a ReportRepo instance by cloning from a Git repository.
open_notebook() Open the repository’s notebook file.

Attributes Summary

asset_paths Paths to assets associated with a report template (list of pathlib.Path).
config Notebook repository configuration (ReportConfig).
config_path Path to the nbreport.yaml configuration file (pathlib.Path).
context_path Path to the cookiecutter.json template context file (pathlib.Path).
dirname Directory path of the cloned report repository (pathlib.Path).
ipynb_path Path to report’s notebook template (pathlib.Path).

Methods Summary

git_clone(url[, clone_base_dir, checkout, …]) Create a ReportRepo instance by cloning from a Git repository.
open_notebook() Open the repository’s notebook file.

Attributes Documentation

asset_paths

Paths to assets associated with a report template (list of pathlib.Path).

config

Notebook repository configuration (ReportConfig).

config_path

Path to the nbreport.yaml configuration file (pathlib.Path).

context_path

Path to the cookiecutter.json template context file (pathlib.Path).

dirname

Directory path of the cloned report repository (pathlib.Path).

ipynb_path

Path to report’s notebook template (pathlib.Path).

Methods Documentation

classmethod git_clone(url, clone_base_dir=None, checkout='master', subdir=None)

Create a ReportRepo instance by cloning from a Git repository.

Parameters:
url : str

URL of the remote Git repository.

clone_base_dir : str, optional

Directory to clone the Git repository into. Defaults to the current working directory.

checkout : str, optional

Git ref (branch or tag) to check out. By default, the default (master) branch is checked out.

subdir : str, optional

If a report repository is not located in the root of a Git repository, set the Git-repo-relative directory path with this argument.

Returns:
ReportRepo

Report repository instance (located on a local file system).

open_notebook()

Open the repository’s notebook file.

Returns:
notebook : nbformat.NotebookNode

The repository’s notebook file as a NotebookNode instance. If modified, the notebook must be explicitly written to disk with nbformat.write to be persisted.