The nbd_colab API exposes the following to set up a new project with nbdev, Google Colaboratory, Google Drive and GitHub.

Utils

check_input[source]

check_input(type, input)

Check the users input and exit cell if invalid

get_dest_dir[source]

get_dest_dir()

Prompts user to input destination dir for repository clone and checks it exists

get_repo[source]

get_repo(dir)

Prompts user to enter repository name and checks it doesn't already exist in destination dir

class StopExecution[source]

StopExecution() :: Exception

Gracefully exit cell execution

API

drive_setup[source]

drive_setup()

Connect the current Colab instance to the users Google Drive

change_dir[source]

change_dir(path)

Change directory to 'path'

home_dir[source]

home_dir()

Change directory to the users home directory on Google Drive '/content/drive/My Drive'

run_subprocess[source]

run_subprocess(cmd)

Run a subprocess and return success (0) or error (!0).

clone_new_repo[source]

clone_new_repo()

Clone nbdev GitHUb template repo to google drive and configure

Repositories will be cloned to '/content/drive/My Drive' by default but this can be customized to anywhere on the users Google Drive at the first input prompt. Successfully cloned repositories are automatically configured with the users username and email (required by GitHub) and nbdev_git_hooks is installed.Nbdev_git_hooks sanitises notebooks of unnecessary metadata prior to git pushes.

All user information is purged from nbdev immediately after use but persists in the local repository configuration file (.git.config). See cautionary note in the docs overview.