{"id":10347,"library":"wavedrom","title":"WaveDrom Python Library","description":"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.","status":"active","version":"2.0.3.post3","language":"python","source_language":"en","source_url":"https://github.com/wallento/wavedrompy","tags":["wavedrom","waveform","digital-design","svg","electronics","json"],"install":[{"cmd":"pip install wavedrom","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for parsing WaveJSON5 input format, which extends standard JSON.","package":"json5","optional":false},{"reason":"Used for parsing and handling color names in WaveDrom specifications.","package":"webcolors","optional":false}],"imports":[{"wrong":"from wavedrom.render import render_wavedrom_svg","symbol":"WaveDrom","correct":"from wavedrom import WaveDrom"},{"wrong":"from wavedrom.render import render_wavedrom_svg","symbol":"render","correct":"from wavedrom import render"},{"wrong":"from wavedrom.render import render_wavedrom_svg","symbol":"render_file","correct":"from wavedrom import render_file"}],"quickstart":{"code":"import json\nfrom wavedrom.render import render_wavedrom_svg\n\n# Define your WaveJSON/WaveJSON5 data as a string\nwavejson_data = '''\n{\n  \"signal\": [\n    { \"name\": \"clk\", \"wave\": \"p.....|...\" },\n    { \"name\": \"d\",   \"wave\": \"x.345x|x.23\" },\n    { \"name\": \"q\",   \"wave\": \"10101x|1010\" }\n  ],\n  \"head\": { \"text\": \"My Simple Waveform\" }\n}\n'''\n\n# Render the WaveJSON string to an SVG string\nsvg_output = render_wavedrom_svg(wavejson_data)\n\n# You can now save the SVG string to a file or embed it\n# with open(\"waveform.svg\", \"w\") as f:\n#     f.write(svg_output)\n\n# print(svg_output[:200]) # Print start of SVG to confirm","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade to `wavedrom` v2.x and update import paths to `from wavedrom.render import render_wavedrom_svg` for programmatic usage.","message":"The `wavedrom` library underwent a significant rewrite with version 2.0. The primary programmatic API for rendering changed. Older examples relying on direct `wavedrom.render_svg()` or accessing internal components may no longer work.","severity":"breaking","affected_versions":"< 2.0.0"},{"fix":"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`.","message":"The `render_wavedrom_svg` function expects a *string* containing valid WaveJSON or WaveJSON5 data. Passing a Python dictionary directly will result in an error, as it's not automatically serialized.","severity":"gotcha","affected_versions":">= 2.0.0"},{"fix":"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.","message":"While `wavedrom` provides a Python API, its name and `setup.py` entrypoint `wavedrom-cli` suggest it's often used as a command-line tool. Ensure you understand if you need the CLI (`wavedrom-cli input.json > output.svg`) or the Python library API.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"search_vec":"'2.0.3':55 'activ':58 'address':63 'allow':34 'api':16 'bug':64 'command':11 'command-lin':10 'compat':27 'current':52 'defin':37 'design':72 'diagram':21 'digit':19,71 'digital-design':70 'electron':74 'featur':67 'format':44 'generat':18 'imag':50 'input':24 'javascript':31 'json':43,75 'librari':3,7,32 'line':12 'mainten':59 'minor':66 'occasion':61 'post3':56 'programmat':15 'provid':8 'python':2,6 'releas':62 'render':46 'signal':39 'simpl':42 'specif':33 'svg':49,73 'user':35 'util':13 'version':53 'wavedrom':1,5,30,68 'waveform':20,38,69 'wavejson/wavejson5':23","created_at":"2026-04-17T01:23:39.386400+00:00","updated_at":"2026-04-17T01:23:39.386400+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.0.3.post3","cli_name":"wavedrom","cli_version":"sh: 1: wavedrom: not found","type":"library","homepage":"https://wavedrom.com","github":"https://github.com/wallento/wavedrompy","docs":null,"changelog":null,"pypi":"https://pypi.org/project/wavedrom/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}