Skip to main content

Create infrastructure diagrams from configuration files (YAML and JSON) by using Graphviz

Project description

infrastructure-diagrams is a python package that allows creating infrastructure diagrams/graphs from configuration files (YAML and JSON). The package utilizes Graphviz to generate the diagrams. The functionality is exposed in the command line by the Unix command file.

Requirements

The package requires python >= 3.6. It has only been tested on Linux as the intended use was for automatically generating diagrams in a CI.

Installation

The current stable version of infrastructure-daigrams is available on pypi and can be installed by running pip install infrastructure-diagrams.

Other sources:

Usage

$ infrastructure-diagrams
usage: infrastructure-diagrams [-h] [-d DISPLAY] [-o OUTPUT] [-r RENDERER] file

positional arguments:
  file                  path to diagram file

optional arguments:
  -h, --help            show this help message and exit
  -d DISPLAY, --display DISPLAY
                        display the diagram after rendering
  -o OUTPUT, --output OUTPUT
                        output path for the diagram, including filetype (.svg, .png, etc.)
  -r RENDERER, --renderer RENDERER
                        output renderer used for rendering (cairo, gd, etc.)

Example: $ infrastructure-diagrams -o example.png examples/example.yaml

Configuration files

The configuration files extend the Graphviz Node, Edge and Graph Attributes, meaning you can customize the diagram / graph as needed.

Example, misc.yaml from the examples/ directory:

graph_attributes:
  # https://www.graphviz.org/doc/info/attrs.html#d:fontsize
  fontsize: 20
  label: Simple Diagram
graph_engine: dot
groups:
  - id: group1
    label: "Group (ID: 1)"
    # https://www.graphviz.org/doc/info/attrs.html#d:style
    style: filled
    # https://www.graphviz.org/doc/info/attrs.html#d:fillcolor
    fillcolor: "#cccccc"
    nodes:
      # Group 1 node 1
      - id: g1_node1
        label: Node G1_1
        edges:
          - node: G2_1
            label: Edge between node G1_1 and G2_1
            # https://www.graphviz.org/doc/info/attrs.html#d:color
            color: brown
            fontcolor: brown
          - node: global_node_1
            label: Edge between node G1_1 and global_node_1
  - id: group2
    parent_group: group1
    label: "Group (ID: 2)"
    style: filled
    fillcolor: "#aaaaaa"
    color: purple
    nodes:
      # Group 2 node 1
      - id: G2_1
        label: Node G2_1
        style: filled
        fillcolor: "#0026ca:#7a7cff"
        fontcolor: white
      - id: G2_2
        label: Node G2_2
        # https://www.graphviz.org/doc/info/shapes.html
        shape: box
        color: green
        edges:
          - node: G2_1
      - id: G2_3
        label: Node G2_3
        edges:
          - node: global_node_2
            label: Edge between node G2_3 and global_node_2
            color: red
global_nodes:
  - id: global_node_1
    label: Global Node 1
    edges:
      - node: global_node_2
        label: Edge between Global node 1 and 2
  - id: global_node_2
    label: Global Node 2
    shape: star

Output: Output of misc.yaml

Example diagram configuration files can be found under the examples/ directory.

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

infrastructure-diagrams-0.0.2.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

infrastructure_diagrams-0.0.2-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file infrastructure-diagrams-0.0.2.tar.gz.

File metadata

  • Download URL: infrastructure-diagrams-0.0.2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for infrastructure-diagrams-0.0.2.tar.gz
Algorithm Hash digest
SHA256 331ddf58c68a1aea2456e6da87bf9e0b7ae31c3513443501f6704e42d23d337b
MD5 8819425cbf13197b21c415a651472a1b
BLAKE2b-256 5b8c42c53ccf23b41881112a5ab375b28f2c33e92ac5df949fd652940f1204cc

See more details on using hashes here.

File details

Details for the file infrastructure_diagrams-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: infrastructure_diagrams-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for infrastructure_diagrams-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d539234191ec5c03d128efea384d6b64c469bd6e54a5b55ec61c63510e2790ad
MD5 eccd01bbb2e6a3a9890062ce9f9fc7ce
BLAKE2b-256 f6f249ca66a25aa0cb3413dddc79811b732216b17bd5a390913627ff28f05f41

See more details on using hashes here.

Supported by

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