Notebook Functions

dagshub.notebook.save_notebook(repo, path='', branch=None, commit_message=None, versioning='git', colab_timeout=40) None

Save the notebook to DagsHub.

Parameters:
  • repo – Repository in the format of user/repo.

  • path – Path of the notebook in repo, including the filename. If left empty, saves the notebook to the root of the repo with format notebook-{date.now}.ipynb. If path is a directory and not a file (no extension), saves it to path/notebook-{date.now}.ipynb.

  • branch – The branch under which to save the notebook. Uses the repo default if not specified.

  • commit_message – Message of the commit with the notebook upload. Default is "Uploaded notebook {name}"

  • versioning – Either "git" or "dvc".

  • colab_timeout – For Colab environments sets the timeout for getting the notebook (in seconds). Raise this if you have a large notebook and encountering timeouts while saving it.

Note

Right now correctly saves only notebooks in a Colab environment. Regular Jupyter environment will have the execution history saved instead of the notebook.

Colab specific functions

dagshub.colab.login() str

Run custom colab-specific flow, which helps with setting up a repository, storage of which will be used as an alternative to Google Drive.

Returns the name of the repository that can be used with colab-related functionality (<user>/dagshub-drive)