pcb-tools
is currently without a maintainer. Code is provided as is. Check curtacircuitos#228 to a list of possible alternatives. PyGerber or other forks of pcb-tools
might be what you need.
Tools to handle Gerber and Excellon files in Python.
import gerber
from gerber.render import GerberCairoContext
# Read gerber and Excellon files
top_copper = gerber.read('example.GTL')
nc_drill = gerber.read('example.txt')
# Rendering context
ctx = GerberCairoContext()
# Create SVG image
top_copper.render(ctx)
nc_drill.render(ctx, 'composite.svg')
Source code for this example can be found here.
Install from source:
$ git clone https://github.com/curtacircuitos/pcb-tools.git
$ cd pcb-tools
$ pip install -r requirements.txt
$ python setup.py install
Dependencies for developing and testing pcb-tools are listed in requirements-dev.txt. Use of a virtual environment is strongly recommended.
$ virtualenv venv
$ source venv/bin/activate
(venv)$ pip install -r requirements-dev.txt
(venv)$ pip install -e .
We use pytest to run pcb-tools's suite of unittests and doctests.
(venv)$ pytest