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 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{
    }
    Enum <|-- EdgeType
    class Enum{
    }
    class FlowchartDirection{
    }
    Enum <|-- FlowchartDirection
    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{
    }
    Enum <|-- NodeShape
    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 ABC{
    }
    class function{
    }
    class method{
    }
    class module{
    }

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{
        +\_\_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{
    }
    Enum <|-- EdgeType
    class Enum{
    }
    class FlowchartDirection{
    }
    Enum <|-- FlowchartDirection
    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{
    }
    Enum <|-- NodeShape
    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 ABC{
    }
    class function{
    }
    class method{
    }
    class module{
    }

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.5.tar.gz (15.4 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.5-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: syrenka-0.1.5.tar.gz
  • Upload date:
  • Size: 15.4 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.5.tar.gz
Algorithm Hash digest
SHA256 f116c5285255151ce69afeb09087e4cadfefa5a829400e4454d960aa215a599f
MD5 d282865968e29b72e441cefe091717c7
BLAKE2b-256 46b8e2f3d998658722276a910aa7237727124a0f442199a6dcb6fe7421d15507

See more details on using hashes here.

Provenance

The following attestation bundles were made for syrenka-0.1.5.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.5-py3-none-any.whl.

File metadata

  • Download URL: syrenka-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 8.4 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 36cf19c6548975ae8205d6b9b80e5db5457edb8291710719bc4f3e203ed68726
MD5 fd557663ce186636b15a1c3c2a4e3dd0
BLAKE2b-256 d25f5982d7ece5fce8093f4d4c5bd385276102f38c75ed5f89fb4123ce8c4c7f

See more details on using hashes here.

Provenance

The following attestation bundles were made for syrenka-0.1.5-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