cli

CLI commands

source

nbdev_filter

def nbdev_filter(
    nb_txt:str=None, # Notebook text (uses stdin if not provided)
    fname:str=None, # Notebook to read (uses `nb_txt` if not provided)
    printit:bool_arg=True, # Print to stdout?
):

A notebook filter for Quarto


source

extract_tgz

def extract_tgz(
    url, dest:str='.'
):

Call self as a function.


source

nbdev_new

def nbdev_new(
    name:Annotated=None, # Directory to create and scaffold in (defaults to the current directory)
    template:str='answerdotai/nbdev3-template', # Template repo
    tag:str=None, # Template release tag (defaults to the latest release)
    repo:str=None, # Repo name
    branch:str='main', # Repo default branch
    user:str=None, # Repo username
    author:str=None, # Package author's name
    author_email:str=None, # Package author's email address
    description:str='', # Short summary of the package
    path:str='.', # Path to create config file
    min_python:str='3.10', # Minimum Python version
    license:str='Apache-2.0', # License (SPDX identifier)
):

Create an nbdev project.

It works by copying contents from the latest tagged nbdev3-template release, and rendering template variables using the created pyproject.toml. Settings can be passed via command line args; missing settings are inferred from the current git/GitHub repo where one exists.

Passing name instead scaffolds a fresh directory with no repo needed: author details still come from git’s global config, but user and description must be passed explicitly, and the printed gh repo create command connects the result to GitHub afterwards.


source

nbdev_update_license

async def nbdev_update_license(
    to:str=None, # update license to
):

Allows you to update the license of your project.


source

nb_export_cli

def nb_export_cli(
    nbname, debug:store_true=False, # Debug flag
    lib_path:str=None, # Path to destination library.  If not in a nbdev project, defaults to current directory.
    name:str=None, # Name of python script {name}.py to create.
    solo_nb:bool=False, # Export single notebook outside of an nbdev project.
):

Export a single nbdev notebook to a python script.


source

watch_export

def watch_export(
    nbs:str=None, # Nb directory to watch for changes
    lib:str=None, # Export directory to write py files to
    force:bool=False, # Ignore nbdev config if in nbdev project
):

Use nb_export on ipynb files in nbs directory on changes using nbdev config if available

Help


source

chelp

def chelp():

Show help for all console scripts

chelp()
nb-export                 Export a single nbdev notebook to a python script.

nbdev-bump-version        Increment version in __init__.py by one

nbdev-changelog           Create a CHANGELOG.md file from closed and labeled GitHub issues

nbdev-clean               Clean all notebooks in `fname` to avoid merge conflicts

nbdev-conda               Create a `meta.yaml` file ready to be built into a package, and optionally build and upload it

nbdev-contributing        Create CONTRIBUTING.md from contributing_nb (defaults to 'contributing.ipynb' if present). Skips if the file doesn't exist.

nbdev-create-config       Create a pyproject.toml config file.

nbdev-diff                Cell-level diffs for changed notebooks between two git refs

nbdev-diff-driver         Git external diff driver for notebooks; installed by `nbdev-install-hooks`

nbdev-docs                Create Quarto docs and README.md

nbdev-export              Export notebooks in `path` to Python modules

nbdev-filter              A notebook filter for Quarto

nbdev-fix                 Create working notebook from conflicted notebook `nbname`

nbdev-help                Show help for all console scripts

nbdev-install             Install Quarto and the current library

nbdev-install-hooks       Install Jupyter and git hooks to automatically clean, trust, and fix merge conflicts in notebooks

nbdev-install-quarto      Install latest Quarto on macOS or Linux, prints instructions for Windows

nbdev-merge               Git merge driver for notebooks

nbdev-migrate             Convert all markdown and notebook files in `path` from v1 to v2

nbdev-migrate-config      Migrate settings.ini to pyproject.toml

nbdev-new                 Create an nbdev project.

nbdev-prepare             Export, test, and clean notebooks, and render README if needed

nbdev-preview             Preview docs locally

nbdev-proc-nbs            Process notebooks in `path` for docs rendering

nbdev-pypi                Create and upload Python package to PyPI

nbdev-readme              Create README.md from readme_nb (index.ipynb by default). Skips if the file doesn't exist.

nbdev-release-both        Release both conda and PyPI packages

nbdev-release-gh          Create the changelog, optionally edit it, then push and create the GitHub release

nbdev-release-git         Tag and create a release in GitHub for the current version

nbdev-requirements        Writes a `requirements.txt` file to `directory` based on pyproject.toml.

nbdev-sidebar             Create sidebar.yml

nbdev-test                Test in parallel notebooks matching `path`, passing along `flags`

nbdev-trust               Trust notebooks matching `fname`.

nbdev-update              Propagate change in modules matching `fname` to notebooks that created them

nbdev-update-license      Allows you to update the license of your project.

watch-export              Use `nb_export` on ipynb files in `nbs` directory on changes using nbdev config if available