Skip to content

Instantly share code, notes, and snippets.

@cathalmccabe
Created March 25, 2019 22:03
Show Gist options
  • Save cathalmccabe/8d26e7cc6de900dff067dd33bd7a7e7e to your computer and use it in GitHub Desktop.
Save cathalmccabe/8d26e7cc6de900dff067dd33bd7a7e7e to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Visual Python Debugger for Jupyter Notebooks\n",
"\n",
"Reference: https://thirdeyedata.io/the-visual-python-debugger-for-jupyter-notebooks-youve-always-wanted/\n",
"\n",
"## Install pixiedust"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!sudo pip3 install pixiedust"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Run cell below once, then restart kernel as prompted to complete installation. "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Pixiedust database opened successfully\n"
]
},
{
"data": {
"text/html": [
"\n",
" <div style=\"margin:10px\">\n",
" <a href=\"https://github.com/ibm-watson-data-lab/pixiedust\" target=\"_new\">\n",
" <img src=\"https://github.com/ibm-watson-data-lab/pixiedust/raw/master/docs/_static/pd_icon32.png\" style=\"float:left;margin-right:10px\"/>\n",
" </a>\n",
" <span>Pixiedust version 1.1.15</span>\n",
" </div>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import pixiedust"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Try pixie debugger"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"pixiedust": {
"displayParams": {}
}
},
"outputs": [
{
"data": {
"text/html": [
"<style type=\"text/css\">.pd_warning{display:none;}</style><div class=\"pd_warning\"><em>Hey, there's something awesome here! To see it, open this notebook outside GitHub, in a viewer like Jupyter</em></div>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"pixieapp_metadata": null
},
"output_type": "display_data"
}
],
"source": [
"%%pixie_debugger\n",
"import random\n",
"def find_max (values):\n",
" max = 0\n",
" for val in values:\n",
" if val > max:\n",
" max = val\n",
" return max\n",
"find_max(random.sample(range(100), 10))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment