Skip to main content

Create UML diagrams from Protobuf proto files

Project description

PyPI License CI codecov

ko-fi

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:

example 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

protobuf-uml-diagram-0.13.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

protobuf_uml_diagram-0.13-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file protobuf-uml-diagram-0.13.tar.gz.

File metadata

  • Download URL: protobuf-uml-diagram-0.13.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for protobuf-uml-diagram-0.13.tar.gz
Algorithm Hash digest
SHA256 7e9b766541f139274cbaac63ee5d4f369c4c346e7576dc8bfc49992accf40c5c
MD5 d57496ff96c08f1888cef73ebd4a221d
BLAKE2b-256 1e7ef52fd2f31dc8e98398ccb2f715ca7d9709ff8e61a93823963ba19579fc1b

See more details on using hashes here.

File details

Details for the file protobuf_uml_diagram-0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for protobuf_uml_diagram-0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 f44e4e9cf57d9db279244920753eeccd4fc579c4d5148fb8f10baee4ee01a067
MD5 32971d30a2df1a3a9de96369991e23ea
BLAKE2b-256 116c401d98bca7bbfd55bd8a014638d3d4d6ea0dc7e522c1caad94e544f09ee2

See more details on using hashes here.

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