Create UML diagrams from Protobuf proto files
Project description
Protobuf UML diagram
A tool to generate UML diagrams from Protobuf compiled .proto files.
Usage:
$ protobuf-uml-diagram --proto "cylc.flow.ws_messages_pb2" --output /tmp/
Logging output:
INFO:__main__:Importing compiled proto cylc.flow.ws_messages_pb2
INFO:__main__:Writing PNG diagram to /tmp/ws_messages_pb2.png
Image output:
TL;DR
$ pip install protobuf-uml-diagram
(…)
$ file issue_10.proto # See ./test_data/ or use your own .proto file.
issue_10.proto: ASCII text
$ protoc --python_out=./ issue_10.proto
$ # The line below modifies PYTHONPATH, which is not necessary if you have a valid Python module/package.
$ PYTHONPATH=. protobuf-uml-diagram --proto issue_10_pb2 --output /tmp
INFO:protobuf_uml_diagram:Imported: issue_10_pb2
INFO:protobuf_uml_diagram:Writing diagram to /tmp/issue_10_pb2.png
$ eog /tmp/issue_10_pb2.png
Running the command above should create a final image with your diagram as seen below.
By default, it uses the full name of the types (e.g. SomeRequest.shipments).
If you would like to use simpler names (i.e. shipments) you can use the option added
in 0.13 --full_names=true|false (it is true by default for backward compatibility).
$ PYTHONPATH=. protobuf-uml-diagram --proto issue_10_pb2 --output /tmp --full_names=false
INFO:protobuf_uml_diagram:Imported: issue_10_pb2
INFO:protobuf_uml_diagram:Writing diagram to /tmp/issue_10_pb2.png
$ eog /tmp/issue_10_pb2.png
Note that doing so, you risk showing fields that are homonyms but that mean different things. See the related issues #10 and #78.
Installation
$ pip install protobuf-uml-diagram
$ protobuf-uml-diagram
Development
$ git clone https://github.com/kinow/protobuf-uml-diagram.git
$ cd protobuf-uml-diagram
$ pip install -e .
$ protobuf-uml-diagram
Docker
Generate UML diagrams from all (not compiled) .proto files in a directory:
./dockerbuild.sh
./dockerrun.sh <path_containing_proto_files> <output_path>
License
Apache License
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file protobuf_uml_diagram-0.15.tar.gz.
File metadata
- Download URL: protobuf_uml_diagram-0.15.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91f0f28059c0b54370e3f3e71bb99491b48857b36d4acc903bc4a444c445e24e
|
|
| MD5 |
b4442543c8d152a8c68a181bb99c3769
|
|
| BLAKE2b-256 |
dd7f11ddb8d88427e7558c28e01e7201fb1951bca610d8e18ca7190fc32a8afd
|
File details
Details for the file protobuf_uml_diagram-0.15-py3-none-any.whl.
File metadata
- Download URL: protobuf_uml_diagram-0.15-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
822e6f2619e95ffa688584ffd7bafa096ba9e628185bb4e86af6558a220d5a88
|
|
| MD5 |
adc0aae05da6b9a1991ad31ffe88b41c
|
|
| BLAKE2b-256 |
2b37aab75f96b13df690b26fbc6d30fc50e2946cd7abe6abf2fc07a5fa905a35
|