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

Split apart component infra to allow for abstract class integration #5017

Merged
merged 10 commits into from
Jan 13, 2025

Conversation

jackgerrits
Copy link
Member

@jackgerrits jackgerrits commented Jan 12, 2025

This PR addresses some shortcomings in the way the component infra was defined. Essentially, it is fixing the fact that the T in Component[T] had to be invariant before. Now, a consumer can consume just the pieces required and create an abstract base class that can just be ComponentToConfig[BaseModel] and ComponentLoader and still have the subclasses use the concrete types.

This does not break any usage of creating component. The only things it breaks is:

  • Usage of ComponentConfigImpl
  • Checking for an instance of a component by checking against the Component type. These checks should now be done with is_component_class

I consider these to be incredibly specific and implementation details, especially this early. Therefore, it is not a breaking change.

Copy link

codecov bot commented Jan 12, 2025

Codecov Report

Attention: Patch coverage is 90.90909% with 5 lines in your changes missing coverage. Please review.

Project coverage is 68.52%. Comparing base (70f7e99) to head (d307733).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...autogen-core/src/autogen_core/_component_config.py 90.38% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5017      +/-   ##
==========================================
+ Coverage   68.50%   68.52%   +0.01%     
==========================================
  Files         156      156              
  Lines       10129    10140      +11     
==========================================
+ Hits         6939     6948       +9     
- Misses       3190     3192       +2     
Flag Coverage Δ
unittests 68.52% <90.90%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@victordibia victordibia self-requested a review January 13, 2025 01:10
Copy link
Collaborator

@victordibia victordibia left a comment

Choose a reason for hiding this comment

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

It might be good to add an "advanced" section to the to config part of the docs with examples on how to use this e.g. for abstract classes.
Thanks.

@jackgerrits jackgerrits added this to the 0.4.1 milestone Jan 13, 2025
@jackgerrits
Copy link
Member Author

It might be good to add an "advanced" section to the to config part of the docs with examples on how to use this e.g. for abstract classes. Thanks.

Agreed but I want to use it and make sure it works before we document it. Just in case.

@jackgerrits jackgerrits enabled auto-merge (squash) January 13, 2025 16:42
@jackgerrits jackgerrits disabled auto-merge January 13, 2025 16:42
@jackgerrits jackgerrits merged commit 404522b into main Jan 13, 2025
62 checks passed
@jackgerrits jackgerrits deleted the split_component_infra branch January 28, 2025 14:31
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.

2 participants