Metadata-Version: 2.4
Name: pyuml2svg
Version: 0.4.61
Summary: Pure Python UML class diagram generator that renders SVG without dependencies.
Author-email: Mikael Mölsä <mikael.molsa@pm.me>
License: MIT License
        
        Copyright (c) 2025 Mikael Mölsä
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Keywords: uml,svg,diagram,python-uml,uml-renderer
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Environment :: Console
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Multimedia :: Graphics
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# pyuml2svg

**pyuml2svg** is a pure-Python library that generates **UML class diagrams as SVG** with no external dependencies.  
It performs its own layout, places labels, draws canonical UML relationship arrows, and includes interactive
collapse/expand controls directly in the SVG.

---

## Features

- Zero dependencies — pure Python + SVG
- Automatic portrait DAG layout
- Collision-aware edge labels
- Canonical UML markers (inheritance, composition, aggregation, etc.)
- Interactive collapse/expand of class hierarchies
- Disconnected-class highlighting
- Packaged CSS and JavaScript assets (no external files required)

---

## Installation

```bash
pip install pyuml2svg
```

## Quick example
```python
from pyuml2svg import UMLClass, UMLRelation, render_svg_string

classes = [
    UMLClass("Animal"),
    UMLClass("Dog"),
    UMLClass("Cat"),
    UMLClass("Spider"),
]

relations = [
    UMLRelation("Animal", "Dog", kind="inheritance"),
    UMLRelation("Animal", "Cat", kind="directed-association"),
    UMLRelation("Animal", "Spider"),
]

svg = render_svg_string(classes, relations)
with open("diagram.svg", "w", encoding="utf-8") as f:
    f.write(svg)

```
Open diagram.svg in any browser.

## UML Relationship types

Supported kind values:
- inheritance
- realization
- composition
- aggregation
- dependency
- directed-association
- association
- link (plain line)

NB. Some of these are still WIP.
