Skip to content

add type tags to all @cell components#231

Open
joamatab wants to merge 1 commit intomainfrom
add-component-type-tags
Open

add type tags to all @cell components#231
joamatab wants to merge 1 commit intomainfrom
add-component-type-tags

Conversation

@joamatab
Copy link
Copy Markdown
Contributor

@joamatab joamatab commented Apr 14, 2026

Summary

  • Adds tags={"type": "<filename>"} to all @gf.cell and @gf.cell_with_module_name decorators
  • Type is derived from the source filename (e.g., waveguides.py"waveguides", couplers.py"couplers")
  • Enables filtering and categorization of components by type

Mirrors the change in gdsfactory: gdsfactory/gdsfactory@4c216c5ef

Test plan

  • Verify all cells still instantiate correctly via make test
  • Check that tags appear in cell metadata

🤖 Generated with Claude Code

Summary by Sourcery

New Features:

  • Introduce per-file type tags on all @gf.cell-decorated components for waveguides, couplers, tapers, spirals, rings, heaters, mmis, mzis, vias, containers, grating couplers, text, die, and generic cells.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Apr 14, 2026

Reviewer's Guide

Annotates all @gf.cell component decorators with a per-file "type" tag derived from the source filename to enable component categorization and filtering, without changing cell implementations or signatures.

Sequence diagram for cell instantiation with type tags

sequenceDiagram
    actor Designer
    participant cspdk_cells as cspdk_cell_function
    participant gf_cell as gf_cell_decorator
    participant Component as gf_Component

    Designer->>cspdk_cells: call straight(...)
    activate cspdk_cells
    cspdk_cells->>gf_cell: decorator wraps function with tags={type: filename}
    activate gf_cell
    gf_cell-->>cspdk_cells: return wrapped_cell
    deactivate gf_cell

    cspdk_cells->>wrapped_cell: execute wrapped_cell(...)
    activate wrapped_cell
    wrapped_cell->>Component: create Component
    activate Component
    Component-->>wrapped_cell: Component instance
    deactivate Component

    wrapped_cell-->>Designer: Component (metadata.tags.type = waveguides|couplers|...) 
    deactivate wrapped_cell
    deactivate cspdk_cells
Loading

File-Level Changes

Change Details Files
Add "type" metadata tags to all @gf.cell decorators across CSPDK cells to categorize components by their source file type.
  • Wrap every @gf.cell decorator invocation with tags={"type": "<module_basename>"} while keeping function bodies and signatures unchanged.
  • Standardize type tag values to match module names such as "cells", "waveguides", "couplers", "die", "containers", "fixed", "spirals", "tapers", "grating_couplers", "heaters", "mmis", "rings", "text", "mzis", and "vias".
  • Ensure consistency between cband and oband variants by applying the same tagging scheme in corresponding modules.
cspdk/si500/cells.py
cspdk/sin300/cells.py
cspdk/si220/cband/cells/waveguides.py
cspdk/si220/oband/cells/waveguides.py
cspdk/si220/cband/cells/die_with_pads.py
cspdk/si220/oband/cells/containers.py
cspdk/si220/oband/cells/die_with_pads.py
cspdk/si220/cband/cells/containers.py
cspdk/si220/cband/cells/couplers.py
cspdk/si220/cband/cells/fixed.py
cspdk/si220/cband/cells/spirals.py
cspdk/si220/cband/cells/tapers.py
cspdk/si220/oband/cells/couplers.py
cspdk/si220/oband/cells/fixed.py
cspdk/si220/oband/cells/spirals.py
cspdk/si220/oband/cells/tapers.py
cspdk/si220/cband/cells/grating_couplers.py
cspdk/si220/cband/cells/heaters.py
cspdk/si220/cband/cells/mmis.py
cspdk/si220/cband/cells/rings.py
cspdk/si220/cband/cells/text.py
cspdk/si220/oband/cells/grating_couplers.py
cspdk/si220/oband/cells/heaters.py
cspdk/si220/oband/cells/mmis.py
cspdk/si220/oband/cells/rings.py
cspdk/si220/oband/cells/text.py
cspdk/si220/cband/cells/mzis.py
cspdk/si220/cband/cells/vias.py
cspdk/si220/oband/cells/mzis.py
cspdk/si220/oband/cells/vias.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • To reduce repetition and make future updates easier, consider defining a module-level constant for the tag (e.g. TAGS = {"type": "waveguides"}) and reusing it across all @gf.cell decorators in each file instead of inlining the same dict literal many times.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- To reduce repetition and make future updates easier, consider defining a module-level constant for the tag (e.g. `TAGS = {"type": "waveguides"}`) and reusing it across all `@gf.cell` decorators in each file instead of inlining the same dict literal many times.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant