The `wavedrom` Python library provides a command-line utility and programmatic API for generating digital waveform diagrams from WaveJSON/WaveJSON5 input. It's compatible with the WaveDrom JavaScript library specification, allowing users to define waveform signals in a simple JSON format and render them into SVG images. The current version is 2.0.3.post3, with active maintenance and occasional releases addressing bugs and minor features.
pip install wavedromVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically render a WaveJSON string into an SVG image using the `render_wavedrom_svg` function. The input is a multi-line string containing the WaveJSON specification.
Upgrade to `wavedrom` v2.x and update import paths to `from wavedrom.render import render_wavedrom_svg` for programmatic usage.
If you have your WaveDrom data as a Python dictionary, serialize it to a JSON/JSON5 string first using `json.dumps()` or `json5.dumps()` before passing it to `render_wavedrom_svg`.
For programmatic use within Python scripts, import `render_wavedrom_svg`. For quick conversions or shell scripting, use the `wavedrom-cli` executable installed to your PATH.