# default_exp demo
A quick demonstration on how to export code in nbdev
The below cell doesn't get exported to any module because there is no #export
flag and is also hidden from the docs due to the #hide
flag.
#hide
from nbdev.showdoc import *
The below cell will export to demo.py
, because there is no argument to export and the default was set to demo
in the first cell.
# export
def func(): pass
The below cell will export to module1.py
because the argument module1
was passed to export.
# export module1
def func2():pass
The below cell will export to module2.py
because the argument module2
was passed to export.
# export module2
def func3(): pass
To export code, first make sure a notebook exists for each module. If you don't do this, you will get an error. The notebooks can be minimal like the ones demonstrated in this repository
There are two choices for exporting notebooks:
nbdev_build_lib
from the command line.nbdev.export.notebook2script
in python:from nbdev.export import notebook2script
notebook2script()
Converted index.ipynb. Converted module1.ipynb. Converted module2.ipynb.