fastai / nbdev

Create delightful software with Jupyter Notebooks
https://nbdev.fast.ai/
Apache License 2.0
4.9k stars 487 forks source link

`nbdev_docs` raises `FileNotFoundError` when looking for `_proc/docs` #1384

Open gorkamunoz opened 10 months ago

gorkamunoz commented 10 months ago

Hi, I am having some recent trouble creating the docs for my library (https://github.com/andichallenge/andi_datasets). Everything used to work fine but recently, whenever I try to run nbdev_docs, I get this error:

FileNotFoundError: [Errno 2] No such file or directory: '/home/gorka/github/andi_datasets/_proc/docs' -> '/home/gorka/github/andi_datasets/docs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/gorka/miniconda3/envs/andi/bin/nbdev_docs", line 8, in <module>
    sys.exit(nbdev_docs())
  File "/home/gorka/miniconda3/envs/andi/lib/python3.10/site-packages/fastcore/script.py", line 119, in _f
    return tfunc(**merge(args, args_from_prog(func, xtra)))
  File "/home/gorka/miniconda3/envs/andi/lib/python3.10/site-packages/nbdev/quarto.py", line 230, in nbdev_docs
    move(cache/cfg.doc_path.name, cfg.config_path)
  File "/home/gorka/miniconda3/envs/andi/lib/python3.10/site-packages/fastcore/shutil.py", line 8, in _f
    def _f(src, dst, *args, **kwargs): return f(str(src), str(dst), *args, **kwargs)
  File "/home/gorka/miniconda3/envs/andi/lib/python3.10/shutil.py", line 835, in move
    copy_function(src, real_dst)
  File "/home/gorka/miniconda3/envs/andi/lib/python3.10/shutil.py", line 434, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/home/gorka/miniconda3/envs/andi/lib/python3.10/shutil.py", line 254, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/home/gorka/github/andi_datasets/_proc/docs'

Somehow nbdev_docs, is looking for _proc/docs, which does not exists. nbdev_preview works just fine and I can see the docs in my localhost. I have run nbdev_docs in another similar library and everything works fine there, even though _proc/docs is neither being created in that one.

How is it that in this library nbdev_docs looks for _proc/docs? Nothing in the settings.ini or so seems to point there. This means that also the CI is failing when pushing to github. Any leads on how to solve this? Thanks!

gorkamunoz commented 10 months ago

After further exploration, it seems that in this library (and not in any other), the docs in _proc are being created in a folder named _proc/_site and not _proc/docs. Looking at my code, I have no idea why this change happening....

gorkamunoz commented 10 months ago

I just found the problem: the _quarto.yml file has to explicit point to the docs folder:

project:
  output-dir: docs
  type: website

Somehow I thought that it would be sufficient for nbdev.yml to have that information. I guess this is intended as nbdev.yml is autogenerated from _quarto.yml?