Skip to main content

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 with names starting with "Syrenka" in syrenka module:

---
title: syrenka class diagram
---
classDiagram
    class SyrenkaClass{
        -cls
        -indent
        -skip_underscores
        +\_\_init\_\_(self, cls, skip_underscores)
        +to_code(self, indent_level, indent_base)
    }
    SyrenkaGeneratorBase <|-- SyrenkaClass
    class SyrenkaClassDiagram{
        -title
        -unique_classes
        -classes
        +\_\_init\_\_(self, title)
        +add_class(self, cls)
        +add_classes(self, classes)
        +to_code(self, indent_level, indent_base)
    }
    SyrenkaGeneratorBase <|-- SyrenkaClassDiagram
    class SyrenkaFlowchart{
        +\_\_init\_\_(self, title, direction, nodes)
        +add(self, node)
        +connect(self, source, target, edge_type)
        +connect_by_id(self, source_id, target_id, edge_type)
        +get_node_by_id(self, id)
        +remove(self, node, exception_if_not_exists)
        +to_code(self, indent_level, indent_base)
    }
    Subgraph <|-- SyrenkaFlowchart
    class Edge{
        -id
        -edge_type
        -text
        -source
        -target
        +\_\_init\_\_(self, edge_type, text, source, target)
        +to_code(self, indent_level, indent_base)
        +valid(self)
    }
    SyrenkaGeneratorBase <|-- Edge
    class EdgeType{
    }
    Enum <|-- EdgeType
    class Enum{
    }
    class FlowchartDirection{
    }
    Enum <|-- FlowchartDirection
    class MutableSequence{
        +\_\_init\_\_(type(self)
        +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{
        -id
        -text
        -shape
        +\_\_init\_\_(self, id, text, shape)
        +to_code(self, indent_level, indent_base)
    }
    SyrenkaGeneratorBase <|-- Node
    class NodeShape{
    }
    Enum <|-- NodeShape
    class OrderedDict{
        +\_\_init\_\_(type(self)
        +clear()
        +copy()
        +fromkeys()
        +get()
        +items()
        +keys()
        +move_to_end(or beginning if last is false)
        +pop(key[,default])
        +popitem(key, value)
        +setdefault()
        +update()
        +values()
    }
    dict <|-- OrderedDict
    class StringHelper{
        +\_\_init\_\_(type(self)
        +indent(level, increment, indent_base)
    }
    class Subgraph{
        -NodeShape
        -Default
        -edges
        -direction
        -OrderedDict
        -nodes_dict
        -subgraphs_dict
        -isinstance
        -Subgraph
        -id
        +\_\_init\_\_(self, id, text, direction, nodes)
        +add(self, node)
        +get_node_by_id(self, id)
        +remove(self, node, exception_if_not_exists)
        +to_code(self, indent_level, indent_base)
    }
    Node <|-- Subgraph
    class SyrenkaGeneratorBase{
        +\_\_init\_\_(self)
        +to_code(self, indent_level, indent_base)
    }
    ABC <|-- SyrenkaGeneratorBase
    class ABC{
        +\_\_init\_\_(type(self)
    }
    class function{
        +\_\_init\_\_(type(self)
    }
    class method{
        +\_\_init\_\_(type(self)
    }
    class module{
        +\_\_init\_\_(type(self)
    }

So how do we get it? This is a code snippet that does it:

import syrenka
from syrenka.base import generate_class_list_from_module, 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{
        -cls
        -indent
        -skip_underscores
        +\_\_init\_\_(self, cls, skip_underscores)
        +to_code(self, indent_level, indent_base)
    }
    SyrenkaGeneratorBase <|-- SyrenkaClass
    class SyrenkaClassDiagram{
        -title
        -unique_classes
        -classes
        +\_\_init\_\_(self, title)
        +add_class(self, cls)
        +add_classes(self, classes)
        +to_code(self, indent_level, indent_base)
    }
    SyrenkaGeneratorBase <|-- SyrenkaClassDiagram
    class SyrenkaFlowchart{
        +\_\_init\_\_(self, title, direction, nodes)
        +add(self, node)
        +connect(self, source, target, edge_type)
        +connect_by_id(self, source_id, target_id, edge_type)
        +get_node_by_id(self, id)
        +remove(self, node, exception_if_not_exists)
        +to_code(self, indent_level, indent_base)
    }
    Subgraph <|-- SyrenkaFlowchart
    class Edge{
        -id
        -edge_type
        -text
        -source
        -target
        +\_\_init\_\_(self, edge_type, text, source, target)
        +to_code(self, indent_level, indent_base)
        +valid(self)
    }
    SyrenkaGeneratorBase <|-- Edge
    class EdgeType{
    }
    Enum <|-- EdgeType
    class Enum{
    }
    class FlowchartDirection{
    }
    Enum <|-- FlowchartDirection
    class MutableSequence{
        +\_\_init\_\_(type(self)
        +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{
        -id
        -text
        -shape
        +\_\_init\_\_(self, id, text, shape)
        +to_code(self, indent_level, indent_base)
    }
    SyrenkaGeneratorBase <|-- Node
    class NodeShape{
    }
    Enum <|-- NodeShape
    class OrderedDict{
        +\_\_init\_\_(type(self)
        +clear()
        +copy()
        +fromkeys()
        +get()
        +items()
        +keys()
        +move_to_end(or beginning if last is false)
        +pop(key[,default])
        +popitem(key, value)
        +setdefault()
        +update()
        +values()
    }
    dict <|-- OrderedDict
    class StringHelper{
        +\_\_init\_\_(type(self)
        +indent(level, increment, indent_base)
    }
    class Subgraph{
        -NodeShape
        -Default
        -edges
        -direction
        -OrderedDict
        -nodes_dict
        -subgraphs_dict
        -isinstance
        -Subgraph
        -id
        +\_\_init\_\_(self, id, text, direction, nodes)
        +add(self, node)
        +get_node_by_id(self, id)
        +remove(self, node, exception_if_not_exists)
        +to_code(self, indent_level, indent_base)
    }
    Node <|-- Subgraph
    class SyrenkaGeneratorBase{
        +\_\_init\_\_(self)
        +to_code(self, indent_level, indent_base)
    }
    ABC <|-- SyrenkaGeneratorBase
    class ABC{
        +\_\_init\_\_(type(self)
    }
    class function{
        +\_\_init\_\_(type(self)
    }
    class method{
        +\_\_init\_\_(type(self)
    }
    class module{
        +\_\_init\_\_(type(self)
    }

ready to use mermaid markdown

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

syrenka-0.1.3.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

syrenka-0.1.3-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file syrenka-0.1.3.tar.gz.

File metadata

  • Download URL: syrenka-0.1.3.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for syrenka-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c0ed056f3d0bdc9272111e80f7a6e2283cd4a26c0243c3190a9bdb416becbae9
MD5 230e5737fd05432ab37e38f09898ae4f
BLAKE2b-256 0ee43a09b5859dd22c8b90871b19dc325fdc766c522366da76cec5566124453f

See more details on using hashes here.

Provenance

The following attestation bundles were made for syrenka-0.1.3.tar.gz:

Publisher: python-publish.yml on bartlomiejcieszkowski/syrenka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file syrenka-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: syrenka-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for syrenka-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 419dc791ab3317226cf5c3da6c75224fd8e9ddcf93cd069f60bf87110fc459aa
MD5 e60b82d4a56ce138639f606e10630fa6
BLAKE2b-256 d7231c4d38572c04d099330ea26c526687475573b08ab43591bf09cb0b7cdd91

See more details on using hashes here.

Provenance

The following attestation bundles were made for syrenka-0.1.3-py3-none-any.whl:

Publisher: python-publish.yml on bartlomiejcieszkowski/syrenka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page