Boto3 + Pyboto3 = Autocomplete = ❤︎

At Wavycloud we use Amazon Web Services (AWS) to run our service and we use boto3 to manage and automate our infrastructure as well as using it in our Lambda microservices.

One caveat to boto3 is the lack of autocomplete, which means you will have to open boto3 documentation every time you use it just to copy those long function and parameter names.

We decided to fix that by creating pyboto3. We used BeautifulSoup to parse the documentation of boto3 and generate python stub files that will give hint to your IDE.

Here is what will happen when u click ctrl+space after you install pyboto3 and annotate boto3 client.

autocomplete

😮 😮 😮 😮 😮 crazy cool right?

Here is how you can enable this feature.

pip install pyboto3
import boto3
s3 = boto3.client('s3')
""" :type : pyboto3.s3 """
# s3. will give you autocomplete for s3 methods

This is currently limited to boto3 clients and doesn’t work for resources like Paginators, Waiters, Table, etc.

This was currently tested on PyCharm and it worked like a charm. Let us know if it doesn’t work for your favorite IDE.

 

20 thoughts on “Boto3 + Pyboto3 = Autocomplete = ❤︎

  1. Sad I was not able to make this work in Visual Studio Code even try putting the path to this in the settings:
    “python.autoComplete.extraPaths”: [
    “/usr/local/lib/python2.7/site-packages/pyboto3”
    ]
    Anyone made it work in VS Code? I will try more but really do not know how tis really works to start with. 🙂

    Like

      1. First install pyboto3, then after you create the client, for example:
        S3 = boto3.client(‘s3’)
        “”” :type : pyboto3.s3 “””

        Without the type annotation, autocomplete will not work.

        Liked by 1 person

      2. I did miss that part and just tried it in both VSC and PYCharm and no luck ☹ Can it be due to versions of boto3?

        https://puu.sh/tE7XE/e0419b7802.png

        Mark

        From: WavyCloud Blog
        Reply-To: WavyCloud Blog
        Date: Saturday, January 28, 2017 at 11:44 AM
        To: “Hubers, Mark”
        Subject: [New comment] Boto3 + Pyboto3 = Autocomplete = ❤︎

        Gehad Shaat commented: “First install pyboto3, then after you create the client, for example: S3 = boto3.client(‘s3’) “”” :type : pyboto3.s3 “”” Without the type annotation, autocomplete will not work.”

        Like

      1. Added import pyboto3.s3 or import pyboto3 and no luck but it warns me saying module does not exist in PYCherm IDE.

        └> pip install pyboto3
        Requirement already satisfied: pyboto3 in /usr/local/lib/python2.7/site-packages

        Maybe this is due to python 2.7. We can forget this unless you like to keep debugging with me.

        From: WavyCloud Blog
        Reply-To: WavyCloud Blog
        Date: Saturday, January 28, 2017 at 12:45 PM
        To: “Hubers, Mark”
        Subject: [New comment] Boto3 + Pyboto3 = Autocomplete = ❤︎

        Gehad Shaat commented: “Did u install pyboto3? Try importing pyboto3 before boto3 import pyboto3.s3 Let me know the result”

        Like

      2. If you do “import pyboto3” and pycharm doesnt recognize it then autocomolete wont work.

        Try going to settings->python interpreter and check what python version is selected and install pyboto3 from there

        Like

  2. Do you know if this works with Pydev in eclipse? I did the following and it doesn’t work:
    import pyboto3
    import boto3
    s3 = boto3.client(‘s3’)
    “”” :type: pyboto3.s3 “””
    s3.

    Like

  3. Hey guys, great plugin for pyCharm. Any one knows how to make it work in Atom?

    I hava auto-complete python installed and correct path set.

    Cheers

    Like

  4. I didn’t understand: was it supposed to work on Visual Studio Code or not? I was not able to make it work, so I’m wondering if it’s my fault or if it doesn’t work at all on that IDE. Thanks!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s