kfactory
KLayout API implementation of gdsfactory
What it is and what it does
KFactory is a Python framework for designing photonic and electronic chip layouts, built on KLayout's C++ geometry engine. It abstracts chip design into parametric cells that can be cached and reused, provides routing algorithms for optical and electrical paths, and supports cross-section definitions for waveguide profiles. The framework integrates schematic-driven workflows with netlist extraction and layout-vs-schematic verification, allowing designers to move between logical schematics and physical layouts.
The package works with both integer (DBU) and floating-point (µm) coordinate systems, includes Jupyter integration for live preview in KLayout, and bundles a PDK system for packaging technology definitions. It requires Python 3.12 or later and depends on 18 runtime packages spanning geometry (scipy, rectangle-packer), configuration (pydantic, ruamel-yaml), and version management (semver). No known security vulnerabilities are reported.
Use it for:
- Design parametric photonic circuits with automatic cell deduplication and caching
- Route optical waveguides and electrical traces with Manhattan and all-angle primitives
- Define reusable cross-sections and automatically generate cladding layers via Minkowski sums
- Extract netlists from physical layouts and verify consistency with schematics
- Develop technology PDKs that bundle layers, factories, and design rules for reuse
- Interactively preview and edit chip layouts in Jupyter notebooks with KLive integration
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
KFactory is a Python framework for designing photonic and electronic chip layouts, providing parametric cells, routing primitives, cross-section definitions, and schematic-driven design with layout verification on top of KLayout's geometry engine.
Yes, if you are designing photonic or electronic chips and want a Python-native parametric layout framework. The active maintenance, low install friction, and rich feature set (routing, schematics, verification) make it a solid choice for chip design workflows. Verify the license treatment before use in proprietary contexts, and confirm klayout system dependencies match your environment.
Install
kfactory on PyPI
pip
pip install kfactoryuv
uv add kfactorypoetry
poetry add kfactoryInstalling kfactory
Before you install
Low friction; pure Python wheel with 18 runtime dependencies including well-maintained packages like pydantic, loguru, and scipy. Active maintenance with a release 18 days ago. Requires Python 3.12 or later.
License in practice
License treatment is unclear in the fact sheet; the description excerpt mentions MIT licensing, but the metadata does not confirm this. Verify the actual license before adopting in a commercial or restricted context.
Quickstart
pip install kfactory
import kfactory as kf
@kf.cell
def my_waveguide() -> kf.KCell:
return kf.KCell(name="waveguide")
Requires Python 3.12 or later; klayout system dependency may need separate installation depending on your platform.
Verify before relying
- Whether the MIT license mentioned in the description excerpt is the authoritative license for this version
- Whether klayout requires system-level installation or is bundled with the package
- Performance characteristics and scalability limits for large chip designs
- Compatibility guarantees with specific KLayout versions
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.12) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 18 — aenum, cachetools, kfnetlist, klayout, loguru, pydantic, pydantic-extra-types, pydantic-settings, pygit2, rapidfuzz, rectangle-packer, requests, ruamel-yaml, ruamel-yaml-string, scipy, semver, toolz, typer |
| Maintenance | actively maintained — 18 days since the last release |
| First released | |
| Downloads | 242,878/month — #8,833 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: kfactory-3.0.4-py3-none-any.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
elvis-lvsElvis extracts connectivity from GDS layout…
unclear · top 15,000 on PyPI
gdsfactoryGDSFactory generates CAD files (GDS, OASIS,…
unclear · top 15,000 on PyPI
klayoutKLayout is a Python package for layout viewing,…
copyleft · top 15,000 on PyPI
kwasmkwasm bundles KLayout's WebAssembly-compiled…
copyleft · top 15,000 on PyPI
salamandraSalamandra is a Python framework for loading,…
permissive · top 15,000 on PyPI
saxSAX is a JAX-based simulator and optimizer for…
permissive · top 15,000 on PyPI
gdsfactoryplusGDSFactory+ extends the GDSFactory library with…
unclear · top 15,000 on PyPI
gpluginsGplugins provides a plugin system for…
unclear · top 15,000 on PyPI
dvsimDVSim is a Python-based build and run system…
permissive · top 15,000 on PyPI
lambdapdkLambdapdk provides pre-configured, open-source…
permissive · top 5,000 on PyPI