sheldonhull / diagrams-as-code-template

Use python 🐍 to generate diagrams via code. This project can be used as a template to quickly start work on new diagrams without having to setup tooling each time.

Home Page:https://www.sheldonhull.com/diagrams-as-code/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Diagrams As Code

MIT License forthebadge forthebadge GitHub code size in bytes GitHub last commit (branch)

More On This

I wrote up a blog post on this here: Sheldon Hull - Diagrams As Code

Features

  • I've dug through the issues and found some great snippets to better configure default behavior.
  • This includes a function for tracing the "route" (aka edge). This allows you to build a path to describe an activity in simple function call, and then alter it to re-render with new path. Live diagram discussion is easy this way.
  • Pre-built poetry tooling and container details gives you a quick start to reuse on a new project for diagrams.
  • Diagrams as code... no more visio. What's not to love?## Development Prerequisites
  1. Install go-task
  2. Install Poetry
  3. Python3

Optional:

  • Codespaces configuration included, so open this up in codespaces!

Example Output

Simple

Compex

Development Prerequisites

Install go-task

Run Locally

From your terminal run task to see all prebuild commands.

To initialize project use: task init

NOTE: Due to how diagrams works, you'll have to have one diagram python script file for each diagram. I've tried to make it more modular to build the paths as a seperate function, but due to scoping it's not feasible. In essence, you'll just have to deal with copy-paste for a new diagram and not reuse much in the same file.

To add a new diagram task to poetry just name a new file and add a new poetry task in pyproject.toml.

[tool.poetry.scripts]
basic = "diag.diagram:main"
complex = "diag.diagram-complex:main"

Dependencies

Project automatically submits dependency updates monthly using Renovate Whitesource.

Acknowledgements

Diagrams

License

MIT

About

Use python 🐍 to generate diagrams via code. This project can be used as a template to quickly start work on new diagrams without having to setup tooling each time.

https://www.sheldonhull.com/diagrams-as-code/


Languages

Language:Python 89.5%Language:Dockerfile 10.5%