{ "metadata": { "kernelspec": { "codemirror_mode": "python", "display_name": "Echo", "language": "python", "name": "echo_kernel" }, "name": "", "signature": "sha256:3c92219980d36116204e8b00f5019c7bce7eeaf931e3047f17f280334b5d8e7f" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Echo Kernel: Simple Text Echo Wrapper Kernel" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Installation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Install the echo kernel by running `python setup.py install` from that directory.\n", "Then run `ipython notebook` from this directory.\n", "Select \"Echo\" from the top right dropdown list of kernels." ] }, { "cell_type": "code", "collapsed": false, "input": [ "Hello, world!" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 1, "text": [ "u'Hello, world!'" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Magics" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Like all of the Metakernels, the echo kernel comes with a base set of magics." ] }, { "cell_type": "code", "collapsed": false, "input": [ "%magic" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Line magics:\n", " %cd PATH - change current directory of session\n", " %connect_info - show connection information\n", " %download URL [FILENAME] - download file from URL\n", " %html CODE - display code as HTML\n", " %install_magic URL - download and install magic from URL\n", " %javascript CODE - send code as JavaScript\n", " %latex TEXT - display text as LaTeX\n", " %lsmagic - list the current line and cell magics\n", " %magic - show installed magics\n", " %plot [options] backend - configure plotting for the session.\n", " %python CODE - evaluate code as Python\n", " %reload_magics - reload the magics from the installed files\n", " %shell COMMAND - run the line as a shell command\n", "\n", "Cell magics:\n", " %%file [--append|-a] FILENAME - write contents of cell to file\n", " %%html - display contents of cell as HTML\n", " %%javascript - send contents of cell as JavaScript\n", " %%latex - display contents of cell as LaTeX\n", " %%python - evaluate contents of cell as Python\n", " %%shell - run the contents of the cell as shell commands\n", " %%time - show time to run cell\n", "\n", "Shell shortcut:\n", " ! COMMAND ... - execute command in shell\n", "\n", "Any cell magic can be made persistent for rest of session by using %%% prefix.\n", "\n" ] } ] }, { "cell_type": "code", "collapsed": false, "input": [ "%python print('hello, world!')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "hello, world!\n" ] } ], "prompt_number": 5 }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can get help on a magic by typing `?`" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%%html?" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 8 }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can also get help by pressing `SHIFT+TAB` at the end of the word." ] }, { "cell_type": "code", "collapsed": false, "input": [ "%lsmagic" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Code completion works for magics. Press tab below to see the completion (when not viewing through nbviewer)." ] }, { "cell_type": "code", "collapsed": false, "input": [ "%javas" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Completion also works for path names (local, absolute, or from the home `~` directory). Press `TAB` below for completion." ] }, { "cell_type": "code", "collapsed": false, "input": [ "echo_kernel.ip" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "%%file temp.txt\n", "This concludes our example.\n", "Goodbye, world!" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Created file 'temp.txt'.\n" ] } ], "prompt_number": 9 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }