Eloff
Eloff

Reputation: 21688

mypy not picking up installed stubs

I've installed boto3, boto3-stubs, and mypy:

Pipfile:

"boto3" = "*"
boto3-stubs = {extras = ["ec2", "s3"], version = "*"}
mypy = "*"

But running mypy . gives the error:

error: Skipping analyzing 'boto3': found module but no type hints or library stubs

Do I need to configure something for mypy to find the stubs?

I'm using python 3.8.6, mypy 0.790, boto3 1.16.59, boto3-stubs 1.16.59 all installed in a virtual env.

Upvotes: 8

Views: 6657

Answers (2)

anmar
anmar

Reputation: 21

I used venv and I got it to work using the following steps:

python3 -m venv venv
source venv/bin/activate
python3 -m pip install mypy 'boto3-stubs[ec2,s3]'
venv/bin/mypy .

mypy boto3 stubs

If you're using VSCode then select the right interpreter using: Python: Select interpreter I use venv so I pointed to ./venv/bin/python

Upvotes: 2

anmar
anmar

Reputation: 71

Install boto3 stubs:

python3 -m pip install boto3-stubs

Upvotes: 7

Related Questions