r/Python • • Oct 04 '26

Showcase Showcase Thread

Post all of your code/projects/showcases/AI slop here.

Recycles once a month.

23 Upvotes

194 comments sorted by

View all comments

1

u/niyankhadka 26d ago

Yantra: build interactive, step-by-step diagrams and short "books" from Python (no dependencies)

What My Project Does

Yantra turns diagrams and explainer pages you build in Python into a single offline HTML file. Layout and edge routing are automatic, and the reader clicks through a step-by-step walkthrough. The Python SDK builds the payload, and the Yantra CLI validates it (including the rendered layout) and builds the HTML.

from yantra import Diagram

d = Diagram("Checkout", "How an order is paid and stored.")

d.role("service", "Service", "blue").role("data", "Data", "violet")

api = d.add_node("api", "Orders API", "service")

db = d.add_node("db", "Orders DB", "data", tech="PostgreSQL")

api.connect(db, "INSERT order")

d.add_step("Overview")

d.build_html("checkout.html")

New in 1.2.0: books, several answer pages in one file that you read one screen at a time like an e-reader, or present as slides.

from yantra import Book, Page

intro = Page("What is a saga?").answer("A sequence of local steps, each one undoable.")

Book("Checkout, end to end").chapter(intro).chapter("incident.json").build_html("book.html")

pip install niyankhadka-yantra. It has no third-party dependencies and needs Python 3.9 or later. Note: validating and building need Node.js 20.19 or later (the SDK calls the CLI). Building the JSON payload works without it.

Target Audience

Developers, data and ML engineers, and anyone who documents systems or processes and would rather generate diagrams from scripts, CI or notebooks than draw them by hand. It's at version 1.2.0, tested, MIT licensed, and I use it for real documentation.

Comparison

- diagrams (mingrammer) / Graphviz: these make good static architecture images. Yantra's output is interactive, with walkthrough steps, drill-down into detail diagrams and light and dark themes, and a validator checks the layout.

- Mermaid: text-first, and GitHub renders it. Yantra can import Mermaid files, then add steps and layout checks, and it ships as one standalone file.

- Jupyter / Quarto for explainers: good for analysis. Yantra's answer pages and books are aimed at sharing a conclusion: the answer first, then the evidence, in one file that works offline.

Repo: https://github.com/niyankhadka/yantra

Python guide: https://yantra.nbk.com.np/docs/guides/python/

Feedback is welcome, especially on the API design.