Amazon Q and CodeWhisperer in PyCharm – A Visual Installation Guide with Examples

4.6/5 - (5 votes)

What Is Amazon CodeWhisperer?

Amazon CodeWhisperer is a machine learning-powered coding assistant that provides real-time code recommendations and suggestions.

As you write code, CodeWhisperer generates contextually relevant suggestions based on the existing code and comments, ranging from single lines to complete functions.

It can scan your code for security issues, enhancing the overall quality and safety of the code.

CodeWhisperer integrates with various Integrated Development Environments (IDEs) such as PyCharm, IntelliJ IDEA, and others:

The overall goal is to boost your application development and coding efficiency, particularly in an environment increasingly reliant on AI-assisted tools.

How to Install CodeWhisperer in PyCharm (IntelliJ)?

Open your PyCharm IDE:

Choose File > Settings to open the settings widget:

Choose the Plugins tab in the Settings widget:

Type aws in the Plugins search box and click Install:

Verify the installation info text Installed and click the OK button to close the Settings widget:

You may need to restart PyCharm:

Click AWS Builder ID > Connect button:

It may ask you for authorization:

The website that opens up looks like this:

Confirm and continue and enter your email address at this page (this is free):

After following the steps and verifying your email address, you’ll get the confirmation:

After entering a password in the previously shown form, Allow JetBrains to access your data:

You can now go back to your PyCharm project and verify that the installation setup went through correctly:

Examples of Amazon CodeWhisperer

You can now use Amazon CodeWhisperer and Amazon Q to chat your code. CodeWhisperer runs automatically, you can click “Chat with Q” to open a chatbox and ask it questions to your code:

For example, I can select some code and ask Amazon Q to explain it:

Another example is to send some code to Amazon Q and ask it to write it for you:

Here’s how it looks in the Amazon Q window:

Let’s try CodeWhisperer. If it runs, it’ll automatically complete your code as soon as it discovers what you want.

Here’s the classic Fibonacci function example – after typing def fibonacci(n) it automagically writes the function for me:

And here’s an example where I only give the specification of a function download_video_from_url(URL) and CodeWhisperer generates all the code for me:

Amazing! 🀩