A Python package which defines a PlantUML cell magic for IPython.
Branch: master
Clone or download
jbn Merge pull request #12 from ryancollingwood/patch-1
Cell magic arguments required for local rendering
Latest commit 007bc57 Mar 25, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
iplantuml Bump version for jacobdr's bugfix Dec 7, 2017
.gitignore Fix #3, Fix #5 Sep 16, 2017
.travis.yml Refactor Nov 3, 2017
CNAME Create CNAME Oct 23, 2017
LICENSE Refactor Nov 3, 2017
MANIFEST.in Refactor setup May 11, 2017
README.rst Cell magic arguments required for local rendering Mar 15, 2018
requirements.txt Refactor Nov 3, 2017
setup.cfg Refactor setup May 11, 2017
setup.py Refactor Nov 3, 2017

README.rst

https://travis-ci.org/jbn/IPlantUML.svg?branch=master

What is it?

This Python package defines a PlantUML cell magic for IPython. It lets you generate UML diagrams as inline SVG in your notebook. I'll add embellishments as needed. But, for now, I just needed something that worked and existed as a package (in pypi).

I based my code on Steven Burke's plantuml gist.

Installation

First, install IPlantuml with pip.

pip install iplantuml

Then, install plantuml. On Debian based system you can install plantuml package. Otherwise you can download plantuml.jar and copy it to /usr/local/bin/plantuml.jar.

sudo apt install plantuml

Alternatively you can set a custom path for plantuml.jar during installation

git clone https://github.com/jbn/IPlantUML.git
cd IPlantUML
python setup.py install iplantuml --jarpath /my/custom/path/plantuml.jar

Usage

In Ipython, first,

import iplantuml

then, create a cell like,

%%plantuml --jar

@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
@enduml

The output will be the generated SVG UML diagram using the plantuml.jar on your local system. To utilise remote rendering on plantweb omit the --jar argument:

%%plantuml

@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
@enduml

By default, the magic removes the intermediate (tmp.uml) and target (tmp.svg) files. However, if you enter a name in the %%plantuml line, it retains both files of $name.uml and $name.svg. For example,

%%plantuml auth

@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
@enduml

generates and retains auth.uml and auth.svg.