Skip to content

snippets template aimed at jupyter notebook snippets extension (Nbextensions/snippets)

Notifications You must be signed in to change notification settings

aflaisler/sklearn_snippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Snippets

Code cell snippets.

This extension adds a drop-down menu to the IPython toolbar that allows easy insertion of code snippet cells into the current notebook. The code snippets are defined in a JSON file in nbextensions/snippets/snippets.json and an example snippet is included with this extension.

Adding new snippets

Snippets are specified by adding a new JSON block to the list of existing snippets in nbextensions/snippets/snippets.json. For example, to add a new snippet that imports numpy, matplotlib, and a print statement, the JSON file should be modified from:

{
    "snippets" : [
        {
            "name" : "example",
            "code" : [
                "# This is an example snippet!",
                "# To create your own, add a new snippet block to the",
                "# snippets.json file in your jupyter nbextensions directory:",
                "# /nbextensions/snippets/snippets.json",
                "import this"
            ]
        }
    ]
}

to this:

{
    "snippets" : [
        {
            "name" : "example",
            "code" : [
                "# This is an example snippet!",
                "# To create your own, add a new snippet block to the",
                "# snippets.json file in your jupyter nbextensions directory:",
                "# /nbextensions/snippets/snippets.json",
                "import this"
            ]
        },
        {
            "name" : "some imports",
            "code" : [
                "import numpy as np",
                "import matplotlib as mpl",
                "print('spam')"
            ]
        }
    ]
}

About

snippets template aimed at jupyter notebook snippets extension (Nbextensions/snippets)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published