fastai / nbdev

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

Add support for copying output files to website #1421

Open idahlke-blacksky opened 3 days ago

idahlke-blacksky commented 3 days ago

My notebooks are producing file outputs of various types that need to be available on the final docs page. Currently it appears that nbdev_docs copies the nbs folder to the _proc folder before processing the notebooks. The files I need aren't created until execution time, so they are missed. Concurrently the working directory for execution appears to be the project root, not the notebook location, so all file outputs would be written to the root directory without applying any workarounds. Without workarounds this creates some differences between the local notebook development environment and the nbdev_docs call (when done from the project root).

Generally I work around this by writing everything to ./outputs/... and creating a symlink between project_root/outputs and project_root/nbs/outputs. For now I've also created one to project_root/_proc/outputs. That works but the system is a bit janky. It requires nbdev_docs --symlinks so the default workflows don't work, and the _proc directory cannot be completely cleared.

It would be nice if the working directory were set to the file location by nbdev_docs and furthermore if created files were picked up and moved to _proc after execution was complete.