kfnetlist
kfnetlist is a standalone, Rust-backed netlist schema for kfactory and netlist tooling.
It provides a fast, type-safe data model for circuit connectivity — instances, nets, ports, and arrays — with full JSON/dict serialization and Pydantic v2 integration. The core is implemented in Rust via PyO3 and has zero runtime Python dependencies.
-
Getting Started
Install kfnetlist and build your first netlist in under 5 minutes.
-
Core Concepts
Understand the Netlist data model, port types, and serialization.
-
Extraction
Extract hierarchical netlists from kfactory/klayout layout cells.
-
Guides
Equivalent ports, instance flattening, and common patterns.
Key Features
- Rust core —
Netlist,Net, and port types implemented in Rust for speed and memory safety - Zero runtime dependencies — the base package has no Python dependencies
- Full serialization —
to_json()/from_json()andto_dict()/from_dict()on every type - Pydantic v2 support — all types implement
__get_pydantic_core_schema__ - Equivalent ports — fold electrically-equivalent ports into canonical names for netlist comparison
- Instance flattening — merge sub-cell instances into the parent, reconnecting touching nets
- Port checking —
PortCheckbitmask andcheck_connection()for geometric port-pair comparison - Netlist extraction — extract hierarchical netlists from kfactory/klayout cells
Relationship to kfactory
kfnetlist is the netlist data model that kfactory uses internally. It is published as a separate package so that:
- Tools that only need netlist manipulation do not have to depend on kfactory or klayout
- The netlist schema can evolve on its own release cadence
- Downstream projects can consume netlists without pulling in a full layout framework
For end-to-end examples of netlist extraction using kfactory, see the kfactory schematics documentation.