0.2.5 • Published 6 years ago

@quentinandre/jupyterlab_snippets v0.2.5

Weekly downloads
6
License
BSD-3-Clause
Repository
github
Last release
6 years ago

jupyterlab_snippets

A JupyterLab extension to save and add code snippets to your notebooks.

Current version: 0.1.9

alt text

Prerequisites

  • JupyterLab
  • Python >= 3.5

Installation

You need to install the two parts of the extension: the server extension and the lab extension.

Server Extension

pip install jupyterlab_snippets

Lab Extension

jupyter labextension install @quentinandre/jupyterlab_snippets

Usage

Saving a code snippet

Right-click on a selected cell in a notebook. A dialog prompt will open, and you will be able to save the content of the cell as a code snippet. If the name you have entered already exists, you will be warned and have the possibility to overwrite the existing snippet.

Inserting a code snippet

In the "Code Snippets" tab, click the "copy" icon next to the snippet that you want to insert. The snippet will be inserted at the cursor's position in the current activate notebook.

Deleting a code snippet

In the "Code Snippets" tab, click the "delete" icon next to the snippet that you want to delete. After confirmation, the snippet will be deleted.

Editing a cope snippet

As of version 0.1.9, code snippets cannot be edited from the extension. The best way to edit a code snippet is to import it as a cell, change the content of the cell in the notebook, and save the new cell to overwrite the existing snippet.

Sharing code snippets between users or computers

The code snippets saved by the extension are JSON files that live at "~User/.jupyter/lab/user-settings/jupyterlab_snippets". If you want to share your snippets with other users or another computer, simply copy and paste the content of this folder.