Skip to main content

Django UML Generator

Uml-Django is a library that aims to convert project models into a UML diagram, indicating their attributes, methods and the relationships of all entities.

How it Works

From a file created at the root of the project (this is an important step that will be demonstrated below), it will be necessary to create an instance of the Library Class, passing the path to the project's "settings.py" file as a parameter.

With this configuration duly performed and executing the created file, an inspection will be carried out throughout the project in search of all the models of the apps present. Once identified, their attributes, methods, and their relationships with other models, if any, will be saved.

After that, a png file named "class diagram.png" will be created (also in the project root) with a simple class diagram of all classes of the identified models.

Installation and Usage

Before starting the installation, below are important guidelines to ensure the proper functioning of the application.

  • Make sure that python and pip are properly updated, in the current release the library was created with python Python 3.9.6 and Pip 21.2.4. Be with equal or higher versions.

  • Install in the same environment as the project's dependencies, for example with the python virtual environment activated (venv), so that the inspection is effective.

  1. Start by downloading the "django_uml" dependency via pip
pip3 install uml-django
  1. Create a .py file at the root of the project (this step is important), below is an example of a simple project and the extension file called "inspect_class.py"
.
├── db.sqlite3
├── django_project/
│   ├── __init__.py
│   ├── asgi.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── manage.py
├── app_01/
├── app_02/
└── app_03/
├── requirements.txt
├── inspect_class.py <---
├── venv

  • The project has 3 apps and the "django_project" directory where the configuration file "settings.py" is located. In addition, the file "inspect_class.py" was added to the root of the project
  1. With the file created, just follow the code below, which consists of instantiating an object and parameterizing the path to the project's "settings.py" file, then just call two functions as shown below.
from uml_django.inspect import Inspect

inspect_obj = Inspect('django_project.settings')

inspect_obj.inspect()
inspect_obj.create_UML()
  1. Run the file "inspect_class.py"
python3 inspect_class.py

After the guidelines, the png file with the diagram will appear in the root of the project with the name "class_diagram.png", containing all the project models synthesized in a class diagram

Final Considerations

This is an Open-Source project, so you are free to receive suggestions for improvements and enhancements to ensure the quality and viability of the code. This communication will be very effective if applied in Issues and PR's openings so that the maintainers can discuss and implement new ideas and bug fixes.

Metadata

Release files for uml-django 0.0.1

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

Source distribution (sdist)

Source distribution for uml-django 0.0.1
File Size Uploaded Provenance
uml_django-0.0.1.tar.gz 5.4 kB Without provenance Details

Release files / uml_django-0.0.1.tar.gz

Download URL uml_django-0.0.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c75f54a5f5c587af988fa8c4aa8f7254c1fee571b3cdc8b12de1f96b014b3c1d
BLAKE2b-256 checksum
How to use checksums
b2b200fa1e5a0b6e73a6bad20f1daaa019f63044ee26592a730a8e5c05fdc1b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Security for uml-django 0.0.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

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