Functions to setup a colab runtime for use with nbdev and github.
IN_COLAB = 'google.colab' in str(get_ipython())

I think checking the name of the ipython shell ↑ is the most reliable way of checking if we're running in colab or not.

setup_git[source]

setup_git(git_url:str, git_branch:str, name:str, password:str, email:str)

Link your mounted drive to GitHub

git_push[source]

git_push(git_branch:str, message:str)

Convert notebooks to scripts and then push to the library

read_config[source]

read_config(project_name)

setup_project[source]

setup_project(project_name)

Set-up the colab runtime for project_name

This function will:

  • mount your google drive to /content/drive,
  • read project settings from /content/drive/My Drive/nbdev_colab_projects.ini,
  • git clone the project to project_path if project_path doesn't already exist,
  • cd to project_path,
  • install nbdev,
  • run setup_git and
  • return config (the ConfigParser used to read nbdev_colab_projects.ini) and project_config (the project section of config)

init_notebook[source]

init_notebook(project_name)