Skip to main content

Pure Python UML class diagram generator that renders SVG without dependencies.

Project description

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

pip install pyuml2svg

Quick example

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.

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

pyuml2svg-0.4.5.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

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

pyuml2svg-0.4.5-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file pyuml2svg-0.4.5.tar.gz.

File metadata

  • Download URL: pyuml2svg-0.4.5.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyuml2svg-0.4.5.tar.gz
Algorithm Hash digest
SHA256 e1eb2e0a5e99ad8e77349af415b01c939ba3afab50a397e4d87c55ccf7f5aeeb
MD5 39093c19025b5248795b0a4b8ba55bcb
BLAKE2b-256 24306dec3444f301110926e06eb674d4df7a4ebadfdc4c30b18776d12fcfced6

See more details on using hashes here.

File details

Details for the file pyuml2svg-0.4.5-py3-none-any.whl.

File metadata

  • Download URL: pyuml2svg-0.4.5-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyuml2svg-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a74e5d48b2f0a8a411f88419c5d1ced9e63be879258e8f8ccd1df60444ab288b
MD5 5106103d57f4fddc7125f3b824d6fd44
BLAKE2b-256 e08447dca958dbea01fc13d8a92e8c82f91a2e9437c20a7a038b69fd61f6786e

See more details on using hashes here.

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