Correct export syntax in nbdev 2

I’m trying to run nbdev export for the course script, but it seems that there have been not one but two major version upgrades for nbdev since the last recordings.

First I run into notebook2script not working anymore.

from nbdev.export import notebook2script
notebook2script()

Then in the forum I found some help to change this into:

from nbdev.export import nb_export
nb_export('app.ipynb', '.')

There are two problems with this:

  1. I got a warning about default_exp missing, which I fixed by adding #|default_exp app at the very top of the script.
  2. The more important problem is that it just silently executes and doesn’t create any files. No error, no warning now, just no file output.

Can you tell me what is the minimal code required to make an export using nbdev 2?

There are multiple ways to go about it.

First, you need a #|default_exp foo cell on the top of the nb, then mark the cells you wish to export with the #|export flag and then the final cell in your nb can be from nbdev import nbdev_export; nbdev_export() or run nbdev_export from the root of your repo in the terminal.

It doesn’t work. I made a minimal example, it reproduces it. Simply no file is generated.

I’m not able to reproduce this error. I just tried it on a nb and it worked as expected for me.