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 component argument inference #763

Merged
merged 3 commits into from
Jan 9, 2024
Merged

Conversation

RobbeSneyders
Copy link
Member

Fixes #751

This PR introduces functionality to infer the arguments from a Component class. The result is a dictionary with the argument names as keys, and Argument instances as values, which is the format of component_spec.args.

We can leverage this behavior for Lightweight Python components as described in #750.

Did some TDD here, let me know if I missed any cases.

@RobbeSneyders
Copy link
Member Author

Pipeline failure is unrelated. Submitted #764 to fix it.

Copy link
Contributor

@PhilippeMoussalli PhilippeMoussalli left a comment

Choose a reason for hiding this comment

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

Thanks Robbe! Nice work, the tests are quite extensive and seem to cover all scenarios

BUILTIN_TYPES = [str, int, float, bool, dict, list]


def annotation_to_type(annotation: t.Any) -> t.Type:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice !

Copy link
Collaborator

Choose a reason for hiding this comment

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

😍

@RobbeSneyders RobbeSneyders merged commit 0861022 into main Jan 9, 2024
6 checks passed
@RobbeSneyders RobbeSneyders deleted the feature/init-type-inference branch January 9, 2024 13:44
RobbeSneyders added a commit that referenced this pull request Jan 18, 2024
Follow-up to use the argument inference functionality added in #763
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.

Infer the arguments based on component __init__ arguments
3 participants