nbdev icon indicating copy to clipboard operation
nbdev copied to clipboard

Allow a single notebook to export to multiple .py modules

Open jph00 opened this issue 2 years ago • 4 comments

Use the same #|export modname syntax that was in nbdev1

jph00 avatar Aug 04 '22 01:08 jph00

The directives docs suggest this issue can be closed, no?

hugetim avatar Feb 05 '23 20:02 hugetim

Maybe you could give it a try and see if it works? I don't recall where we got to with this.

jph00 avatar Feb 06 '23 20:02 jph00

It doesn't work in my simple example. The export directive silently fails, not exporting the function anywhere: nbdev-hello-world-test.zip

hugetim avatar Feb 07 '23 01:02 hugetim

@hugetim it works in my example with nbdev Version: 2.3.13

01_two.ipynb:

# | default_exp two
#| export core
def foo_core_mixin(): # is exported to core.py
    pass
#| export
def foo_two(): # is exported to two.py
    pass

However, I don't like the fact that it appears that you can't have two notebooks with the same default_exp (as it says here, it gets overwritten. However, i can't find anything in the docs about this)

turbotimon avatar Feb 07 '24 12:02 turbotimon