diagrams-magic
The diagrams-magic is an IPython magic that enables calling diagrams within IPython kernel to draw graphs with pure texts. The most common use case, however, would be to use this magic within Jupyter Notebook, which integrates the IPython kernel within it.
Requirements
-
diagramsThe mechanism of this magic is to call
diagramsinstalled on local machine. So please ensure thatdiagramsis accessible on your system or in your virtual environment.If you have
nodeandnpminstalled, you may installdiagramswithnpm install -g diagrams -
A (virtual) display driver
diagrams flowchartanddiagrams sequencestarts an Electron app that requires a display to run. If you are using Windows or MacOS, this shouldn't be a problem.However if you are to deploy this magic on a headless Linux backend,
diagrams flowchartanddiagrams sequencewill report 'Cannot open display' error.This can be circumvented with a virtual display. We suggest installing
xvfbso that our magic will detect the installedxvfb-runcommand and use it. The solution is detailed at Electron's webpage.
Installation
-
From PIP:
pip install diagrams-magic
-
Development install:
git clone https://github.com/chunxy/diagrams-magic.git cd diagrams-magic pip install -e ./
Usage
As with usual IPython magic, remember to %load_ext diagrams-magic before using this magic.
This is a cell magic. In the first line of your cell, type %%diagrams (flowchart|dot|sequence|railroad) [name] to indicate which driver you are to use and the name of image file. If no name is provided, no image file will be generated in your current directory (but the image will still be available in the output cell). In the rest of this cell, simply type in the graph descriptions.
See the demo file for reference.
Known Issue(s)
-
Invalid asm.js: Function definition doesn't match useThere might be error like above when you are using the
dotdriver. This is a known issue caused by the upstreamviz.js. Usually the output won't be affected and thus you can ignore it, as long as the red error message won't be too harsh for your eyes.
Metadata
Release files for diagrams-magic 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| diagrams-magic-0.0.2.tar.gz | 4.0 kB | Details |
Release files / diagrams-magic-0.0.2.tar.gz
| Download URL | diagrams-magic-0.0.2.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
054bfba44412dba43a49924b9327188f5c841a8a0fef6db175a51528f5c00db7
|
|
BLAKE2b-256 checksum How to use checksums |
55319caaa72eae3b3db4783645b58d9c60e25bcb5ae312b963e54ba91a409ea8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.2
|