Utilities¶
Utils¶
- papermill.utils.any_tagged_cell(nb, tag)¶
Whether the notebook contains at least one cell tagged
tag?
- papermill.utils.chdir(path)¶
Change working directory to path and restore old path on exit.
path can be None in which case this is a no-op.
- papermill.utils.find_first_tagged_cell_index(nb, tag)¶
Find the first tagged cell
tagin the notebook.- Parameters:
nb (nbformat.NotebookNode) – The notebook to introspect
tag (str) – The tag to look for
- Returns:
Whether the notebook contains a cell tagged
tag?- Return type:
nbformat.NotebookNode
- papermill.utils.merge_kwargs(caller_args, **callee_args)¶
Merge named argument.
Function takes a dictionary of caller arguments and callee arguments as keyword arguments Returns a dictionary with merged arguments. If same argument is in both caller and callee arguments the last one will be taken and warning will be raised.
- papermill.utils.nb_kernel_name(nb, name=None)¶
Helper for fetching out the kernel name from a notebook object.
- papermill.utils.nb_language(nb, language=None)¶
Helper for fetching out the programming language from a notebook object.
- Parameters:
nb (nbformat.NotebookNode) – The notebook to introspect
language (str) – A provided language field
- Returns:
The programming language of the notebook
- Return type:
- Raises:
ValueError – If no notebook language is found or provided
- papermill.utils.remove_args(args=None, **kwargs)¶
Remove arguments from kwargs.
- papermill.utils.retry(num)¶
Exceptions¶
- exception papermill.exceptions.AwsError¶
Raised when an AWS Exception is encountered.
- exception papermill.exceptions.FileExistsError¶
Raised when a File already exists on S3.
- exception papermill.exceptions.PapermillException¶
Raised when an exception is encountered when operating on a notebook.
- exception papermill.exceptions.PapermillExecutionError(cell_index, exec_count, source, ename, evalue, traceback)¶
Raised when an exception is encountered in a notebook.
- exception papermill.exceptions.PapermillMissingParameterException¶
Raised when a parameter without a value is required to operate on a notebook.
- exception papermill.exceptions.PapermillOptionalDependencyException¶
Raised when an exception is encountered when an optional plugin is missing.
- exception papermill.exceptions.PapermillParameterOverwriteWarning¶
Callee overwrites caller argument to pass down the stream.
- exception papermill.exceptions.PapermillRateLimitException¶
Raised when an io request has been rate limited
- exception papermill.exceptions.PapermillWarning¶
Base warning for papermill.
- papermill.exceptions.missing_dependency_generator(package, dep)¶
- papermill.exceptions.missing_environment_variable_generator(package, env_key)¶
- papermill.exceptions.strip_color(text)¶
Remove most ANSI color and style sequences from a string
Based on https://pypi.org/project/ansicolors/.
Log¶
Sets up a logger