Skip to content

Instantly share code, notes, and snippets.

@juhasch
Created April 1, 2013 19:28
Show Gist options
  • Save juhasch/5287081 to your computer and use it in GitHub Desktop.
Save juhasch/5287081 to your computer and use it in GitHub Desktop.
breakpoint-demo.ipynb
{
"metadata": {
"name": "breakpoint-demo"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Demo for breakpoint extension\n",
"---\n",
"The breakpoint extension allows you to run parts of a notebook. <br>\n",
"- You can set a breakpoint at any code cell by clicking at the \"In []:\" part of the cell.<br>\n",
"- If a breakpoint is activated, a small red circle will appear.<br>\n",
"- Breakpoints will be saved with the notebook.<br>\n",
"- You can execute cells from the current cell to the next breakpoint by clicking on the \"Run Until Breakpoint\" button at the toolbar.<br>\n",
"- You can clear all breakpoints by clicking on the \"Clear all breakpoints\" button at the toolbar.<br>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The breakpoint information is stored in the notebook metadata as:\n",
"<pre>\n",
"{\n",
" \"run_control\": {\n",
" \"breakpoint\": true\n",
" }\n",
"}\n",
"</pre>"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# This is a codecell with a breakpoint\n",
"i=1"
],
"language": "python",
"metadata": {
"run_control": {
"breakpoint": true
}
},
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"run_control": {
"breakpoint": true
}
},
"source": [
"This is not a code cell"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print 2*i"
],
"language": "python",
"metadata": {
"run_control": {
"breakpoint": false
}
},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"i+=1\n",
"print i"
],
"language": "python",
"metadata": {
"run_control": {
"breakpoint": false
}
},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# This is a codecell with a breakpoint\n",
"i+=3\n",
"print i"
],
"language": "python",
"metadata": {
"run_control": {
"breakpoint": true
}
},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"i+=5\n",
"print i"
],
"language": "python",
"metadata": {
"run_control": {
"breakpoint": false
}
},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment