export.nb_export

Contains the logic for exporting notebooks.

import shutil
import nblite.export.nb_export as this_module

export

export(
   root_path: Union[str,None],
   config_path: Union[str,None],
   export_pipeline: Union[str,None],
   nb_paths: Union[List[str],None]
)

Export notebooks in an nblite project, as specified in the nblite.toml config file.

If the root_path is not provided, nblite will search for a nblite.toml file in the current directory and all parent directories, and use the directory containing the nblite.toml file as the root folder.

Arguments: - root_path: Path to the root folder of the nblite project. - config_path: Path to the nblite.toml config file. Will be used instead of the config file in the root folder if provided. - export_pipeline: The export pipeline to use. E.g. ‘nbs->pts,pts->lib’.


root_path = Path('../../../test_proj/')
shutil.rmtree(root_path / 'my_module', ignore_errors=True)
shutil.rmtree(root_path / 'pcts', ignore_errors=True)
shutil.rmtree(root_path / 'lgts', ignore_errors=True)
export(root_path)
export(root_path, nb_paths=[root_path / 'nbs/notebook1.ipynb'])