There is a lot that can be done with Python programming using the IDLE editor which the standard installation ships with, or a simple text editor such as Sublime Text or Notepad++. For some purposes a lightweight option such as these makes a lot of sense, and you can just get on and write some Python code with minimal setup.
However, there are many advantages which come with using a more powerful IDE (Integrated Development Environment) like PyCharm.
In this post I will share some of the features of PyCharm which I make the most use of and which make my life that bit easier….
What Makes PyCharm Awesome?
This article is about the community edition of PyCharm. It is free and all of the basic functionality you would expect from a professional IDE is present. For Python developers wanting advanced features such as web framework support, remote development and containers, integrated database functionality and more, there is also a paid version available.
PyCharm Awesome Feature #1 – Code Reformatting
It is very distracting to focus on strictly following a style guide like PEP8 for Python at the same time as writing effective code. Sure, we do our best as we go along, but constantly checking for spaces after commas, or the correct number of blank lines between sections of code etc. can be a real drain on mental energy.
One thing I love about PyCharm is the one-click solution to all my styling needs.
reformat code from the
code menu and the default auto-formatting options will be applied, which are perfect for most situations. You can customize them if you wish.
Before PyCharm Reformat Code
""" PyCharm Format Code Tool """ import collections class Node(object): def __init__(self, data): self.data=data self.left= None self.right = None
After Pycharm Reformat Code
""" PyCharm Format Code Tool """ import collections class Node(object): def __init__(self, data): self.data = data self.left = None self.right = None
PyCharm Awesome Feature #2 – Integrated Terminal
PyCharm has a handy integrated terminal where you can run all your usual commands.
PyCharm Awesome Feature #3 – Version Control System Integration
In the above example you can see that I use
git commands from the terminal. This is actually my preferred way to work, but it is worth noting that PyCharm has full VCS integration, including colour highlighting for the status of files within your project and full GUI access to VCS functionality.
PyCharm Awesome Feature #4 – Find and Replace
An incredibly useful feature of many IDEs is find and replace functionality. PyCharm provides a a smooth and easy way to access this feature, with many options for the results depending on your needs.
The Keyboard shortcut for this functionality is
PyCharm Awesome Feature #5 – Python Code Debugging
PyCharm comes with a fully integrated debugger. You can set breakpoints, step into and through code and even set watches on specific variables. The debugger is very easy to use and intuitive.
PyCharm Awesome Feature #6 – Emmet
Emmet is an incredibly hand tool for quickly creating HTML, CSS and some other file types. The way it works is you type just enough code to make it clear what is intended, and Emmet produces the full version. PyCharm handles this like a charm. Here is an example in images:
Downsides of Using PyCharm for Python Development
While using PyCharm is mostly a very positive experience for me, I should just point out a couple of potential downsides to give you a balanced view.
PyCharm is fairly resource-heavy, which means on some systems it can take a while to load, and is prone to occasional periods of non-responsiveness while it catches up with itself. One way you can improve the situation is to change the amount of memory allocated to it vie
help -> change memory settings.
There is also the issue that working with PyCharm means working with projects rather than just creating a simple script and running it from a command line for example. This means that there is some initial setup which is not great if you have a brilliant idea that you want to try out right away. So for small programs or quick code-sketches, it may not be worth the overhead to use an IDE as powerful as PyCharm.
There is more to discover, but the features described here will give you an excellent starting point for using PyCharm to super-charge your Python Development workflow.