github nordstad/PinViz v0.1.0
0.1.0

latest releases: v0.1.5, v0.1.4, v0.1.3...
12 hours ago

🎉 Welcome to PinViz!

PinViz is a Python package that programmatically generates beautiful Raspberry Pi GPIO connection diagrams in SVG format. Create clear, professional wiring diagrams using simple YAML/JSON files or Python code.

✨ Key Features

  • Declarative Configuration: Define diagrams using YAML or JSON
  • Programmatic API: Create diagrams with Python code
  • Automatic Wire Routing: Smart wire routing with configurable styles (orthogonal, curved, mixed)
  • Inline Components: Add resistors, capacitors, and diodes directly on wires
  • Color-Coded Wires: Automatic color assignment based on pin function (I2C, SPI, power, ground, etc.)
  • Built-in Templates: Pre-configured boards (Raspberry Pi 5) and common devices (BH1750, IR LED rings, sensors, LEDs, buttons)
  • GPIO Pin Reference: Optional GPIO pinout diagram for easy reference
  • SVG Output: Scalable, high-quality vector graphics

📦 Installation

# Using uv (recommended)
uv add pinviz

# Using pip
pip install pinviz

🚀 Quick Start

YAML Configuration:

pinviz my-diagram.yaml -o output.svg

Python API:

from pinviz import boards, devices, Connection, Diagram, SVGRenderer

board = boards.raspberry_pi_5()
sensor = devices.bh1750_light_sensor()

connections = [
    Connection(1, "BH1750", "VCC"),  # 3V3 to VCC
    Connection(6, "BH1750", "GND"),  # GND to GND
    Connection(5, "BH1750", "SCL"),  # GPIO3/SCL to SCL
    Connection(3, "BH1750", "SDA"),  # GPIO2/SDA to SDA
]

diagram = Diagram(
    title="BH1750 Light Sensor Wiring",
    board=board,
    devices=[sensor],
    connections=connections
)

renderer = SVGRenderer()
renderer.render(diagram, "output.svg")

📋 What's Included

  • Supported Boards: Raspberry Pi 5 (with aliases rpi5, rpi)
  • Built-in Devices: BH1750 light sensor, IR LED ring, generic I2C/SPI devices, LED, button
  • Inline Components: Resistor, capacitor, diode support
  • Wire Styles: Orthogonal, curved, and mixed routing
  • Examples: 6 example diagrams (YAML and Python versions)
  • Full Test Suite: 187 tests with 85% code coverage
  • Type Hints: Complete type annotations with py.typed marker

📚 Documentation

See the README for full documentation, examples, and configuration reference.

🙏 Credits

Board and GPIO pin SVG assets courtesy of FreeSVG.org


Full Changelog: Initial release

Don't miss a new PinViz release

NewReleases is sending notifications on new releases.