Framework for Python

Notebooks & Scripts

make_notebook()

Create a notebook from a stub.

Usage

make_notebook(
    name: str,
    type: NotebookType | None = None,
    dir: str | Path | None = None,
    stub: str = 'default',
    *,
    overwrite: bool = False,
    subdir: str | None = None,
) -> Path

Arguments

Name Type Default Description
name required str

The notebook name. It is turned into a file name such as data-cleaning.qmd. An extension (.qmd, .ipynb, or .py) sets the type.

type NotebookType | None None

"quarto" (the default), "jupyter", or "script". Without it, scaffold: notebook_format in the settings decides, so a Scripts-only project (script) gets a .py script.

dir str | Path | None None

The folder. Defaults to directories: notebooks in the settings, relative to the project root.

stub str 'default'

The stub to start from, such as "default" or "minimal".

overwrite bool False

Replace an existing file.

subdir str | None None

A subfolder of dir.

Value

The path of the new file.