PyCharm intellisense for boto3

Alex C picture Alex C · Jul 22, 2015 · Viewed 9.9k times · Source

having problems seeing full intellisense (code completion) options in PyCharm. working with python 3.4 on Windows. the suggests are partially working:

import boto3
s = boto3.Session()  (boto3. will bring up list of methods/params of object boto3)
ec2 = s.resource('ec2') (resource is a suggested method!)
ec2. <<<< this brings up nothing. For some reason PyCharm cant detect that ec2 object would have 

while I can work off documentation alone, intellisense is just such a nice feature to have!

ive had similar problems getting it to complete lxml syntax but I thought that was because I had to install lxml directly as a binary (too many hoops to jump through on windows to install it via pip)

Anyone else encounter similar problems?

While we are here, I see a lot of different libraries around using awscli with python: boto, boto3, troposphere etc. What are some advantages of using one over the other. Amazon states that boto3 is the prefered method over boto but for my usage of starting/stopping ec2 instances could be easily done with older boto.

Answer

gehad picture gehad · Jul 29, 2016

I was frustrated with the same issue. So I decided to parse boto3 documentation and generate wrapper classes from the documentation. Here is the link to project https://github.com/gehadshaat/pyboto3

To install it

pip install pyboto3

To use it

import boto3
s3 = boto3.client('s3')
""" :type : pyboto3.s3 """
# s3. -> will give you autocomplete for s3 methods in pycharm

Make sure that you first:

  1. Install pyboto3 -> pip install pyboto3 | pip3.x install pyboto3
  2. Check your interpreter settings and verify that you see pyboto3 on the list
  3. Do a File -> Invalidate Caches/Restart

After Pycharm restarts you should see intellisense working in your favor and all of the available methods for the service (in the case above s3) you are trying to use available to you!