conductor-sdk / conductor-python

Conductor OSS SDK for Python programming language
Apache License 2.0
52 stars 26 forks source link

ImportError: cannot import name 'Self' from 'typing' in Conductor Python library #239

Closed AodhanDalton closed 5 months ago

AodhanDalton commented 5 months ago

Attempting to use the Conductor Python library (version 1.1.0), in python 3.9, results in an ImportError related to the 'Self' type hint in the 'typing' module.

Environment:

Possible Solutions:

  1. Remove Self from the typings import in src/conductor/clieny/http/models/workflow_task.py as it is not used.
  2. Alternatively, change all occurrences where Self is being imported from typing to from typing_extensions import Self.

Stack Trace

    from conductor.client.workflow.task.http_task import HttpTask, HttpInput
  File "/usr/local/lib/python3.9/site-packages/conductor/client/workflow/task/http_task.py", line 7, in <module>
    from conductor.client.workflow.task.task import TaskInterface
  File "/usr/local/lib/python3.9/site-packages/conductor/client/workflow/task/task.py", line 7, in <module>
    from conductor.client.http.models.workflow_task import WorkflowTask
  File "/usr/local/lib/python3.9/site-packages/conductor/client/http/models/__init__.py", line 34, in <module>
    from conductor.client.http.models.workflow_task import WorkflowTask
  File "/usr/local/lib/python3.9/site-packages/conductor/client/http/models/workflow_task.py", line 3, in <module>
    from typing import List, Union, Self
ImportError: cannot import name 'Self' from 'typing' (/usr/lib64/python3.9/typing.py)
andreapairon commented 5 months ago

Same issue, unfortunately.

Could even be: if sys.version_info >= (3, 11): from typing import Self else: from typing_extensions import Self

coderabhigupta commented 5 months ago

@AodhanDalton @andreapairon We're looking into this. Thanks for raising the issue.