gdsfactory / kfactory

gdsfactory with a klayout backend
https://gdsfactory.github.io/kfactory/
MIT License
31 stars 11 forks source link

Add "tags" to cell decorator #425

Open tvt173 opened 1 month ago

tvt173 commented 1 month ago

Depending on the user or context, it may be useful to organize cells in a particular way. For example:

  1. Actives vs passives (or maybe electrical, optical, or electro-optical)
  2. golden vs experimental cells (or whatever maturity levels the organization might have)
  3. Functional groups, like splitters, routing elements, modulators, etc.

A nice way to do this might be to allow the specification of "tags" or "labels" on the component, within the cell decorator, so that they can be obtained without needing to invoke the component. Then the user could specify a set of tags for any given component, letting the downstream user of the library filter or organize as they please.

These tags could be simple like "splitter" or you could specify something like "maturity:golden" that gives the user a way to filter and select from a subcategory of tags.

For example, a component definition might look like this:

@cell(tags=["type:electro-optical", "group:modulators", "maturity:golden"])
def eam():
    # ...
    return component

@sebastian-goeldi @joamatab @flaport

sebastian-goeldi commented 1 month ago

Sure sounds reasonable. Where do you want to retrieve them from by tag? kcl.factories?

And maybe it makes sense to have the tags be a dict instead?

tvt173 commented 1 month ago

could be, if the tags will always be grouped like this, and there will always be one tag per group. i thought it might be more flexible this way though.