Skip to main content

Model driven genration - from UML to Code & Docs

Project description

Test PyPI Documentation Status

pyMDG

Overview

Parser and tools to manipulate UML models. Current version supports Sparx EA Generated XMI 2.1 or diagrams.net XML

Used to parse model files to native python classes (see metamodel below) which are passed to jinja2 templates for generation of code (POJO, POCO, Django etc), JSON data and HTML documentation.

Quickstart and docs can be found here: readthedocs

Test

Standard testing:

python -m unittest

To generate code call the generate script and pass in the recipie folder. A sample recipie folder is provided in the github repo:

python generate.py ./sample_recipie/config-drawio-django.yaml

Or once installed into site-packages via 'pip install pymdg', an executable is provided:

cd /my/recipie/folder

And execute:

mdg_generate <my/config.yaml>

See the sample_recipie configs for examples

Sparx EA Export Process

  • In Sparx select the domain root node (e.g. Model/Sample )
  • Select the publish tab at the top
  • Select Publish As... from top menu
  • Set export type as XMI 2.1
  • Optionally select 'Export Diagrams', 'Generate Diagram Images' and PNG format
  • Export to folder where you want to generate from

Wiki documentation upload

If your generation recipie has created a file for your wiki (Confluence) then an uploader utilitity can be used. This assumes that you have done the XMI export from Sparx EA with export diagrams and generate diagram images. To generate a confluence token please see: https://confluence.atlassian.com/cloud/api-tokens-938839638.html

python confluence.py {your email} {your confluence token} {confluence page id} {path to images}

Nomenclature:

This diagram shows all the features and how to model in UML Nomenclature

Sample model

Sample model

Metamodel

This diagram shows the internal classes which are passed to the templates during generation. Metamodel

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

pymdg-0.1a9.tar.gz (17.6 kB view hashes)

Uploaded Source

Built Distribution

pymdg-0.1a9-py3-none-any.whl (31.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page