Alignment-first Python DSL for circuit schematics and stripboard layout previews.
Project description
mege-circuits
mege-circuits is an alignment-first Python DSL for drawing small circuit
schematics and projecting them onto diagnostic stripboard-style layout previews.
It grew out of the Ender 3 V3 KE IDEX wiring work, but is now a standalone project for reusable circuit drawing, stripboard visualization, and experiments around hand-buildable electronics layouts.
Status: early open-source extraction. The schematic API and current schematic-to-stripboard projection are useful and tested, but the projection is not yet a verified stripboard router or manufacturing plan.
Install
From PyPI:
pip install mege-circuits
For local development:
git clone git@github.com:m-emm/mege-circuits.git
cd mege-circuits
pip install -e ".[testing]"
Vector A4 stripboard PDF generation uses rsvg-convert. Install it with
brew install librsvg on macOS or sudo apt-get install librsvg2-bin on
Debian/Ubuntu.
Quick Start
from pathlib import Path
from mege_circuits.simple import *
vcc_net = create_net("vcc")
out_net = create_net("out")
gnd_net = create_net("gnd")
vcc = create_node(Dot, "vcc", net=vcc_net, label="+5V")
out = create_node(Dot, "out", net=out_net, label="OUT")
gnd = create_node(Ground, "gnd", net=gnd_net)
r1 = create_element(Resistor, "R1", "10K", vcc, out)
r2 = create_element(Resistor, "R2", "20K", out, gnd)
r1 = align(r1, vcc, Alignment.STACK_BOTTOM)
out = align(out, r1, Alignment.BOTTOM)
r2 = align(r2, out, Alignment.STACK_BOTTOM)
gnd = align(gnd, r2.end, Alignment.CENTER)
schema = create_schema([vcc, out, gnd], [r1, r2])
render_schemdraw(schema, file=Path("voltage_divider.svg"))
Use a .png filename to render a PNG preview.
Examples
Run the small schematic examples from the repository root:
python examples/voltage_divider.py
python examples/stripboard_blank.py
The main real-world integration example is the Pico-to-TB6600 stripboard interface:
python examples/integration/tb6600_stripboard_interface.py
python examples/integration/tb6600_stripboard_layout.py
Those scripts render both schematic and diagnostic stripboard projection
artifacts next to the example by default. The test suite renders them into
examples/integration/diagrams/ as gitignored SVG/PNG files so the latest
integration output is easy to inspect after changes. Each render uses a unique
timestamped filename to avoid local preview caches; stable filenames in that
directory are symlinks to the newest generated artifacts.
Documentation
The blueprint describes how the current projection path should evolve into a netlist-driven, verified stripboard planner while keeping the visualization engine.
Development
pip install -e ".[testing]"
python -m pytest
Slow integration and optimizer regressions are skipped by default. Run them explicitly when changing the stripboard router or generated TB6600 artifacts:
python -m pytest --runslow
python -m pytest --runslow -m slow
CI runs the test suite on Python 3.11 and 3.12.
License
MIT. See LICENSE.txt.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mege_circuits-0.1.1.tar.gz.
File metadata
- Download URL: mege_circuits-0.1.1.tar.gz
- Upload date:
- Size: 124.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa81701f2df14184680fc9bff98c3363a4828f10a675fd01f2304c5cd75cd0fa
|
|
| MD5 |
be40031b786c7cb444cb0947fe3c5409
|
|
| BLAKE2b-256 |
8fe963ba4692d3bcb37a5afe8cfb80e39c66d1ecc415a9d59b0b466f5e9b2551
|
Provenance
The following attestation bundles were made for mege_circuits-0.1.1.tar.gz:
Publisher:
publish-to-pypi.yml on m-emm/mege-circuits
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mege_circuits-0.1.1.tar.gz -
Subject digest:
aa81701f2df14184680fc9bff98c3363a4828f10a675fd01f2304c5cd75cd0fa - Sigstore transparency entry: 2022176314
- Sigstore integration time:
-
Permalink:
m-emm/mege-circuits@8df3c841e8b1f008b4232cab5fd43a22973f105d -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/m-emm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@8df3c841e8b1f008b4232cab5fd43a22973f105d -
Trigger Event:
push
-
Statement type:
File details
Details for the file mege_circuits-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mege_circuits-0.1.1-py3-none-any.whl
- Upload date:
- Size: 74.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8876e4dbb0ff3b1df5ac05b4292c67ba69d1f65f625b0a664c6b9e174c19569a
|
|
| MD5 |
57e90a0f5b71cb6c5615a5e5a3ddcc02
|
|
| BLAKE2b-256 |
0381bf3bb7da0294427ded4dbb69ec1db46a0bfd7841bf81686df3cea2942ce6
|
Provenance
The following attestation bundles were made for mege_circuits-0.1.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on m-emm/mege-circuits
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mege_circuits-0.1.1-py3-none-any.whl -
Subject digest:
8876e4dbb0ff3b1df5ac05b4292c67ba69d1f65f625b0a664c6b9e174c19569a - Sigstore transparency entry: 2022176425
- Sigstore integration time:
-
Permalink:
m-emm/mege-circuits@8df3c841e8b1f008b4232cab5fd43a22973f105d -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/m-emm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@8df3c841e8b1f008b4232cab5fd43a22973f105d -
Trigger Event:
push
-
Statement type: