Support for multiple NBs with same `default_exp`
From the base nbdev_template you can duplicate 00_core.ipynb to make 01_other_core.ipynb and change the name of the foo function declared in this duplicate notebook to bar. Then you have two notebooks with the same default_exp exporting distinct functions.
The core.py generated from then executing nbdev_export ignores the foo function from 00_core.ipnyb. And when you run nbdev_preview, the sidebar links twice to the same http://localhost:3000/core.html.
nbdev1 handles this more cleanly. I think it's an important feature as some awkward decisions around documentationare forced otherwise.
So you're saying this isn't a bug?
At the least, then, the documentation for migrating nbdev1 should provide guidance instructing users to reorganize their pre-existing libraries to account for this diminished functionality.
I don't want to hijack the issue, but this causes problems as well with nbdev_docs: it executes normally but after converting the notebooks it raises ERROR: NotFound: No such file or directory (os error 2), rename 'testing/Notebooks/data.html' -> 'testing/Notebooks/_docs/data.html' . In addition, the .html and supplementary files folders are left in the Notebooks folder.
@jph00 thank you for linking to this thread.
The reason why this is not an enhancement, but rather a bug:
Is that the tutorial specifically says you should write #|default exp core at the top of your notebook. I did that, and it didn't work. There is no mention that doing this in two notebooks would produce unexpected results without warning. The unexpected result is that the exported functions from one of these two notebooks are silently ignored.
I know that I have spent a frustrating hour++ trying to figure out what the problem is -- and there will be many more users that will simply declare nbdev to be unworkable and move on.
I'd say that a quick fix is to detect the situation in which another notebook uses the same #|default_exp <target> and throw an error with a helpful message,
e.g. export target <target> already requested in file <filename.ipynb>
Additionally, there should be a note in the tutorial that each notebook needs a different export target.
@jph00 As a quick fix can we at least get an option to "elevate" __all__
e.g.
my_lib/
|── large_mod/
│ ├── part_a.ipynb
│ └── part_b.ipynb
will generate
my_lib/
|── large_mod/
│ ├── __init__.py
│ ├── part_a.py
│ └── part_b.py
but __init__.py will not have an __all__. So something like
#| export_exp
#| elevate_all: True
would solve that?