Getting Started
This section covers the first workflow: install pyDreamplet, create an SVG canvas, draw a shape, and save the result.
Installation
Install the core package with uv:
uv add pydreamplet
Or with pip:
pip install pydreamplet
For notebook display support, install the optional notebook extra:
uv add "pydreamplet[notebook]"
pip install "pydreamplet[notebook]"
Your First SVG
Create a canvas, append a shape, then save the SVG file:
import pydreamplet as dp
svg = dp.SVG(300, 300)
circle = dp.Circle(
cx=150,
cy=150,
r=90,
fill="#14b8a6",
stroke="#0f172a",
stroke_width=4,
)
svg.append(circle)
svg.save("example.svg")
In a notebook, use display() to render the result inline:
svg.display()
Core Ideas
pyDreamplet mirrors the structure of SVG. You create elements, configure their attributes, append them to a parent, and export the result.
SVGis the root canvas.- Shape classes such as
Circle,Rect,Line,Path, andTextmap to SVG elements. Ggroups elements and lets you move or transform them together.- Scales and generators help turn data into visual geometry.
Next
Continue with Drawing basics for canvas size, coordinates, common shapes, styling, display, and saving.