Closed dd-ssc closed 1 year ago
Hello!
Sorry for the late response. Yes, this is a known issue, that pyright
complains about partially unknown types if not all overloads can be resolved.
Options:
boto3-stubs[all]
dev dependency# type: ignore
this line. client
will still correctly be types as EC2Client
I hope thi helps. Please let me know if you have any better solutions for this issue.
Describe the bug With
typeCheckingMode = 'strict'
,pyright
reportserror: Type of "client" is partially unknown
.To Reproduce Steps to reproduce the behavior:
boto3-stubs
with theec2
extra as dev dependency (as per thepip docs
, usingpoetry
):pyright
on the following code sampleActual output
Expected output
none
Additional context
Working on currently latest macOS Ventura 13.4 with
boto
/boto-stubs
1.26.155
. I am using different AWS services in different projects and I observe the same issue in all of them.I understand from the
boto3-stubs
docs (underinstall annotations for services you use
) that it should suffice to add the "extra" for the services I use. That doesn't seem to work for me.I tried installing
boto3-stubs[essential]
, but that doesn't seem to make any difference. Also,ec2
happens to be in the list of extras for the project the sample code above is from, but in another project, I usecodecommit
, which is not.I tried installing
boto3-stubs[boto3]
, but that doesn't seem to make any difference, either - in fact, this doesn't seem to install any extras at all (frompoetry add ...
output):Following this I tried installing
boto3-stubs[all]
- that does fix the issue, but requires installing countless modules - of which I only use one.I also tried using explicit type annotations:
but that doesn't seem to make a difference, either.
Finally, I tried installing the VS Code extension and set it up as documented, but the issue there is the same.
These observations seem consistent for different AWS services /
boto-stubs
extras in different project.Am I doing anything wrong ? Have I misunderstood anything ?