# My Notebook\n", + "
def foo():\n",
+ " return "foo"\n",
+ "
def has_ip_syntax():\n",
+ " listing = !ls\n",
+ " return listing\n",
+ "
def whatsmyname():\n",
+ " return __name__\n",
+ "
%s\" % cell.source)\n", " display(HTML('\\n'.join(html)))\n", @@ -341,11 +454,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "importing notebook from /Users/minrk/dev/ip/mine/examples/IPython Kernel/nbpackage/mynotebook.ipynb\n" + ] + } + ], "source": [ "from nbpackage import mynotebook" ] @@ -359,11 +480,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'foo'" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "mynotebook.foo()" ] @@ -379,11 +511,46 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['Animations Using clear_output.ipynb',\n", + " 'Background Jobs.ipynb',\n", + " 'Beyond Plain Python.ipynb',\n", + " 'Capturing Output.ipynb',\n", + " 'Cell Magics.ipynb',\n", + " 'Custom Display Logic.ipynb',\n", + " 'Importing Notebooks.ipynb',\n", + " 'Index.ipynb',\n", + " 'Plotting in the Notebook.ipynb',\n", + " 'Raw Input in the Notebook.ipynb',\n", + " 'Rich Output.ipynb',\n", + " 'Script Magics.ipynb',\n", + " 'SymPy.ipynb',\n", + " 'Terminal Usage.ipynb',\n", + " 'Third Party Rich Output.ipynb',\n", + " 'Trapezoid Rule.ipynb',\n", + " 'Working With External Code.ipynb',\n", + " '__pycache__',\n", + " 'data',\n", + " 'example-demo.py',\n", + " 'gui',\n", + " 'ipython-completion.bash',\n", + " 'ipython-get-history.py',\n", + " 'ipython.desktop',\n", + " 'nbpackage']" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "mynotebook.has_ip_syntax()" ] @@ -405,11 +572,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "__init__.py \u001b[34m__pycache__\u001b[m\u001b[m/ other.ipynb\r\n" + ] + } + ], "source": [ "ls nbpackage/nbs" ] @@ -424,22 +599,58 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
This notebook just defines `bar`\n", + "
def bar(x):\n",
+ " return "bar" * x\n",
+ "