Usage of nb_export() for Jupyter notebook

I would like to export the content of a notebook to a .py file using nbdev, but without the necessity to store the notebook in a separate GitHub repo etc. (as described in the full walkthrough). My goal is to have re-useable code in the notebook which I can re-use in other notebooks.

I created a simple “hello world” notebook with 4 cells


# default_exp pkg


# export
class ClassToBeExported:
    def __init__(self):


dummy = ClassToBeExported()


# hide
from nbdev.export import nb_export
nb_export('notebook_export_example.ipynb', 'pkg')

Running all 4 cells in my notebook ‘notebook_export_example.ipynb’, however, does not export the notebook.
What am I missing to make this work?


I bumped into those problems before as well. nbdev_export command line works fine though (just run nbdev_export in a root folder of your nbdev project)

Thanks for the suggestion, but somehow this ends with an error:
Bad value substitution: option ‘lib_name’ in section ‘DEFAULT’ contains an interpolation key ‘repo’ which is not a valid option name. Raw value: ‘%(repo)s’
Do you maybe use a settings.ini file?