library to generate seqeuence diagram for python code
Project description
Sequence Diagram Generator for Python
Overview
This Python library generates sequence diagrams for your Python code using the Mermaid.js format. It allows you to visualize the interactions between various parts of your code, aiding in better understanding and documentation.
Features
- Mermaid.js Integration: Utilizes Mermaid.js for generating sequence diagrams.
- HTML Generation: Generates an HTML file containing the sequence diagram.
- Function Decoration: Decorate functions/methods with
@sequenceDiagramto include them in the sequence diagram.
Installation
To install the library, you can use pip:
pip install sequenceDiagram
Usage
Importing the Library
from sequenceDiagram import sequenceDiagram, writehtml
Decorating Functions
Use the @sequenceDiagram decorator to mark the functions you want to include in the sequence diagram.
@sequenceDiagram
def function_a():
print("Function A")
@sequenceDiagram
def function_b():
function_a()
print("Function B")
Generating the HTML
After decorating the desired functions, use the writehtml function to generate the HTML file with the sequence diagram.
html_path = "path/to/sequence_diagram.html"
writehtml(html_path)
Example
Here's a complete example:
from sequenceDiagram import sequenceDiagram, writehtml
@sequenceDiagram
def function_a():
print("Function A")
@sequenceDiagram
def function_b():
function_a()
print("Function B")
@sequenceDiagram
def main():
function_b()
print("Main Function")
if __name__ == "__main__":
main()
writehtml("sequence_diagram.html")
This will generate an HTML file named sequence_diagram.html in the specified path, containing the sequence diagram of the interactions between main, function_b, and function_a.
Contact
For any questions or issues, please open an issue on the GitHub repository or connect with me at brijesh.kulkarni@gmail.com
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 sequencediagram-0.0.3.tar.gz.
File metadata
- Download URL: sequencediagram-0.0.3.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7111d1bf2f7c469a447571d248d5d91d5dd11d3c3ff4305dd665992fe3e141f
|
|
| MD5 |
9972401558cab84fcc4e09317c2acdf5
|
|
| BLAKE2b-256 |
0bf89fd71fe4efca5bac4562e22a3cad7e1f54f98e00677294fd395f5c20b45d
|
File details
Details for the file sequenceDiagram-0.0.3-py3-none-any.whl.
File metadata
- Download URL: sequenceDiagram-0.0.3-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2af75984fcd95b3693aff761698bce2b683d9993d33e71baf9fad62c68af7ae
|
|
| MD5 |
f95f31badf009715cda09a5dfd673890
|
|
| BLAKE2b-256 |
3304eb9c98073ad246d745a752081848f91502995aab33090ee13020a92ece3f
|