Open kevin-vitro opened 3 months ago
here is what my proposed fix would be:
from uuid import uuid4
def _import_show_doc_cell(mods=None):
"Add an import show_doc cell."
source = f"from nbdev.showdoc import show_doc"
if mods is not None:
for mod in mods: source += f"\nfrom {get_config().lib_name}.{mod} import *"
return {'cell_type': 'code',
'execution_count': None,
'id': str(uuid4()),
'metadata': {'hide_input': True},
'outputs': [],
'source': source}
I was running the function
notebook2html
and realized the following error message shows up when running the function:I tracked this down to
execute_nb
and specifically this line:It appears that the issue is that we aren't including an 'id' attribute in the dictionary. I think this could be fixed by adding an id and creating a random uuid for every id or something like that. I'm not sure if this is something that would be worth updating in nbdev1 since it doesn't appear this function is used in nbdev v2, but it took me a while to dig to the bottom of this so I wanted to share it in case it saves anybody else time.
Here is an example of a "valid" cell: