You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that prompty can be installed successfully on Python 3.9 but cannot be imported due to the following error:
Python 3.9.18 (main, Sep 11 2023, 13:41:44)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import prompty
Traceback (most recent call last):
File "/home/zhizhu/miniconda3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 303, in _eval_type_backport
return _eval_type(value, globalns, localns, type_params)
File "/home/zhizhu/miniconda3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 332, in _eval_type
return typing._eval_type( # type: ignore
File "/home/zhizhu/miniconda3/envs/py39/lib/python3.9/typing.py", line 292, in _eval_type
return t._evaluate(globalns, localns, recursive_guard)
File "/home/zhizhu/miniconda3/envs/py39/lib/python3.9/typing.py", line 554, in _evaluate
eval(self.__forward_code__, globalns, localns),
File "<string>", line 1, in <module>
TypeError: unsupported operand type(s) for |: 'type' and 'type'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/zhizhu/miniconda3/envs/py39/lib/python3.9/site-packages/prompty/__init__.py", line 7, in <module>
from prompty.core import (
File "/home/zhizhu/miniconda3/envs/py39/lib/python3.9/site-packages/prompty/core.py", line 20, in <module>
class PropertySettings(BaseModel):
File "/home/zhizhu/miniconda3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 219, in __new__
set_model_fields(cls, bases, config_wrapper, types_namespace)
File "/home/zhizhu/miniconda3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 512, in set_model_fields
fields, class_vars = collect_model_fields(cls, bases, config_wrapper, types_namespace, typevars_map=typevars_map)
File "/home/zhizhu/miniconda3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_fields.py", line 105, in collect_model_fields
type_hints = get_cls_type_hints_lenient(cls, types_namespace)
File "/home/zhizhu/miniconda3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 245, in get_cls_type_hints_lenient
hints[name] = eval_type_lenient(value, globalns, localns)
File "/home/zhizhu/miniconda3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 257, in eval_type_lenient
return eval_type_backport(value, globalns, localns)
File "/home/zhizhu/miniconda3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 279, in eval_type_backport
return _eval_type_backport(value, globalns, localns, type_params)
File "/home/zhizhu/miniconda3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 311, in _eval_type_backport
raise TypeError(
TypeError: Unable to evaluate type annotation 'str | int | float | List | dict | bool'. If you are making use of the new typing syntax (unions using `|` since Python 3.10 or builtins subscripting since Python 3.9), you should either replace the use of new syntax with the existing `typing` constructs or install the `eval_type_backport` package.
>>>
It seems that the code is using a new type annotation style that older Python versions do not support.
Do we have plan adding compatible support for legacy Python versions like Python 3.8 or 3.9?
The text was updated successfully, but these errors were encountered:
I found that prompty can be installed successfully on Python 3.9 but cannot be imported due to the following error:
It seems that the code is using a new type annotation style that older Python versions do not support.
Do we have plan adding compatible support for legacy Python versions like Python 3.8 or 3.9?
The text was updated successfully, but these errors were encountered: