Pure-Python declarative visuals and multi-target documentation compiler built for software engineers and AI coding agents.
Official Showcase Deck · v0.3.5 Ready
Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
Motivation (Ch. 1): Solving visual documentation drift with Python and Git
Visual Engines (Ch. 2–4): Primitives, 34 icon suites, SmartArts, charts, and diagrams
Publishing & AI (Ch. 5–6): Five project archetypes, Office export, and AI grid review
Drawlib — Illustration & Documentation as Code
Engineering teams are forced to choose between untrackable GUI binaries, rigid text DSLs, and isolated plotting libraries—causing visual architecture docs to drift behind code on every release.
Drawlib — Illustration & Documentation as Code
Turing-Complete Layout: Loops, variables, and shared utils.py helpers
Inline Code Blocks: Embed drawlib visuals directly inside Markdown
Deterministic PR Diffs: Review prose and diagram updates together
setup(width=120, height=32)
p = ChevronProcess(style=Styles.Neutral)
for s in ("Code", "Build", "Ship"): p.add(s)
p.draw((6, 8), width=108, height=16)
save()
Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
A single drawlib.toml manifest with [i18n] structural parity compiles synchronized English and Japanese deliverables across Web, Print, and Office from one Git commit.
Drawlib — Illustration & Documentation as Code
(0, 0) starts bottom-left (+X right, +Y up).(x, y) centers every shape, text, and icon.-g): Overlay coordinate ticks for exact verification.setup(width=100, height=60)
st = Styles.PrimaryFlat
rectangle((50, 30), 36, 22, style=st)
save()
Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
Font renders English and Japanese together.FontJapanese, FontArabic, and FontSourceCode.halign and valign.Dimage: Crop, resize, sepia, mosaic, plus font caching.Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
Styles.<Color><Variant> combines 8 roles (Primary..Dark) with Flat, Bold, Dashed, and Neutral..patch() & Themes: Customize safely via style.patch(...) or switch global themes in drawlib.toml.Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
Section, track completion via Task(progress=...), and pin Milestone diamonds.Dependency arrows and overlay vertical Marker lines (Today, Release) in code.Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
(x, y) via get_layout()offset(dx, dy) anytimeprint(layout)g = LayerGraph(direction="LR")
g.edge("ingest", "validate")
g.edge("validate", "serve")
layout = g.get_layout(margin=8.0)
layout.offset("serve", dy=-4.0)
Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
Animation(fps, loop) APIdraw_ratio on Lines, Charts & Diagrams<canvas> (anim_trigger, anim_pause, A)anim = Animation(fps=2.0, loop=0)
for r in [0.4, 0.7, 1.0]:
series.draw_ratio = r
with anim.frame():
chart.draw(xy=(10, 6))
Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
type = "site" (Narrative Docs): Guided chapter navigation via navbar.md, full-text search, dark mode & i18n (www.drawlib.com).type = "catalog" (API Reference): Zero-navbar.md 1 MD = 1 HTML dictionary extracting # H1 / badged ## H2 items with / instant filter (www.drawlib.com/api).Drawlib — Illustration & Documentation as Code
type = "doc")00_cover.md, 01_intro.md into one spec--generate-index builds cover & clickable index.docx# Build all 3 deliverables from doc_src/
uv run drawlib build html
uv run drawlib build pdf --generate-index
uv run drawlib build docx --generate-index
Drawlib — Illustration & Documentation as Code
::: block places crisp visuals on a 1920×1080 stage while ::: note stores speaker scripts in Git.?presenter=1 Presenter View via BroadcastChannel, plus Vector PDF & .pptx.Drawlib — Illustration & Documentation as Code
uv run drawlib rules show <topic>.-g coordinate grid previews multimodally and fix overlaps before publishing.Drawlib — Illustration & Documentation as Code
Drawlib — Illustration & Documentation as Code
https://www.drawlib.com/https://www.drawlib.com/api/https://examples.drawlib.com/ · github.com/yuichi110/drawlib