syrenka is mermaid markdown generator
Project description
syrenka
syrenka is mermaid markdown generator
Description
The aim of this project is to provide easy to use classes for generating mermaid charts and diagrams.
Installation
pip install syrenka
Example
Here are current classes in syrenka module:
---
title: syrenka class diagram
---
classDiagram
class SyrenkaClass{
+\_\_init\_\_(self, cls, bool skip_underscores)
+to_code(self, int indent_level, str indent_base)
}
SyrenkaGeneratorBase <|-- SyrenkaClass
class SyrenkaClassDiagram{
+\_\_init\_\_(self, str title)
+add_class(self, cls)
+add_classes(self, classes)
+to_code(self, int indent_level, str indent_base)
}
SyrenkaGeneratorBase <|-- SyrenkaClassDiagram
class SyrenkaFlowchart{
+\_\_init\_\_(self, str title, FlowchartDirection direction, MutableSequence nodes)
+add(self, Node node)
+connect(self, Node source, Node target, EdgeType edge_type)
+connect_by_id(self, str source_id, str target_id, EdgeType edge_type)
+get_node_by_id(self, str id)
+remove(self, Node node, bool exception_if_not_exists)
+to_code(self, int indent_level, str indent_base)
}
Subgraph <|-- SyrenkaFlowchart
class Edge{
+\_\_init\_\_(self, EdgeType edge_type, text, source, target)
+to_code(self, indent_level, indent_base)
+valid(self)
}
SyrenkaGeneratorBase <|-- Edge
class EdgeType{
<<enumeration>>
ArrowEdge
CircleEdge
CrossEdge
DottedLink
InvisibleLink
MultiArrowEdge
MultiCircleEdge
MultiCrossEdge
OpenLink
ThickLink
}
class Enum{
<<enumeration>>
}
class FlowchartDirection{
<<enumeration>>
BottomToTop
LeftToRight
RightToLeft
TopToBottom
}
class MutableSequence{
+append(self, value)
+clear(self)
+count(self, value)
+extend(self, values)
+index(self, value, start, stop)
+insert(self, index, value)
+pop(self, index)
+remove(self, value)
+reverse(self)
}
Sequence <|-- MutableSequence
class Node{
+\_\_init\_\_(self, str id, Optional text, NodeShape shape)
+to_code(self, int indent_level, str indent_base)
}
SyrenkaGeneratorBase <|-- Node
class NodeShape{
<<enumeration>>
AssymetricShape
Circle
CylindricalShape
Default
DoubleCircle
HexagonNode
Parallelogram
Rhombus
RoundEdges
StadiumShapedNode
SubroutineShape
Trapezoid
TrapezoidAlt
}
class OrderedDict{
}
dict <|-- OrderedDict
class StringHelper{
+indent(int level, int increment, str indent_base)
}
class Subgraph{
+\_\_init\_\_(self, str id, text, FlowchartDirection direction, MutableSequence nodes)
+add(self, Node node)
+get_node_by_id(self, str id)
+remove(self, Node node, bool exception_if_not_exists)
+to_code(self, int indent_level, str indent_base)
}
Node <|-- Subgraph
class SyrenkaGeneratorBase{
+\_\_init\_\_(self)
+to_code(self, int indent_level, str indent_base)
}
ABC <|-- SyrenkaGeneratorBase
class SyrenkaEnum{
+\_\_init\_\_(self, cls, bool skip_underscores)
+to_code(self, int indent_level, str indent_base)
}
SyrenkaGeneratorBase <|-- SyrenkaEnum
class ABC{
}
class module{
}
So how do we get it? This is a code snippet that does it:
import syrenka
from syrenka.base import classes_in_module
class_diagram = syrenka.SyrenkaClassDiagram("syrenka class diagram")
# class_diagram.add_classes(generate_class_list_from_module(module_name="syrenka", starts_with="Syrenka"))
class_diagram.add_classes(classes_in_module(module_name="syrenka", nested=True))
for line in class_diagram.to_code():
print(line)
and the output:
---
title: syrenka class diagram
---
classDiagram
class SyrenkaClass{
+\_\_init\_\_(self, cls, bool skip_underscores)
+to_code(self, int indent_level, str indent_base)
}
SyrenkaGeneratorBase <|-- SyrenkaClass
class SyrenkaClassDiagram{
+\_\_init\_\_(self, str title)
+add_class(self, cls)
+add_classes(self, classes)
+to_code(self, int indent_level, str indent_base)
}
SyrenkaGeneratorBase <|-- SyrenkaClassDiagram
class SyrenkaFlowchart{
+\_\_init\_\_(self, str title, FlowchartDirection direction, MutableSequence nodes)
+add(self, Node node)
+connect(self, Node source, Node target, EdgeType edge_type)
+connect_by_id(self, str source_id, str target_id, EdgeType edge_type)
+get_node_by_id(self, str id)
+remove(self, Node node, bool exception_if_not_exists)
+to_code(self, int indent_level, str indent_base)
}
Subgraph <|-- SyrenkaFlowchart
class Edge{
+\_\_init\_\_(self, EdgeType edge_type, text, source, target)
+to_code(self, indent_level, indent_base)
+valid(self)
}
SyrenkaGeneratorBase <|-- Edge
class EdgeType{
<<enumeration>>
ArrowEdge
CircleEdge
CrossEdge
DottedLink
InvisibleLink
MultiArrowEdge
MultiCircleEdge
MultiCrossEdge
OpenLink
ThickLink
}
class Enum{
<<enumeration>>
}
class FlowchartDirection{
<<enumeration>>
BottomToTop
LeftToRight
RightToLeft
TopToBottom
}
class MutableSequence{
+append(self, value)
+clear(self)
+count(self, value)
+extend(self, values)
+index(self, value, start, stop)
+insert(self, index, value)
+pop(self, index)
+remove(self, value)
+reverse(self)
}
Sequence <|-- MutableSequence
class Node{
+\_\_init\_\_(self, str id, Optional text, NodeShape shape)
+to_code(self, int indent_level, str indent_base)
}
SyrenkaGeneratorBase <|-- Node
class NodeShape{
<<enumeration>>
AssymetricShape
Circle
CylindricalShape
Default
DoubleCircle
HexagonNode
Parallelogram
Rhombus
RoundEdges
StadiumShapedNode
SubroutineShape
Trapezoid
TrapezoidAlt
}
class OrderedDict{
}
dict <|-- OrderedDict
class StringHelper{
+indent(int level, int increment, str indent_base)
}
class Subgraph{
+\_\_init\_\_(self, str id, text, FlowchartDirection direction, MutableSequence nodes)
+add(self, Node node)
+get_node_by_id(self, str id)
+remove(self, Node node, bool exception_if_not_exists)
+to_code(self, int indent_level, str indent_base)
}
Node <|-- Subgraph
class SyrenkaGeneratorBase{
+\_\_init\_\_(self)
+to_code(self, int indent_level, str indent_base)
}
ABC <|-- SyrenkaGeneratorBase
class SyrenkaEnum{
+\_\_init\_\_(self, cls, bool skip_underscores)
+to_code(self, int indent_level, str indent_base)
}
SyrenkaGeneratorBase <|-- SyrenkaEnum
class ABC{
}
class module{
}
ready to use mermaid markdown
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file syrenka-0.1.6.tar.gz.
File metadata
- Download URL: syrenka-0.1.6.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae379e2619541e0c1a8c1c795a3716ad2e4822df9619b2d5a62892f4d0906e60
|
|
| MD5 |
74a92126f13dfe263b52c93ee4e15617
|
|
| BLAKE2b-256 |
f4239764c3d73917ed673f4e494748a1099e66bd30218e4d49eaf85c321b462d
|
Provenance
The following attestation bundles were made for syrenka-0.1.6.tar.gz:
Publisher:
python-publish.yml on bartlomiejcieszkowski/syrenka
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
syrenka-0.1.6.tar.gz -
Subject digest:
ae379e2619541e0c1a8c1c795a3716ad2e4822df9619b2d5a62892f4d0906e60 - Sigstore transparency entry: 185035001
- Sigstore integration time:
-
Permalink:
bartlomiejcieszkowski/syrenka@27bafeca6f37ee36dd16931454ac62da71b6010e -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/bartlomiejcieszkowski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@27bafeca6f37ee36dd16931454ac62da71b6010e -
Trigger Event:
release
-
Statement type:
File details
Details for the file syrenka-0.1.6-py3-none-any.whl.
File metadata
- Download URL: syrenka-0.1.6-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cb59fc8e7b7bd546c95c58aff63a32777799c56bfc5df43473dcb30164d37d9
|
|
| MD5 |
24b5d1a79eb04db34066ab9ffcc13f30
|
|
| BLAKE2b-256 |
64d9331934428ad4bacc3c50ae675b34bbd065ff1040b7d97c86021d9c9ba462
|
Provenance
The following attestation bundles were made for syrenka-0.1.6-py3-none-any.whl:
Publisher:
python-publish.yml on bartlomiejcieszkowski/syrenka
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
syrenka-0.1.6-py3-none-any.whl -
Subject digest:
7cb59fc8e7b7bd546c95c58aff63a32777799c56bfc5df43473dcb30164d37d9 - Sigstore transparency entry: 185035006
- Sigstore integration time:
-
Permalink:
bartlomiejcieszkowski/syrenka@27bafeca6f37ee36dd16931454ac62da71b6010e -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/bartlomiejcieszkowski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@27bafeca6f37ee36dd16931454ac62da71b6010e -
Trigger Event:
release
-
Statement type: