Skip to main content

Maintenance CI PyPI version License: AGPL v3 Made with Python GitHub Copilot: No

Introduction

This project provides a Python data model for creating and manipulating UML diagrams. It is the foundational data model for the UML Shapes module.

Installation

It is recommended to use a virtual environment for installing Python packages.

# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate

# Install the package
pip install umlmodel

Usage

Programmatic Usage

The umlmodel library allows you to create UML elements like classes, interfaces, and use cases programmatically. Here are some examples:

Creating a Class

To create a simple class, instantiate the Class object:

from umlmodel.Class import Class

modelClass: Class = Class(name='MyClass')

print(modelClass.name)

Adding Fields to a Class

You can add fields (attributes) to a class. Fields have a name, type, visibility, and an optional default value.

from umlmodel.Class import Class
from umlmodel.Field import Field
from umlmodel.FieldType import FieldType
from umlmodel.enumerations.Visibility import Visibility

# Create a class
modelClass: Class = Class(name='MyClass')

# Create fields
field1: Field = Field(name='my_string',
               type=FieldType('str'),
               visibility=Visibility.PUBLIC,
               defaultValue='"hello"')
field2: Field = Field(name='_my_private_int',
               type=FieldType('int'),
               visibility=Visibility.PRIVATE)

# Add fields to the class
modelClass.fields.append(field1)
modelClass.fields.append(field2)

# The string representation of a field is useful
print(field1)
print(field2)

Adding Methods to a Class

Methods can be added to a class, including parameters and return types.

from umlmodel.Class import Class
from umlmodel.Method import Method
from umlmodel.Parameter import Parameter
from umlmodel.ParameterType import ParameterType
from umlmodel.ReturnType import ReturnType
from umlmodel.enumerations.Visibility import Visibility

# Create a class
modelClass: Class = Class(name='MyClass')

# Create a method
method: Method = Method(name='my_method', visibility=Visibility.PUBLIC)

# Add a parameter
parameter: Parameter = Parameter(name='value', type=ParameterType('int'), defaultValue='0')
method.addParameter(parameter)

# Set a return type
method.returnType = ReturnType('bool')

# Add the method to the class
modelClass.methods.append(method)

# Print the method signature
print(method.methodWithParameters())

Written by Humberto A. Sanchez II (C) 2026

Note

For all kinds of problems, requests, enhancements, bug reports, etc., please drop me an e-mail.


Metadata

Release files for umlmodel 4.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for umlmodel 4.0.0
File Size Uploaded Provenance Actions
umlmodel-4.0.0.tar.gz 25.6 kB With provenance Details for umlmodel-4.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for umlmodel 4.0.0
File Interpreter ABI Platform Actions
umlmodel-4.0.0-py3-none-any.whl Python 3 none any Details for umlmodel-4.0.0-py3-none-any.whl

Total release size: 56.6 kB

Release files / umlmodel-4.0.0.tar.gz

Download URL umlmodel-4.0.0.tar.gz
Size 25.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cb65ce7d38beaf0b5cf3e430d3aac72f882c646faf1ede2463702cd55c71e20e
BLAKE2b-256 checksum
How to use checksums
0008102825bc093a4fcd73cc16b2ec59e61f0c6d53524054818cf445f96c4442
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / umlmodel-4.0.0-py3-none-any.whl

Download URL umlmodel-4.0.0-py3-none-any.whl
Size 31.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca240bcaede44545ba63891453882ecab0245f84991b935563c52444fe1777bd
BLAKE2b-256 checksum
How to use checksums
ea5cfa5cd9b5e7d3696de7d6153e2c84876aa13cb7f97847867effacd8092919
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for umlmodel 4.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for umlmodel-4.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page