youtype / mypy_boto3_builder

Type annotations builder for boto3 compatible with VSCode, PyCharm, Emacs, Sublime Text, pyright and mypy.
https://youtype.github.io/mypy_boto3_builder/
MIT License
544 stars 36 forks source link

"TypeError: duplicate base class object" for types-aiobotocore-dynamodb version 2.5.2.post1 #207

Closed filipsnastins closed 1 year ago

filipsnastins commented 1 year ago

Describe the bug types_aiobotocore_dynamodb.DynamoDBClient import fails for package types-aiobotocore-dynamodb on version 2.5.2.post1

Downgrade to version 2.5.2 helped

To Reproduce Steps to reproduce the behavior:

Python 3.11.2 (main, Mar 13 2023, 08:10:08) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> from types_aiobotocore_dynamodb import DynamoDBClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/filipsnastins/code-sandbox/types-aiobotocore-dynamodb-bug/.venv/lib/python3.11/site-packages/types_aiobotocore_dynamodb/__init__.py", line 46, in <module>
    from .service_resource import DynamoDBServiceResource
  File "/Users/filipsnastins/code-sandbox/types-aiobotocore-dynamodb-bug/.venv/lib/python3.11/site-packages/types_aiobotocore_dynamodb/service_resource.py", line 169, in <module>
    class Table(AIOBoto3ServiceResource, CustomTableResource):
TypeError: duplicate base class object
>>> 

Actual output

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/filipsnastins/code-sandbox/types-aiobotocore-dynamodb-bug/.venv/lib/python3.11/site-packages/types_aiobotocore_dynamodb/__init__.py", line 46, in <module>
    from .service_resource import DynamoDBServiceResource
  File "/Users/filipsnastins/code-sandbox/types-aiobotocore-dynamodb-bug/.venv/lib/python3.11/site-packages/types_aiobotocore_dynamodb/service_resource.py", line 169, in <module>
    class Table(AIOBoto3ServiceResource, CustomTableResource):

Expected output

No error, the package is imported

Additional context OS

ProductName:        macOS
ProductVersion:     13.4.1
BuildVersion:       22F82

pip freeze:

aiobotocore==2.5.2
aiohttp==3.8.4
aioitertools==0.11.0
aiosignal==1.3.1
async-timeout==4.0.2
attrs==23.1.0
botocore==1.29.161
charset-normalizer==3.2.0
frozenlist==1.4.0
idna==3.4
jmespath==1.0.1
multidict==6.0.4
python-dateutil==2.8.2
six==1.16.0
types-aiobotocore-dynamodb==2.5.2.post1
urllib3==1.26.16
wrapt==1.15.0
yarl==1.9.2
vemel commented 1 year ago

Thank you for the report!

Hmm, I see why this can happen. You do not have aioboto3 installed, so both classes are object.

I will try to find a fix ASAP.

vemel commented 1 year ago

@filipsnastins just released a fix for this issue. Please test when you have time and let me know if it works as it should.

Updated packages:

filipsnastins commented 1 year ago

@vemel tested on types-aiobotocore-dynamodb 2.5.2.post2, it's working! Thank you!

Python 3.11.2 (main, Mar 13 2023, 08:10:08) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from types_aiobotocore_dynamodb import DynamoDBClient
>>> DynamoDBClient
<class 'types_aiobotocore_dynamodb.client.DynamoDBClient'>
>>> 

pip freeze

aiobotocore==2.5.0
aiohttp==3.8.4
aioitertools==0.11.0
aiosignal==1.3.1
async-timeout==4.0.2
attrs==23.1.0
boto3==1.26.76
botocore==1.29.76
charset-normalizer==3.2.0
frozenlist==1.4.0
idna==3.4
jmespath==1.0.1
multidict==6.0.4
python-dateutil==2.8.2
s3transfer==0.6.1
six==1.16.0
types-aiobotocore-dynamodb==2.5.2.post2
urllib3==1.26.16
wrapt==1.15.0
yarl==1.9.2