Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for assigning references in importer API #183

Open
amykyta3 opened this issue Jul 19, 2023 · 1 comment
Open

Add support for assigning references in importer API #183

amykyta3 opened this issue Jul 19, 2023 · 1 comment
Assignees
Labels
feature New feature or request

Comments

@amykyta3
Copy link
Member

amykyta3 commented Jul 19, 2023

Currently the importer API only allows building components with "regular" property values.
Add support for assigning instance and property references to component properties.

Some considerations to be aware of:

  • References that involve array indexes may require more complex construction, since simply providing the terminal endpoints is not enough information.
    • Need an intuitive way for the user to be able to provide the lineage of array indexes as well.
    • Alternatively, do not support this yet?
  • Will likely need to add a parent member to the Component class to facilitate construction of the internal ComponentRef object. I believe in most/all cases, parent shall never be deepcopied (copy by ref instead).
  • This will likely be implemented as Importer.create_inst_reference() and Importer.create_prop_reference() methods.
    • Inputs are the source component, destination component, and source property name (for prop refs)
    • Returns a ComponentRef/PropertyRef object respectively.
  • When assigning the reference object via Importer.assign_property(), check that a DPA is allowed.
    • Since prop refs imply a DPA, check that spec rules are not being violated inadvertently.
@amykyta3 amykyta3 added the feature New feature or request label Jul 19, 2023
@amykyta3 amykyta3 self-assigned this Jul 19, 2023
@Risto97
Copy link

Risto97 commented Sep 23, 2024

Hello @amykyta3.
This issue is blocking me right now.
I want to be able to assign a field instance to next, enable, field properties.

I know you are probably busy to implement it.
If you already started working on it, or could give some more pointers, I could try to implement it.

I see for now that the assign_property() does not allow value to be a Component

if isinstance(value, comp.Component):
# Warn user that this is not how references work
raise TypeError("Invalid assignment type")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Development

No branches or pull requests

2 participants