A converter from PlantUML class diagrams to python3 skeleton classes.
Project description
A converter from PlantUML class diagrams to python3 skeleton classes
supported PlantUML class diagram syntax:
` uml : "@startuml" decls "@enduml" decls : ε | decls decl decl : class | assoc | "skinparam" class : abs "class" id '{' attribs '}' class : abs "interface" id '{' attribs '}' class : enum id '{' ids '}' ids : ID ids : ids ',' ID abs : ε | "abstract" attribs : ε | attribs attrib attrib : prot id vec type init attrib : prot id '(' ')' type attrib : prot id '(' args ')' type attrib : prot "static" id '(' ')' type attrib : prot "static" id '(' args ')' type attrib : prot "abstract" id '(' ')' type attrib : prot "abstract" id '(' args ')' type type : ε | ':' id vec args : id type | args ',' id type prot : ε | '+' | '-' | '~' | '#' vec : ε | '[' ']' | '[' [0-9]+ ']' | '<[_A-Za-z][A-Za-z0-9_]*>' init : ε | '=' id | '=' str | '=' [0-9]+ assoc : id ('<|--' | '<|..' | '--|>' | '..|>') id assoc : id card ('*-->' | '--*' | '<--*' | 'o-->' | 'o--' | '<--o' | '--o' | '-->' | '<--' | '--') card id type card : ε | STR str : '"([^"\\]|\\.)*"' id : '[_A-Za-z][A-Za-z0-9_]*' `
comments start with # symbol and end the end of the line.
A simple class example:
` @startuml skinparam classAttributeIconSize 0 skinparam monochrome true class Tire { - _pressure: int - _standard: int - _flat: bool -- + Tire(standard: int , pressure: int) + standard() : int + pressure() : int + flat() : bool + pressure(pressure: int) : void + empty() : bool } @enduml `
Generate the python3 skeleton code to stdout with:
` python3 -m uml2py tire.uml `
or save the skeleton code to a file:
` python3 -m uml2py tire.uml tire.py `
Use the environment DEBUG=1 for a verbose output:
` DEBUG=1 python3 -m uml2py tire.uml `
Some examples in the examples/ directory.
prs, IST 2024
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
File details
Details for the file uml2py-1.0.1.tar.gz
.
File metadata
- Download URL: uml2py-1.0.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1906daa9bf1d2c7ee542ae12ffed2af9a967cc740703e246a595b3d7ceb36f1 |
|
MD5 | 1c58840e010992a905b45c316970e4f8 |
|
BLAKE2b-256 | 6000b049ada6f9a9707cc10b1190238b9b7d4c2afac23d6bcf5720250db66b53 |
File details
Details for the file uml2py-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: uml2py-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5870f6a1457716e8bb25a055caef5e589c017d67fc3f345dbb5b23639e46b10d |
|
MD5 | 8287596bb37d41c4698fd6f521929fc6 |
|
BLAKE2b-256 | 7aad160bd01ccd70bdfe0b9cda71062d6b3d58a5dc5417298700f9f5a4371c2d |