Sub-resources do not inherit correct `.meta.client` type
alexmv opened this issue · 3 comments
alexmv commented
Describe the bug
While s3_resource.meta.client
is a S3Client
, s3_resource.bucket("...").meta.client
is only a bare BaseClient.
To Reproduce
Steps to reproduce the behavior:
- Install
boto3-stubs[...]
- Run
mypy
/pyright
on the following code sample
import boto3
s3_resource = boto3.resource("s3")
bucket = s3_resource.Bucket("example")
reveal_type(s3_resource.meta.client)
reveal_type(bucket.meta.client)
Actual output
test.py:6: note: Revealed type is "mypy_boto3_s3.client.S3Client"
test.py:7: note: Revealed type is "botocore.client.BaseClient"
Expected output
test.py:6: note: Revealed type is "mypy_boto3_s3.client.S3Client"
test.py:7: note: Revealed type is "mypy_boto3_s3.client.S3Client"
Additional context
On Linux, boto3-stubs version 1.34.13, boto3 version 1.33.10.
See #101 for related previous issue.
vemel commented
Hello. Thanks for the report. Yes, it makes sense to use service-specific meta for all resources. I will try to release an update soon.
vemel commented
I just released mypy-boto3-s3 1.34.14
with the fixes included. I did not update other service packages, so let me know if you depend on any.
Please update and let me know if it works as expected.
alexmv commented
It works great -- thanks for the quick fix!