drawio-diagram-generator


Namedrawio-diagram-generator JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/yourusername/drawio-diagram-generator
SummaryA Python library for generating Draw.io diagrams programmatically
upload_time2025-07-16 07:53:25
maintainerNone
docs_urlNone
authorYour Name
requires_python>=3.7
licenseNone
keywords drawio diagram generator xml visualization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Draw.io Diagram Generator

A Python library for generating Draw.io diagrams programmatically. This library provides a simple and intuitive API to create complex diagrams that can be opened in Draw.io or any compatible diagram editor.

## Features

- **Component-based architecture**: Create diagrams using reusable components
- **Flexible layout system**: Arrange components in rows, columns, and groups
- **Rich styling options**: Customize colors, shapes, and connections
- **Icon support**: Add icons and images to your diagrams
- **Export to XML**: Generate Draw.io compatible XML files
- **Easy to use**: Simple API for quick diagram creation

## Installation

```bash
pip install drawio-diagram-generator
```

## Quick Start

```python
from drawio_diagram_generator import Box, Arrow, Group, Diagram

# Create components
user = Box("User", style="fillColor=#d5e8d4;strokeColor=#82b366;")
server = Box("Server", style="fillColor=#dae8fc;strokeColor=#6c8ebf;")
database = Box("Database", style="fillColor=#fff2cc;strokeColor=#d6b656;")

# Create connections
user_to_server = Arrow(user, server, "HTTP Request")
server_to_db = Arrow(server, database, "SQL Query")

# Group components
components = [user, server, database]
connections = [user_to_server, server_to_db]

# Create diagram
diagram = Diagram(Group("System Architecture", components + connections))

# Save to file
diagram.save("system_architecture.drawio")
```

## Components

### Basic Components

- **Box**: Rectangular components with text and optional icons
- **IconBox**: Image-only components
- **Arrow**: Directed connections between components
- **Line**: Simple line connections without arrows

### Layout Components

- **Row**: Arrange components horizontally
- **Column**: Arrange components vertically  
- **Group**: Container with title and customizable layout

## Examples

### Simple Flow Diagram

```python
from drawio_diagram_generator import Box, Arrow, Group, Diagram

# Create flow components
start = Box("Start", style="ellipse;fillColor=#d5e8d4;strokeColor=#82b366;")
process = Box("Process", style="rounded=1;fillColor=#dae8fc;strokeColor=#6c8ebf;")
end = Box("End", style="ellipse;fillColor=#f8cecc;strokeColor=#b85450;")

# Create flow
flow = [
    start,
    Arrow(start, process),
    process,
    Arrow(process, end),
    end
]

diagram = Diagram(Group("Simple Flow", flow))
diagram.save("simple_flow.drawio")
```

### Network Architecture

```python
from drawio_diagram_generator import Box, Arrow, Group, Diagram

# Network components
internet = Box("Internet", style="fillColor=#e1d5e7;strokeColor=#9673a6;")
firewall = Box("Firewall", style="fillColor=#f8cecc;strokeColor=#b85450;")
web_server = Box("Web Server", style="fillColor=#dae8fc;strokeColor=#6c8ebf;")
database = Box("Database", style="fillColor=#fff2cc;strokeColor=#d6b656;")

# Create network layout
network = Group("Network Architecture", [
    internet,
    Arrow(internet, firewall),
    firewall,
    Arrow(firewall, web_server),
    web_server,
    Arrow(web_server, database),
    database
], layout="column", spacing=30)

diagram = Diagram(network)
diagram.save("network_architecture.drawio")
```

## API Reference

### Box

```python
Box(label, width=80, height=80, style=None, image_url=None, image_only=False)
```

- `label`: Text to display in the box
- `width`, `height`: Dimensions of the box
- `style`: Custom CSS-like style string
- `image_url`: URL or path to an icon/image
- `image_only`: If True, show only the image without text

### Arrow

```python
Arrow(source, target, label="", style=None, direction="LR", show_arrow=True)
```

- `source`, `target`: Source and target components
- `label`: Text label on the arrow
- `style`: Custom style string
- `direction`: Connection direction ("LR", "RL", "TB", "BT", etc.)
- `show_arrow`: Whether to show arrowhead

### Group

```python
Group(label, children, layout="column", align="center", spacing=50, padding=50, style_opts=None)
```

- `label`: Title of the group
- `children`: List of components in the group
- `layout`: Layout type ("column", "row")
- `align`: Alignment within the group
- `spacing`: Space between components
- `padding`: Internal padding
- `style_opts`: Style options for the group container

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License - see the LICENSE file for details. 


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yourusername/drawio-diagram-generator",
    "name": "drawio-diagram-generator",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "drawio, diagram, generator, xml, visualization",
    "author": "Your Name",
    "author_email": "your.email@example.com",
    "download_url": "https://files.pythonhosted.org/packages/16/83/c855e9c81a94a25b4ae0ca3baada52a8596ab04eedecb55238f56c89731a/drawio-diagram-generator-1.0.1.tar.gz",
    "platform": null,
    "description": "# Draw.io Diagram Generator\r\n\r\nA Python library for generating Draw.io diagrams programmatically. This library provides a simple and intuitive API to create complex diagrams that can be opened in Draw.io or any compatible diagram editor.\r\n\r\n## Features\r\n\r\n- **Component-based architecture**: Create diagrams using reusable components\r\n- **Flexible layout system**: Arrange components in rows, columns, and groups\r\n- **Rich styling options**: Customize colors, shapes, and connections\r\n- **Icon support**: Add icons and images to your diagrams\r\n- **Export to XML**: Generate Draw.io compatible XML files\r\n- **Easy to use**: Simple API for quick diagram creation\r\n\r\n## Installation\r\n\r\n```bash\r\npip install drawio-diagram-generator\r\n```\r\n\r\n## Quick Start\r\n\r\n```python\r\nfrom drawio_diagram_generator import Box, Arrow, Group, Diagram\r\n\r\n# Create components\r\nuser = Box(\"User\", style=\"fillColor=#d5e8d4;strokeColor=#82b366;\")\r\nserver = Box(\"Server\", style=\"fillColor=#dae8fc;strokeColor=#6c8ebf;\")\r\ndatabase = Box(\"Database\", style=\"fillColor=#fff2cc;strokeColor=#d6b656;\")\r\n\r\n# Create connections\r\nuser_to_server = Arrow(user, server, \"HTTP Request\")\r\nserver_to_db = Arrow(server, database, \"SQL Query\")\r\n\r\n# Group components\r\ncomponents = [user, server, database]\r\nconnections = [user_to_server, server_to_db]\r\n\r\n# Create diagram\r\ndiagram = Diagram(Group(\"System Architecture\", components + connections))\r\n\r\n# Save to file\r\ndiagram.save(\"system_architecture.drawio\")\r\n```\r\n\r\n## Components\r\n\r\n### Basic Components\r\n\r\n- **Box**: Rectangular components with text and optional icons\r\n- **IconBox**: Image-only components\r\n- **Arrow**: Directed connections between components\r\n- **Line**: Simple line connections without arrows\r\n\r\n### Layout Components\r\n\r\n- **Row**: Arrange components horizontally\r\n- **Column**: Arrange components vertically  \r\n- **Group**: Container with title and customizable layout\r\n\r\n## Examples\r\n\r\n### Simple Flow Diagram\r\n\r\n```python\r\nfrom drawio_diagram_generator import Box, Arrow, Group, Diagram\r\n\r\n# Create flow components\r\nstart = Box(\"Start\", style=\"ellipse;fillColor=#d5e8d4;strokeColor=#82b366;\")\r\nprocess = Box(\"Process\", style=\"rounded=1;fillColor=#dae8fc;strokeColor=#6c8ebf;\")\r\nend = Box(\"End\", style=\"ellipse;fillColor=#f8cecc;strokeColor=#b85450;\")\r\n\r\n# Create flow\r\nflow = [\r\n    start,\r\n    Arrow(start, process),\r\n    process,\r\n    Arrow(process, end),\r\n    end\r\n]\r\n\r\ndiagram = Diagram(Group(\"Simple Flow\", flow))\r\ndiagram.save(\"simple_flow.drawio\")\r\n```\r\n\r\n### Network Architecture\r\n\r\n```python\r\nfrom drawio_diagram_generator import Box, Arrow, Group, Diagram\r\n\r\n# Network components\r\ninternet = Box(\"Internet\", style=\"fillColor=#e1d5e7;strokeColor=#9673a6;\")\r\nfirewall = Box(\"Firewall\", style=\"fillColor=#f8cecc;strokeColor=#b85450;\")\r\nweb_server = Box(\"Web Server\", style=\"fillColor=#dae8fc;strokeColor=#6c8ebf;\")\r\ndatabase = Box(\"Database\", style=\"fillColor=#fff2cc;strokeColor=#d6b656;\")\r\n\r\n# Create network layout\r\nnetwork = Group(\"Network Architecture\", [\r\n    internet,\r\n    Arrow(internet, firewall),\r\n    firewall,\r\n    Arrow(firewall, web_server),\r\n    web_server,\r\n    Arrow(web_server, database),\r\n    database\r\n], layout=\"column\", spacing=30)\r\n\r\ndiagram = Diagram(network)\r\ndiagram.save(\"network_architecture.drawio\")\r\n```\r\n\r\n## API Reference\r\n\r\n### Box\r\n\r\n```python\r\nBox(label, width=80, height=80, style=None, image_url=None, image_only=False)\r\n```\r\n\r\n- `label`: Text to display in the box\r\n- `width`, `height`: Dimensions of the box\r\n- `style`: Custom CSS-like style string\r\n- `image_url`: URL or path to an icon/image\r\n- `image_only`: If True, show only the image without text\r\n\r\n### Arrow\r\n\r\n```python\r\nArrow(source, target, label=\"\", style=None, direction=\"LR\", show_arrow=True)\r\n```\r\n\r\n- `source`, `target`: Source and target components\r\n- `label`: Text label on the arrow\r\n- `style`: Custom style string\r\n- `direction`: Connection direction (\"LR\", \"RL\", \"TB\", \"BT\", etc.)\r\n- `show_arrow`: Whether to show arrowhead\r\n\r\n### Group\r\n\r\n```python\r\nGroup(label, children, layout=\"column\", align=\"center\", spacing=50, padding=50, style_opts=None)\r\n```\r\n\r\n- `label`: Title of the group\r\n- `children`: List of components in the group\r\n- `layout`: Layout type (\"column\", \"row\")\r\n- `align`: Alignment within the group\r\n- `spacing`: Space between components\r\n- `padding`: Internal padding\r\n- `style_opts`: Style options for the group container\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please feel free to submit a Pull Request.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the LICENSE file for details. \r\n\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python library for generating Draw.io diagrams programmatically",
    "version": "1.0.1",
    "project_urls": {
        "Bug Reports": "https://github.com/yourusername/drawio-diagram-generator/issues",
        "Documentation": "https://github.com/yourusername/drawio-diagram-generator#readme",
        "Homepage": "https://github.com/yourusername/drawio-diagram-generator",
        "Source": "https://github.com/yourusername/drawio-diagram-generator"
    },
    "split_keywords": [
        "drawio",
        " diagram",
        " generator",
        " xml",
        " visualization"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1abcbaf46325353b381059dd7c582db9ba074d58b7f304d2f86229e6b4eb7623",
                "md5": "99f700eee99d8eda5201080883a55481",
                "sha256": "477a7d0ba2e58591d650260ece89c6012f448c1ff5efb07f2e30bb223a872b5a"
            },
            "downloads": -1,
            "filename": "drawio_diagram_generator-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "99f700eee99d8eda5201080883a55481",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 9214,
            "upload_time": "2025-07-16T07:53:23",
            "upload_time_iso_8601": "2025-07-16T07:53:23.397327Z",
            "url": "https://files.pythonhosted.org/packages/1a/bc/baf46325353b381059dd7c582db9ba074d58b7f304d2f86229e6b4eb7623/drawio_diagram_generator-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1683c855e9c81a94a25b4ae0ca3baada52a8596ab04eedecb55238f56c89731a",
                "md5": "3b7a45240a8fdd2e3b26431817a5f082",
                "sha256": "0ea120a0612442e75c8b394980559ffa2fc755a9a64abfea6ea99582d2fc203b"
            },
            "downloads": -1,
            "filename": "drawio-diagram-generator-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3b7a45240a8fdd2e3b26431817a5f082",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10458,
            "upload_time": "2025-07-16T07:53:25",
            "upload_time_iso_8601": "2025-07-16T07:53:25.077041Z",
            "url": "https://files.pythonhosted.org/packages/16/83/c855e9c81a94a25b4ae0ca3baada52a8596ab04eedecb55238f56c89731a/drawio-diagram-generator-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-16 07:53:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yourusername",
    "github_project": "drawio-diagram-generator",
    "github_not_found": true,
    "lcname": "drawio-diagram-generator"
}
        
Elapsed time: 0.95038s