serve

A parallel ipynb processor (experimental)

_keep_file implements proc_nbs’s notebook scoping: file_glob/file_re restrict which notebooks are processed, while other files (styles, images, yml) are always kept, since any render may reference them.

fs = L(Path(p) for p in ('styles.css', 'index.ipynb', '01_core.ipynb', 'sub/02_x.ipynb'))
test_eq(fs.filter(_keep_file, file_glob='', file_re=''), fs)
test_eq(fs.filter(_keep_file, file_glob='index.ipynb', file_re=''), [Path('styles.css'), Path('index.ipynb')])
test_eq(fs.filter(_keep_file, file_glob='', file_re=r'^0'), [Path('styles.css'), Path('01_core.ipynb'), Path('sub/02_x.ipynb')])

_proc_file only adds and updates files in _proc. _rm_stale removes pages whose source was deleted or renamed. Otherwise a stale page.qmd and its replacement page.ipynb both render to page.html, and Quarto drops the page from the sidebar. Images and Quarto’s own files stay in place.


source

proc_nbs

def proc_nbs(
    path:str='', # Path to notebooks
    n_workers:int=4, # Number of workers
    force:bool=False, # Ignore cache and build all
    file_glob:str='', # Only process notebooks matching glob (other files are always included)
    file_re:str='', # Only process notebooks matching regex (other files are always included)
    *, symlinks:bool=False, # Follow symlinks?
    path_glob:str=None, # Only include files whose full paths match glob (wildcards match separators)
    path_re:str=None, # Only include files whose full paths match regex
    folder_re:str=None, # Only enter folders matching regex
    skip_file_glob:str=None, # Skip files matching glob
    skip_file_re:str='^[_.]', # Skip files matching regex
    skip_folder_re:str='^[_.]', # Skip folders matching regex
):

Process notebooks in path for docs rendering