Open civvic opened 1 year ago
I had made a change (unmerged) to use a more specific regex for handling a similar issue here: https://github.com/fastai/nbdev/pull/928#discussion_r962361512 in case it is useful for trying to handle more of these edge cases
If the library folder contains modules extraneous to nb_dev, building
_modidx.py
will fail in some circumstances. In particular, parsing files generated by VSCode export to python script (@command:jupyter.exportAsPythonScript
) and probably those generated by JupytextExplanation
Looking at the code for building
_modidx.py
, it seems the intent is to only parse nbdev controlled modules:But the parsing of the cell header can easily fail if it encounters cell tags not generated by nbdev, i.e.,
# %% [markdown]
, as seen below.Details
Recreate the issue
nbdev_export
or simply add a file with these content to lib folder:
Workaround
I've quickly patched
maker.ipynb/py
anddoclinks.ipynb/py
to filter out files without headers generated by nbdev (# AUTOGENERATED! DO NOT EDIT! File to edit:...
).My understanding is
_modidx.py
is mainly used for doc generation, bu I'm not sure, so probably it would be a good idea to strengthen the parser to extract symbols from modules other than those controlled bynb_dev
. But in the meantime, I want to continue exploring the newnbdev
(I've used v1 a lot in mixed environment with very few problems)