KFactory is a Python framework for photonic and electronic chip layout, built on KLayout's C++ geometry engine. It provides parametric cells with caching, optical and electrical routing, enclosures via Minkowski sums, and schematic-driven design with LVS.
- Cell caching — the
@kf.celldecorator deduplicates identical components automatically - Routing — optical and electrical bundle routing, Manhattan primitives, all-angle routing, and path-length matching
- Cross-sections & enclosures — define waveguide profiles and automatic boolean cladding layers via Minkowski sums
- Schematics — place-and-connect workflow with netlist extraction and layout-vs-schematic verification
- Virtual cells — hierarchical logical containers for schematic-driven design
- Dual coordinate systems —
KCell(integer DBU) andDKCell(float µm) work side by side - KLayout integration — full access to
kdb.Region,kdb.Polygon, DRC, and GDS/OASIS I/O - Jupyter & KLive — live preview in KLayout while editing notebooks
- PDK system — bundle layers, factories, cross-sections, and technology into reusable packages
KFactory is available on PyPI and requires Python 3.12+.
uv add kfactory
# or with pip
pip install kfactoryjust devThis installs the development environment and sets up pre-commit hooks.
| Package | Description |
|---|---|
| gdsfactory | Full-featured chip design framework — KFactory is its layout backend |
| kfnetlist | Standalone netlist extraction and generation |
Full documentation is available at gdsfactory.github.io/kfactory.
Upgrading from an earlier version? See the migration guide.