gsim-py 0.6.2

PyO3 bindings exposing gsim-core to Python: build a schematic from code, validate it and compile it to a netlist.
Documentation

gsim-py

Python bindings for gsim-core: the schematic document model, its validation rules, and the compile registry that turns a document into a netlist.

This is the compiled layer. Most people want gsim-tools instead, which is the ergonomic Python API built on top of it:

from gsim_tools.schematic import Schematic

sch = Schematic("rc", "RC low-pass")
vin = sch.add("source.voltage.dc", id="Vin", at=(0, 0), V=5.0)
r1 = sch.add("passive.resistor", id="R1", at=(60, 0), R=1000.0)
c1 = sch.add("passive.capacitor", id="C1", at=(120, 0), C=1e-6)
gnd = sch.add("routing.ground", id="gnd", at=(60, 80))
sch.connect(vin.p, r1.p1)
sch.connect(r1.p2, c1.p1)
sch.connect(c1.p2, gnd.p)
sch.connect(vin.n, gnd.p)

print(sch.compile())
* RC low-pass -- generated by gsim-core 0.1.0 from model 'rc'
Vin n_R1_p1 0 5
R1 n_R1_p1 n_C1_p1 1000
C1 n_C1_p1 0 1e-6

Why the model is in Rust

One implementation, three front ends. The same document model, the same port-compatibility rules and the same compile registry back the schematic editor (through WASM), this Python binding, and the engine itself — rather than a TypeScript copy and a Python copy that drift apart and disagree about which document is valid.

Building

pip install maturin
maturin build --release        # wheel in ../../target/wheels/

MIT licensed.