nbdev icon indicating copy to clipboard operation
nbdev copied to clipboard

How to export to top level of package?

Open dsm-72 opened this issue 1 year ago • 3 comments

MWE

$ mkdir example
$ cd example
$ nbdev_new
$ cd nbs
$ code 00_core.ipynb

How can I use default_exp to instead of exporting to example.core I can export everything to the top level of the package so I can just go from example import ...

dsm-72 avatar Jun 04 '23 17:06 dsm-72

You need to edit your __init__.py. Edit your __init__.py to something like this

from .core import *
from .foo import *
# and so on

deven367 avatar Jun 04 '23 19:06 deven367

@deven367 isn't that file autogenerated? So shouldn't there be a way to do that without manually editing it?

dsm-72 avatar Jun 05 '23 12:06 dsm-72

The file is auto generated, but it is up to the creator of the package to decide the import structure of the entire package.

deven367 avatar Jun 17 '23 04:06 deven367