import kfactory as kf
@kf.kcl.cell
def my_cell_function(...) -> kf.KCell:
...
Will now register the function at kf.kcl.factories.my_cell_function
import kfactory as kf
@kf.kcl.cell(register_factory=False)
def my_cell_function(...) -> kf.KCell:
...
Will not add it to kf.ckl.factories
Note: It's vital to use the proper KCLayout for registration:
import kfactory as kf
from my_package import MyPDK # Custom KCLayout instance (!=kf.kcl)
### Correct
@MyPDK.cell
def my_cell_function(...) -> kf.KCell:
c = MyPDK.kcell() # or kf.KCell(kcl=MyPDK)
...
return c
### Throws an error because we are trying to register a KCell belonging to `MyPDK` in `kf.kcl`
@kf.cell # or @kf.kcl.cell
def my_cell_function(...) -> kf.KCell:
c = MyPDK.kcell()
...
return c
### Throws an error because we are trying to register a KCell belonging to `kf.kcl` in `MyPDK`
@MyPDK.cell
def my_cell_function(...) -> kf.KCell:
c = kf.KCell() # or kf.kcl.kcell()
...
return c
Will now register the function at
kf.kcl.factories.my_cell_function
Will not add it to
kf.ckl.factories
Note: It's vital to use the proper KCLayout for registration: