skillfed

kfactory

KLayout API implementation of gdsfactory

kfactory v3.0.4 242.9K downloads/30d#8,833 on PyPI
License unclear Active released

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 kfactory

uv

uv add kfactory

poetry

poetry add kfactory

Installing 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

Operating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

photonic chip layout designparametric cell generationoptical waveguide routingGDS layout frameworkschematic-driven chip designKLayout Python APIelectronic circuit layoutnetlist extraction verification
chip-designphotonicsparametric-layout

More Scientific/Engineering packages