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

Python: fix: Preserve class type in experimental_class decorator to avoid type inference issues #6709

Merged
merged 2 commits into from
Jun 14, 2024

Conversation

miladh
Copy link
Contributor

@miladh miladh commented Jun 14, 2024

Motivation and Context

Closes #6707

Description

  • Introduce TypeVar T bounded to type to ensure the decorator maintains the class type.
  • Modify the experimental_class decorator to use the bounded TypeVar for accurate type hinting.

Contribution Checklist

…ype inference issues

- Introduce `TypeVar` `T` bounded to `type` to ensure the decorator maintains the class type.
- Modify the `experimental_class` decorator to use the bounded `TypeVar` for accurate type hinting.
@markwallace-microsoft markwallace-microsoft added the python Pull requests for the Python Semantic Kernel label Jun 14, 2024
@github-actions github-actions bot changed the title fix: Preserve class type in experimental_class decorator to avoid type inference issues Python: fix: Preserve class type in experimental_class decorator to avoid type inference issues Jun 14, 2024
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Jun 14, 2024

Py3.10 Test Coverage

Python 3.10 Test Coverage Report •
FileStmtsMissCoverMissing
TOTAL636371889% 
report-only-changed-files is enabled. No files were changed during this commit :)

Python 3.10 Unit Test Overview

Tests Skipped Failures Errors Time
1511 1 💤 0 ❌ 0 🔥 18.802s ⏱️

@miladh miladh marked this pull request as ready for review June 14, 2024 16:45
@miladh miladh requested a review from a team as a code owner June 14, 2024 16:45
Copy link
Contributor

@moonbox3 moonbox3 left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

@moonbox3 moonbox3 enabled auto-merge June 14, 2024 16:47
@moonbox3 moonbox3 added this pull request to the merge queue Jun 14, 2024
Merged via the queue into microsoft:main with commit a9d361a Jun 14, 2024
23 checks passed
LudoCorporateShark pushed a commit to LudoCorporateShark/semantic-kernel that referenced this pull request Aug 25, 2024
… avoid type inference issues (microsoft#6709)

### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

Closes microsoft#6707 

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

- Introduce `TypeVar` `T` bounded to `type` to ensure the decorator
maintains the class type.
- Modify the `experimental_class` decorator to use the bounded `TypeVar`
for accurate type hinting.


### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests for the Python Semantic Kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python: experimental_class decorator (new in semantic kernel 1.0.x) is causing typing errors (?)
4 participants