{ "metadata": { "name": "", "signature": "sha256:8cc04ebd48f148f0ed91ebc8e3dc05e795fdd5af1cf19d7c087a548c117182b8" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Demo of the [plantuml](http://plantuml.sourceforge.net/) magics example posted on [stack overflow](http://stackoverflow.com/questions/20303335/ipython-notebook-plantuml-extension) to enable plantuml users to create inline UML diagrams.\n", "\n", "_note_ python module on original stack overflow post was committed to git repo to improve accessibility for all.\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%install_ext https://raw.githubusercontent.com/sberke/ipython-plantuml/master/plantuml_magics.py" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Installed plantuml_magics.py. To use it, type:\n", " %load_ext plantuml_magics\n" ] } ], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [ "%load_ext plantuml" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ "For this example [plantuml.jar](http://sourceforge.net/projects/plantuml/files/plantuml.jar/download) is located in the current working directory." ] }, { "cell_type": "code", "collapsed": false, "input": [ "import glob\n", "glob.glob(r'./*.jar')" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 3, "text": [ "['./plantuml.jar']" ] } ], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [ "%%plantuml figure1\n", "\n", "@startuml\n", "Alice -> Bob: Authentication Request\n", "Bob --> Alice: Authentication Response\n", "@enduml " ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 4, "svg": [ "AliceAliceBobBobAuthentication RequestAuthentication Response" ], "text": [ "" ] } ], "prompt_number": 4 }, { "cell_type": "markdown", "metadata": {}, "source": [ "[@chickenbit](http://chickenbit.com/blog/2014/10/inline-plantuml-diagrams-in-ipython-notebook/)\n", "\n", "eol" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%install_ext http://raw.github.com/jrjohansson/version_information/master/version_information.py " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Installed version_information.py. To use it, type:\n", " %load_ext version_information\n" ] } ], "prompt_number": 5 }, { "cell_type": "code", "collapsed": false, "input": [ "%load_ext version_information\n", "\n", "%version_information jinja2,sphinx, pyzmq, pygments, tornado, nose, readline, gnureadline" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "
SoftwareVersion
Python2.7.1 64bit [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]
IPython2.3.0
OSDarwin 11.4.2 x86_64 i386 64bit
jinja22.7.3
sphinx1.2.3
pyzmq14.4.0
pygments1.6
tornado4.0.2
nose1.3.4
readline6.2.4.1
gnureadline6.3.3
Fri Oct 31 23:20:26 2014 PDT
" ], "json": [ "{\"Software versions\": [{\"version\": \"2.7.1 64bit [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]\", \"module\": \"Python\"}, {\"version\": \"2.3.0\", \"module\": \"IPython\"}, {\"version\": \"Darwin 11.4.2 x86_64 i386 64bit\", \"module\": \"OS\"}, {\"version\": \"2.7.3\", \"module\": \"jinja2\"}, {\"version\": \"1.2.3\", \"module\": \"sphinx\"}, {\"version\": \"14.4.0\", \"module\": \"pyzmq\"}, {\"version\": \"1.6\", \"module\": \"pygments\"}, {\"version\": \"4.0.2\", \"module\": \"tornado\"}, {\"version\": \"1.3.4\", \"module\": \"nose\"}, {\"version\": \"6.2.4.1\", \"module\": \"readline\"}, {\"version\": \"6.3.3\", \"module\": \"gnureadline\"}]}" ], "latex": [ "\\begin{tabular}{|l|l|}\\hline\n", "{\\bf Software} & {\\bf Version} \\\\ \\hline\\hline\n", "Python & 2.7.1 64bit [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] \\\\ \\hline\n", "IPython & 2.3.0 \\\\ \\hline\n", "OS & Darwin 11.4.2 x86\\_64 i386 64bit \\\\ \\hline\n", "jinja2 & 2.7.3 \\\\ \\hline\n", "sphinx & 1.2.3 \\\\ \\hline\n", "pyzmq & 14.4.0 \\\\ \\hline\n", "pygments & 1.6 \\\\ \\hline\n", "tornado & 4.0.2 \\\\ \\hline\n", "nose & 1.3.4 \\\\ \\hline\n", "readline & 6.2.4.1 \\\\ \\hline\n", "gnureadline & 6.3.3 \\\\ \\hline\n", "\\hline \\multicolumn{2}{|l|}{Fri Oct 31 23:20:26 2014 PDT} \\\\ \\hline\n", "\\end{tabular}\n" ], "metadata": {}, "output_type": "pyout", "prompt_number": 6, "text": [ "Software versions\n", "Python 2.7.1 64bit [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]\n", "IPython 2.3.0\n", "OS Darwin 11.4.2 x86_64 i386 64bit\n", "jinja2 2.7.3\n", "sphinx 1.2.3\n", "pyzmq 14.4.0\n", "pygments 1.6\n", "tornado 4.0.2\n", "nose 1.3.4\n", "readline 6.2.4.1\n", "gnureadline 6.3.3\n", "Fri Oct 31 23:20:26 2014 PDT" ] } ], "prompt_number": 6 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 6 } ], "metadata": {} } ] }