Skip to content

nbdev_build_docs fails on colab specific vendor tags inside jupyter notebook cells #206

@butchland

Description

@butchland

nbdev_build_docs fails on notebooks run on colab due to colab adding some vendor specific entry
application/vnd.google.colaboratory.intrinsic+json which for some reason is added only on the learner.summary cells.

(fastai2) xxx:fastai_xla_extensions zzzz$ nbdev_clean_nbs
(fastai2) xxx:fastai_xla_extensions zzzz$ nbdev_build_lib
Converted 00_core.ipynb.
Converted index.ipynb.
(fastai2) xxx:fastai_xla_extensions zzzz$ nbdev_build_docs
converting: /yyyy/fastai_xla_extensions/nbs/00_core.ipynb
converting: /yyyy/fastai_xla_extensions/nbs/index.ipynb
{'type': 'string'} is not valid under any of the given schemas

Failed validating 'oneOf' in execute_result['properties']['data']['patternProperties']['^(?!application/json$)[a-zA-Z0-9]+/[a-zA-Z0-9\\-\\+\\.]+$']:

On instance['cells'][27]['outputs'][0]['data']['application/vnd.google.colaboratory.intrinsic+json']:
{'type': 'string'}
{'type': 'string'} is not valid under any of the given schemas

Failed validating 'oneOf' in execute_result['properties']['data']['patternProperties']['^(?!application/json$)[a-zA-Z0-9]+/[a-zA-Z0-9\\-\\+\\.]+$']:

On instance['cells'][40]['outputs'][0]['data']['application/vnd.google.colaboratory.intrinsic+json']:
{'type': 'string'}
Traceback (most recent call last):
  File "/yyyy/anaconda3/envs/fastai2/bin/nbdev_build_docs", line 8, in <module>
    sys.exit(nbdev_build_docs())
  File "/yyyy/anaconda3/envs/fastai2/lib/python3.7/site-packages/fastscript/core.py", line 76, in _f
    func(**args.__dict__)
  File "/yyyy/anaconda3/envs/fastai2/lib/python3.7/site-packages/nbdev/cli.py", line 223, in nbdev_build_docs
    notebook2html(fname=fname, force_all=force_all, n_workers=n_workers)
  File "/yyyy/anaconda3/envs/fastai2/lib/python3.7/site-packages/nbdev/export2html.py", line 580, in notebook2html
    raise Exception(msg + '\n'.join([f.name for p,f in zip(passed,files) if not p]))
Exception: Conversion failed on the following:
00_core.ipynb
index.ipynb
(fastai2) xxx:fastai_xla_extensions zzzz$ 

Currently the workaround is run nbdev_clean_nbs --clear_all CLEAR_ALL but this also removes the outputs which might not be what you want especially for documentation purposes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions