cai icon indicating copy to clipboard operation
cai copied to clipboard

coding convention

Open zhengComing opened this issue 9 months ago • 1 comments

cai/types.py provides the basic Agent, Reponse, etc. classes, but types also exists in the Python standard library, which may lead to the following circular import problem: Traceback (most recent call last): import traceback File "C:\Users\hi.conda\envs\cai_env\Lib\traceback.py", line 5, in import linecache File "C:\Users\hi.conda\envs\cai_env\Lib\linecache.py", line 8, in import functools File "C:\Users\hi.conda\envs\cai_env\Lib\functools.py", line 22, in from types import GenericAlias File "C:\development\cai\cai\types.py", line 6, in warnings.filterwarnings("ignore", message="Support for class-based config is deprecated") File "C:\Users\hi.conda\envs\cai_env\Lib\warnings.py", line 155, in filterwarnings import re File "C:\Users\hi.conda\envs\cai_env\Lib\re_init_.py", line 124, in import enum File "C:\Users\hi.conda\envs\cai_env\Lib\enum.py", line 3, in from types import MappingProxyType, DynamicClassAttribute ImportError: cannot import name 'MappingProxyType' from partially initialized module 'types' (most likely due to a circular import) (C:\development\cai\cai\types.py) Therefore, it is recommended to change types.py to a customized filename, such as self_types.py, etc.

zhengComing avatar May 09 '25 07:05 zhengComing

Thanks @zhengComing, do feel free to open a PR with your suggestion. We'll evaluate and review it.

vmayoral avatar May 09 '25 12:05 vmayoral

Closing this due to inactivity, we'll take your code suggestion into account for future releases. Thank you zheng.

aliasrobotics-support avatar Oct 28 '25 16:10 aliasrobotics-support