gdsfactory is an EDA (electronics design automation) tool to Layout Integrated Circuits.

It is based on phidl and gdspy and provides you with functions to build your GDSII components, PDKs and masks for different foundries.

You just need to adapt the functions to your foundry and build your own library of elements (see UBC PDK example).

gdsfactory provides you with:

  • functions easily adaptable to define components
  • functions to route electrical ports to pads and optical ports grating couplers
  • functions to define components, circuit netlists or masks in YAML files
  • As inputs, gdsfactory needs you to write python functions, python dataclasses or YAML files to describe your layouts.

As output it creates GDSII files (GDSII is the standard format to describe masks sets in the CMOS industry). It also can output JSON files with components settings (that you can use for measurement and data analysis) and JSON or CSV files for testing the devices after fabrication. You can also easily adapt this metadata output files to your needs.


First, you need to install klayout to visualize the GDS files that you create.

gdsfactory works for python>=3.7 in Windows, MacOs and Linux.
Github runs all the tests at least once a day for different versions of python (3.7, 3.8, 3.9)

If you are on Windows, I recommend you install gdsfactory with Anaconda3 or Miniconda3.

conda install -c conda-forge gdspy
pip install gdsfactory
pf install

For Linux and MacOs you can also install gdsfactory without Anaconda3:

pip install gdsfactory
pf install

Or you can install the development version if you plan to contribute to gdsfactory:

git clone
cd gdsfactory
make install

To summarize: There are 2 methods to install gdsfactory

  1. pip install gdsfactory will download it from PyPi (python package index)
  2. you can download it from GitHub in your computer and link the library to your python
git clone
cd gdsfactory
make install

for updating 1. you need to pip install gdsfactory --upgrade
for updating 2. you need to pull from GitHub the latest changes

cd gdsfactory
git pull

After installing you should be able to import pp from a python script. The name gdsfactory was too long so we chose pp instead, which stands for photonics package.

  • pp
    • components: define components
    • drc: check geometry
    • gdsdiff: hash geometry and show differences by displaying boolean operations in klayout
    • klive: stream GDS directly to klayout
    • ports: to connect components
    • routing: add waveguides to connect components
    • samples: python tutorial
    • tests:
    • klayout: klayout generic tech layers and klive macro
  • docs/notebooks: jupyter-notebooks based tutorial