General GDS-to-code line mapping with text label during generation
Is your feature request related to a problem? Please describe.
A problem I encounter often is when looking at a GDS of complex components, it's hard to track where a subcomponent is generated in the corresponding code. Would be nice to have gdsfactory-wide approach to this problem.
Describe the solution you'd like
Support automatically adding a text label containing which line and which file was a component generated in. This seems like the simplest approach to generally tackling this problem. Ideally, this would be a setting in gdsfactory.config. and implemented somehow with the cell decorator
how about using the post_process flag?
how about using the
post_processflag?
Then it would be nice to have a convenient way to stack multiple post_process functions in case that is already used for relevant geometry generation.
at the moment you can compose using toolz.compose
Something we could do is https://github.com/gdsfactory/gdsfactory/pull/2594
what do you think?
Supporting a sequence of functions sounds good to me but I think https://github.com/gdsfactory/gdsfactory/pull/2594 doesn't yet close this issue. Would need some sort of snippet implementing the file and linenumber as label in the GDS.
One problem that still persist is how to add a post_process step easily to something that already has a post_process step in a functools.partial for example. Do we just need to accept having to do something like
component_f1 = partial(component, post_process=f1)
component_f1_f2 = partial(component_f1, post_process=[component_f1.keywords['post_process'], f2])