PyCharm is a great IDE which I use on a daily basis when creating projects using AWS CDK. Recently, while working on a project, I encountered an interesting problem in PyCharm, which resulted in not displaying code hints for some libraries included in the AWS CDK for Python (aws_cdk.aws_ec2 in my case).
Table of Contents
What is JetBrains PyCharm?
PyCharm is an IDE (eng. Integrated Development Environment) used for development of Python projects. It fully supports AWS CDK library used for building cloud projects in IaC (eng. Infrastructure as Code) manner. This IDE provides us with many built-in developer facilities such as code quality checks, easier debugging, code tooltips, and much more.
Starting AWS CDK project in JetBrains PyCharm
What’s wrong with default PyCharm settings and AWS CDK? Basically nothing 🙂 After installing of PyCharm, you are mostly ready to go. You can think of installing plugins such as AWS Toolkit (link). In addition to facilitating the creation of solutions for AWS cloud, this plugin also includes support for the Amazon CodeWhisperer service which includes features such as AI (eng. artificial intelligence) code generator (details how to use Amazon CodeWhisperer can be found here).
How to solve problems with highlights not showing for some AWS CDK Python libraries?
Basically, if you’ll encounter that your PyCharm’s IDE is not showing highlights for some aws_cdk libraries, it probably means that PyCharm can’t load them due to the default file size limit of a package to which PyCharm will provide highlights (by default it’s 2500 kilobytes). Because of that packages such as aws_cdk.aws_ec2 which sizes is more than 5 megabytes can’t load and we can’t see any hints. To change this you need to go to Help -> Edit custom properties menu item.
In opened file add below line (e.g. 6000 kilobytes):
Press the CMD/CTRL+S and restart PyCharm. Now hints for all “larger” packages should also work.
Thank you for reaching out to that place. If you want to know more about AWS and the cloud, check the below posts: