a collection of tools to work with BPMN
Project description
BPMN Tools
a collection of tools to work with BPMN
Installation
% pip install bpmn-tools
See it in Action
>>> import xmltodict
>>> from bpmn_tools.flow import Process, Start, End, Task, Flow
>>> from bpmn_tools.collaboration import Collaboration, Participant
>>> from bpmn_tools.notation import Definitions
>>> from bpmn_tools.diagrams import Diagram, Plane, Shape, Edge
>>> from bpmn_tools.layout import simple
>>> activities = [
... Start(id="start"),
... Task('Say "Hello!"', id="hello"),
... Task('Wait for response...', id="wait"),
... End(id="end")
... ]
>>> process = Process(id="process").extend(activities).extend([
... Flow(source=activities[0], target=activities[1]),
... Flow(source=activities[1], target=activities[2]),
... Flow(source=activities[2], target=activities[3])
... ])
>>> collaboration = Collaboration(id="collaboration").append(
... Participant("lane", process, id="participant")
... )
>>> model = Definitions(id="definitions").extend([
... process,
... collaboration,
... ])
>>> model.append(
... Diagram(
... id="diagram",
... plane=Plane(id="plane", element=collaboration)
... )
... )
Definitions({'id': 'definitions', 'xmlns:bpmn': 'http://www.omg.org/spec/BPMN/20100524/MODEL', 'xmlns:bpmndi': 'http://www.omg.org/spec/BPMN/20100524/DI', 'xmlns:dc': 'http://www.omg.org/spec/DD/20100524/DC', 'xmlns:di': 'http://www.omg.org/spec/DD/20100524/DI'})
>>> simple.layout(model)
>>> xml = xmltodict.unparse(model.as_dict(with_tag=True), pretty=True)
>>> with open("hello.bpmn", "w") as fp:
... fp.write(xml)
...
2937
Use bpmn-to-image
to visualize the generated XML, because "what (sane) human being wants to read XML?" 😉
% npm install -g bpmn-to-image
% bpmn-to-image hello.bpmn:hello.png
Et voila...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bpmn-tools-0.1.0.tar.gz
(18.1 kB
view hashes)
Built Distribution
bpmn_tools-0.1.0-py3-none-any.whl
(22.6 kB
view hashes)
Close
Hashes for bpmn_tools-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 239fa5e0598c9c1999b076788edef64fb7f826cfb6ed3210485d10b6c4869437 |
|
MD5 | aa956c6bcda4a8615e411bb60fe47fcf |
|
BLAKE2b-256 | a128d4f9d38a234c8b5ff96cd7d3d2eda618f819971f00a024ce3755b6f74fc5 |