You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the Python ast module to build a backend tool that parses Plugin files and extracts the task function signatures, including type hints if they exist. This information will be shown on the frontend when a user is registering plugin tasks, and ultimately will be used to construct the tasks section of the Declarative Experiment Description. The type hints can be used to figure out if new parameter types can be suggested for registration, which will ultimately be used in the types section of the Declarative Experiment Description.
Note: We want to use ast instead of importlib because we do not want to execute arbitrary code just to extract the function signature information.
Basic requirements
The general idea is that, given a plugin task function signature that looks like this,
It is understood that the user will need to make modifications to the type information (content under "suggested_types" and the "type" fields under "inputs" and "outputs") before registration can be completed. The purpose for giving type suggestions is to provide initial suggestions and context that will be displayed in the frontend to help the user in this process.
The approach used to construct the "suggestion" field (lowercase, replace characters like [, ,, and spaces with underscores) may not be optimal, so alternative suggestions for how to do this are welcome. Also, this initial MVP should not try to lookup types that are already registered in Dioptra. That's something we can think about for future iterations of the tool.
The text was updated successfully, but these errors were encountered:
Use the Python ast module to build a backend tool that parses Plugin files and extracts the task function signatures, including type hints if they exist. This information will be shown on the frontend when a user is registering plugin tasks, and ultimately will be used to construct the tasks section of the Declarative Experiment Description. The type hints can be used to figure out if new parameter types can be suggested for registration, which will ultimately be used in the types section of the Declarative Experiment Description.
Note: We want to use
ast
instead ofimportlib
because we do not want to execute arbitrary code just to extract the function signature information.Basic requirements
The general idea is that, given a plugin task function signature that looks like this,
the tool will produce an output that looks like this,
It is understood that the user will need to make modifications to the type information (content under
"suggested_types"
and the"type"
fields under"inputs"
and"outputs"
) before registration can be completed. The purpose for giving type suggestions is to provide initial suggestions and context that will be displayed in the frontend to help the user in this process.The approach used to construct the
"suggestion"
field (lowercase, replace characters like[
,,
, and spaces with underscores) may not be optimal, so alternative suggestions for how to do this are welcome. Also, this initial MVP should not try to lookup types that are already registered in Dioptra. That's something we can think about for future iterations of the tool.The text was updated successfully, but these errors were encountered: