Source links are broken on documentation websites

I’ve been using nbdev for this project and thus far the [source] links in the documentation were working perfectly, but they all appeared to break with this most recent push. For example, if I want to go here to my bcml_model class and see the source code, the url used by the documentation is

https://sheride.github.io/bcml4pheno/bcml4pheno/bcml_model.py#L14

whereas it appears that the correct link would be (?)

https://github.com/sheride/bcml4pheno/blob/master/bcml4pheno/bcml_model.py#L14

Is this something on my end? Is there a way I can resolve this? Thanks in advance for any advice.

1 Like

Can you try upgrading to the latest version of fastcore and see if that helps?

1 Like

Thanks for getting back to me: my fastcore is version 1.5.3, and I’m under the impression that this is the latest version, right?

No the latest is 1.5.4.

1 Like

I just upgraded to fastcore version 1.5.4 and now I get the following error when I run nbdev_build_docs

converting: /Users/sheridan/Academic/bcml4pheno/full_example.ipynb
[IPKernelApp] ERROR | KeyboardInterrupt caught in kernel.
'coroutine' object is not subscriptable
/Users/sheridan/opt/anaconda3/envs/pheno_pip/lib/python3.9/site-packages/nbdev/export2html.py:514: RuntimeWarning: coroutine 'ZMQSocketChannel.get_msg' was never awaited
  return False
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Conversion failed on the following:
full_example.ipynb
converting /Users/sheridan/Academic/bcml4pheno/index.ipynb to README.md
Traceback (most recent call last):
  File "/Users/sheridan/opt/anaconda3/envs/pheno_pip/bin/nbdev_build_docs", line 8, in <module>
    sys.exit(nbdev_build_docs())
  File "/Users/sheridan/opt/anaconda3/envs/pheno_pip/lib/python3.9/site-packages/fastcore/script.py", line 117, in _f
    tfunc(**merge(args, args_from_prog(func, xtra)))
  File "/Users/sheridan/opt/anaconda3/envs/pheno_pip/lib/python3.9/site-packages/nbdev/export2html.py", line 650, in nbdev_build_docs
    if mk_readme: make_readme()
  File "/Users/sheridan/opt/anaconda3/envs/pheno_pip/lib/python3.9/site-packages/nbdev/export2html.py", line 630, in make_readme
    convert_md(index_fn, get_config().config_file.parent, jekyll=False)
  File "/Users/sheridan/opt/anaconda3/envs/pheno_pip/lib/python3.9/site-packages/nbdev/export2html.py", line 555, in convert_md
    exp = nbdev_exporter(cls=MarkdownExporter, template_file='jekyll-md.tpl' if jekyll else 'md.tpl')
  File "/Users/sheridan/opt/anaconda3/envs/pheno_pip/lib/python3.9/site-packages/nbdev/export2html.py", line 475, in nbdev_exporter
    exporter.template_paths.append(str(Path(__file__).parent/'templates'))
AttributeError: 'MarkdownExporter' object has no attribute 'template_paths'

That’s either an old version of nbconvert or nbdev. The issue is that a couple of years ago, nbconvert made a non backward compatible change. In a recent version of nbdev we updated things to use their new API.

1 Like

Thanks for getting back to me so fast. My nbdev is version 1.2.11 which pypi confirms is the most recent release, while my nbconvert is version 6.5.0 which pypi shows as the most recent version that isn’t a pre-release. Do I need to get an nbconvert pre-release?

No you shouldn’t need a prerelease - the error you’re getting is something that was fixed quite a few months ago.

1 Like

In that case, I’ll admit I’m perplexed: when I run conda list I can pick out the following package versions, which all appear to be up to date. I can’t understand why I’d be experiencing a month-old problem with very recently updated packages.

fastcore                  1.5.3                    pypi_0    pypi
nbconvert                 6.5.0                    pypi_0    pypi
nbdev                     1.2.11                   pypi_0    pypi

I do notice, though, that fastcore does say 1.5.3 here: since identifying this, I have many times attempted to reinstall fastcore version 1.5.4 (using both pip and conda) but every time conda and pip both confirm that 1.5.4 is indeed installed but conda continues to print out a version number of 1.5.3 each time I run conda list or conda list fastcore. I’m unsure if this is connected or not…

Yup sounds connected - there’s something odd going on with your python install…

I’d just like to follow up and share that I have fixed my conda environment issue and gotten to the following package versions:

fastcore                  1.5.6                    pypi_0    pypi
nbconvert                 6.5.0                    pypi_0    pypi
nbdev                     1.2.11                   pypi_0    pypi

and after updating the docs and pushing everything to github, I am continuing to have broken links to source code in my documentation (as can be seen here for example).

Bumping this because I just updated to nbdev version 2.0 and this problem is continuing to persist.

OK then you’ve definitely got a problem with your install, because nbdev2 doesn’t even use nbconvert. I’d suggest creating a new env from scratch.