nbdev
nbdev copied to clipboard
Specify multiple directories in `nbs_path` or exclude certain subdirectories
I would like to build nbdev docs (nb: docs only, no lib code) based on multiple subfolders - the pattern is as follows:
repo_root
└ nbs_dir
├ sub-directory1
│ ├ core/
│ └ tutorials/nbs/... # here are the tutorials!
├ sub-directory2
│ ├ core/
│ └ tutorials/nbs/... # here are the tutorials!
└ sub-directory3
├ core/
└ tutorials/nbs/... # here are the tutorials!
Thus, I'd like to specify my nbs_path
in settings.ini
either as follows:
Option 1
# settings.ini
nbs_path = nbs_dir/sub-directory1/tutorials, nbs_dir/sub-directory2/tutorials, nbs_dir/sub-directory3/tutorials
Option 2
# settings.ini
nbs_path = nbs_dir
exclude_pattern = nbs_dir/*/core/
Additional context:
sub-dir1/2/3 are submodules from external libraries which have their own lib code and nbdev tutorials. This repo would only serve as synced, centralised point to access all tutorials in a single build.
Hey @mattgra, if I understand your requirement correctly, this is already possible in nbdev
.
To create tutorials, (do NOT add the #|default_exp
flag to your nb). You can check the nbdev
repo for this.
Then to update the sidebar, you can manually edit the _quarto.yml
file to get your desired sidebar configuration.
Not sure i fully understand this solution.
In the repo you are showing the settings.ini
still points to the nbs
folder only. (https://github.com/fastai/nbdev/blob/master/settings.ini)
nbdev then recursively goes through all the folders inside nbs
and generates the docs (i.e., also for the explanations
, tutorials
, and API
folders. (see here: https://nbdev.fast.ai/api)
Yes, that's correct. nbdev
recursively goes through the notebooks in the nbs
folder. The part where the notebooks differ in the api
folder vs the tutorials
folder is over here.
When the #|default_exp
flag is missing in a notebook, no python file is created for it, and it is rendered by nbdev
as docs.
API notebook
Tutorials nb