Is there a way to add your own snippets in google colaboratory

  1. Create a snippets notebook and write your snippets there (make sure to provide a searchable title in a text block to each snippet - see the screenshot below).

  2. Copy the URL.

enter image description here

  1. Then, go to Tools > Preferences, paste the snippets notebook URL in Custom snippet notebook URL and save.

enter image description here

Now the snippets in the snippets notebook can be searched under Code Snippets Using the title provided in the text box.


See the tweet by @jakevdp here


We currently have not exposed a way to register additional snippets.

Curious if you'd be interested in personal snippets that follow you between notebooks, or notebook-specific snippets that only appear for a specific notebook.