# sys.meta_path.append(NotebookFinder())
Notebooks
implements the Jupyter Notebook Module Finder. See Importing Jupyter Notebooks as Modules for more details.
%load_ext autoreload %autoreload 2
Jupter-Notebooks
from Jupyter Notebooks readthedocs.
Imports
Utility for finding notebook files
find_notebook
find_notebook (fullname:str, path:Optional[str]=None)
find a notebook, given its fully qualified name and an optional path
This turns “foo.bar” into “foo/bar.ipynb” and tries turning “Foo_Bar” into “Foo Bar” if Foo_Bar does not exist.
Notebook Loader
NotebookLoader
NotebookLoader (path:Optional[str]=None)
Module Loader for Jupyter Notebooks
Module Finder
NotebookFinder
NotebookFinder ()
Module finder that locates Jupyter Notebooks
How to Register the Hook
Displaying Notebooks
NotebookViewer
NotebookViewer (path:Optional[str]=None)
Example
# nbv = NotebookViewer(os.path.abspath(os.path.join("./_constants", "00_init.ipynb")))
# nbv.show_notebook()
Aggregation Script
NotebookPrefixer
NotebookPrefixer (path:Optional[str]=None, name:Optional[str]=None, maximal:Optional[bool]=False)
NotebookPrefixer('./_utils'))),
os.path.dirname(os.path.abspath(os.path.join(='utils'
name ).next_nb_prefix()
'02'
NotebookAggregator
NotebookAggregator (path:str, module:Optional[str]=None, output:Optional[str]=None, ignore:List[str]=<factory>, prefix:Union[bool,str,NoneType]=True, prefix_dir:Optional[str]=None)
A class to aggregate Jupyter notebooks.
Type | Default | Details | |
---|---|---|---|
path | str | The path to the directory containing the notebooks. | |
module | Optional | None | The name of the module, by default None |
output | Optional | None | The path to the output notebook, by default None |
ignore | List | A list of notebooks to ignore, by default [] | |
prefix | Union | True | |
prefix_dir | Optional | None |
= NotebookAggregator(
nbagg './_01_static')),
os.path.abspath(os.path.join(='static',
module=['_00_init.ipynb']
ignore )
nbagg.aggregate()
= NotebookAggregator(
nbagg './_02_utils')),
os.path.abspath(os.path.join(='utils',
module
)
nbagg.aggregate()
= NotebookAggregator(
nbagg './_03_types')),
os.path.abspath(os.path.join(='types',
module
) nbagg.aggregate()
Jupyter-Notebook Logger
NotebookLogger
NotebookLogger (name:Optional[str]='NotebookLogger', level:Optional[int]=20, format:Optional[str]='%(asctime)s - %(levelname)s - %(message)s')