Ledenel / IPlantUML

A Python package which defines a PlantUML cell magic for IPython.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 IPlantum with pip.

pip install iplantuml

Then, download plantuml.jar and copy it to /usr/local/bin/plantuml.jar.

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

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

The output will be the generated SVG UML diagram.

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.

About

A Python package which defines a PlantUML cell magic for IPython.

License:MIT License


Languages

Language:Python 100.0%