Skip to content

delegate_inference raise error in python-preview branch #168

Closed

Description

@joowon-dm-snu

Describe the bug
while run pytest . in semantic-kernel/python/tests

@staticmethod
def infer_delegate_type(function) -> DelegateTypes:
    # Get the function signature
    function_signature = signature(function)
    awaitable = iscoroutinefunction(function)

    for name, value in DelegateInference.__dict__.items():
        if name.startswith("infer_") and hasattr(
>               value.__wrapped__, "_delegate_type"
        ):
E           AttributeError: 'staticmethod' object has no attribute '__wrapped__'

../semantic_kernel/orchestration/delegate_inference.py:240: AttributeError
======================================================================================= short test summary info =======================================================================================
FAILED test_text_skill.py::test_can_be_imported - AttributeError: 'staticmethod' object has no attribute '__wrapped__'
FAILED test_text_skill.py::test_can_be_imported_with_name - AttributeError: 'staticmethod' object has no attribute '__wrapped__'
===================================================================================== 2 failed, 9 passed in 0.23s =====================================================================================

To Reproduce
Steps to reproduce the behavior:

  1. Go to semantic-kernel/python/tests
  2. run ``pytest .`

Expected behavior
this test should not raise error

Screenshots
image

Desktop (please complete the following information):

  • OS: Mac M1
  • IDE: VS Code
  • Python version: 3.9.13

Additional context
Add any other context about the problem here.

Activity

  1. changed the title [-]in python-preview branch[/-] [+]delegate_inference raise error in python-preview branch[/+] on Mar 27, 2023
  2. jjhenkel commented on Mar 27, 2023

    @jjhenkel

    Hey thanks for this Joowon (@joowon-dm-snu)! Is this on the latest version of the code? I can't reproduce right now (just did a fresh clone and ran pytest w/ no issues).

    (semantic-kernel-py3.10) jordanhenkel@DESKTOP-PKUSNNI:~/linux-workspace/semantic-kernel/python/tests$ pytest .
    ======================================================== test session starts ========================================================
    platform linux -- Python 3.10.10, pytest-7.2.0, pluggy-1.0.0
    rootdir: /home/jordanhenkel/linux-workspace/semantic-kernel/python/tests
    collected 11 items
    
    test_sk_function_decorators.py ...                                                                                            [ 27%]
    test_text_skill.py ........                                                                                                   [100%]
    
    ======================================================== 11 passed in 0.15s =========================================================
    

    We did just make an update to some logic related to this (but that was a few days ago)

  3. joowon-dm-snu commented on Mar 27, 2023

    @joowon-dm-snu
    ContributorAuthor

    Jordan Henkel (@jjhenkel) i think error comes from python version. i'm using python 3.9 and yours is 3.10.

    here is reference (link)
    image

  4. jjhenkel commented on Mar 27, 2023

    @jjhenkel

    Ah yep, I think that's the issue. Let me just test your proposed changes and, if it works and helps us be a little bit more robust to various Python version, I'm happy to take them! Thank you for your time on this!

    (I think, some point soon, we'll have a discussion and pick a minimum Python version we're looking to support. But until then, robustness to older versions is great)

  5. joowon-dm-snu commented on Mar 27, 2023

    @joowon-dm-snu
    ContributorAuthor

    (I think, some point soon, we'll have a discussion and pick a minimum Python version we're looking to support. But until then, robustness to older versions is great)

    Agree with it!! i think set minimum version as 3.10+ and announce users will be fine :)

  6. alexchaomander commented on Mar 29, 2023

    @alexchaomander
    Contributor

    Merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pythonPull requests for the Python Semantic Kernel

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions