Manual¶
boar.testing¶
-
boar.testing.
assert_error_notebook
(notebook_path: Union[str, pathlib.Path], expected_error_type: Optional[type], expected_error_msg: Optional[str], error_label: str = 'Assertion', verbose: bool = True) → None[source]¶ Assert that notebook raise specific error.
- Parameters
notebook_path (Union[str, Path]) – Path of notebook
expected_error_type (Union[type, None]) – Expected error of the notebook
expected_error_msg (Union[str, None]) – Expected error message of the notebook
error_label (str, optional) – Name of the error
verbose (bool, optional) – Option to print more information, by default False
-
boar.testing.
assert_file
(notebook_path: Union[str, pathlib.Path], error_label: str = 'Assertion', verbose: bool = True) → None[source]¶ Check that notebook runs without error.
- Parameters
notebook_path (Union[str, Path]) – Path of notebook
error_label (str, optional) – Name of the error
verbose (bool, optional) – Option to print more information, by default False
-
boar.testing.
assert_notebook
(notebook_path: Union[str, pathlib.Path], error_label: str = 'Assertion', verbose: bool = True, recursion_level: int = 0, max_recursion: Optional[int] = None) → None[source]¶ Check that notebook runs without error.
Applied on a directory, all the notebook will be lint down to the level defined by max_recursion.
- Parameters
notebook_path (Union[str, Path]) – Path of notebook
error_label (str, optional) – Name of the error
verbose (bool, optional) – Option to print more information, by default False
recursion_level (int, optional) – Level of recurssion, by default 0 Set to -1000 if you wish to avoid raising Error
max_recursion (Union[int, None], optional) – Depth of directory to explore, by default None
- Returns
Posix of notebook that failed
- Return type
List[str]
- Raises
BoarError – At list one notebook as failed, the message will list all failed notebooks
-
boar.testing.
get_error_notebook
(notebook_path: Union[str, pathlib.Path], verbose: bool) → Tuple[Optional[type], Optional[str]][source]¶ Get notebook error.
- Parameters
notebook_path (Union[str, Path]) – Path of notebook
verbose (bool, optional) – Option to print more information, by default False
- Returns
error_type: class of error raised error_msg: error message
- Return type
Tuple[Union[type, None], Union[str, None]]
boar.linting¶
-
boar.linting.
lint_file
(file_path: Union[str, pathlib.Path], error_label: str = 'Linting', verbose: Any = True, inline: bool = False) → Union[None, str][source]¶ Lints one file.
- Parameters
file_path (Union[str, Path]) – Päth of the notebook, must be file
error_label (str, optional) – Name of the error
verbose (Any, optional) – Verbosity optional
inline (bool,optional) – Replace existing notebook with linted version
- Returns
Path in posix format if notebook fail else None
- Return type
Union[None, str]
- Raises
BoarError – Notebook is not a file or not linted.
-
boar.linting.
lint_notebook
(notebook_path: Union[str, pathlib.Path], error_label: str = 'Linting', verbose: Any = True, inline: bool = False, recursion_level: int = 0, max_recursion: Optional[int] = None) → List[str][source]¶ Lint notebook.
Applied on a directory, all the notebook will be lint down to the level defined by max_recursion.
- Parameters
notebook_path (Union[str, Path]) – Notebook path or notebook directory
error_label (str, optional) – Name of the error
verbose (Any, optional) – Verbosity option, by default True
inline (bool, optional) – Replace existing notebook with linted version, by default False
recursion_level (int, optional) – Level of recurssion, by default 0 Set to -1000 if you wish to avoid raising Error
max_recursion (Union[int, None], optional) – Depth of directory to explore, by default None
- Returns
Posix of notebook that failed
- Return type
List[str]
- Raises
BoarError – At list one notebook as failed, the message will list all failed notebooks
boar.running¶
-
boar.running.
run_notebook
(notebook_path: Union[str, pathlib.Path], inputs: dict = {}, verbose: Union[bool, object] = True, Tag: enum.EnumMeta = <enum 'Tag'>) → dict[source]¶ Run notebook one cell and one line at a time.
- Parameters
notebook_path (Union[str, Path]) – Path of notebook
inputs (dict, optional) – Parameter to set before launching the script, by default {}
verbose (Union[bool, object], optional) – Option to print more information, by default False
Tag (EnumMeta, optional) – Name of the tags, by default Tag
- Returns
Outputs to return if export-tags set in notebook
- Return type
dict
- Raises
BoarError – If export* and skip* tags in the same source
BoarError – If *start and *line tags in the same source