PyCharm vs VSCode
PyCharm vs Spyder. PyCharm and Spyder are both cross-platform IDEs (Integrated Development. On the other hand, PyCharm is a full-featured IDE developed by JetBrains specifically for Python development. It’s written in Java and Python, and provides many features for Python development out-of-the-box. There’s a catch: only the community edition is.
PyCharm Community edition and Visual Studio Code (VSCode) are both very capable integrated development environments for Python coding. While VSCode has some great support for Python coding with the 'Python' plugin by Microsoft, PyCharm is truly designed for Python development and it shows.
- Hi, Today, I am trying to install 'scipy' on my Pycharm. It failed due to Microsoft Visual C 14.0. I found two similar post on MS Community.
- If you are programming in Python, PyCharm is much better. We could only expect that to be the case when the IDE is designed to target Python specifically. When you visit the JetBrains: Developer Tools for Professionals and Teams website, you will.
In this post I take PyCharm up against Visual Studio Code using the following 7 IDE criteria:
- Git Integration
- Python Code Management
- Code Completion
- Debugging
- Performance
- Refactoring
- Cross Platform Compatibility
Not sure what PyCharm is? Check out this post.
The Approach
My approach to conduct this evaluation was to pick the IDE feature that I use most often and compare the experience between PyCharm and VSCode. My Python project is very simple so it would be worth building an in depth project with each of these IDEs.
For this comparison I am using PyCharm Community installed on Ubuntu in a virtual machine and VSCode 1.47.2 on the same virtual machine with the Microsoft Python plugin. Both PyCharm Community and VSCode are free, so financials don't enter into the comparison.
Git Integration
My big measurement criteria for Git integration was to see how much could be done within the tool itself without the need to resort to command line. I expect that common actions like creating branches, committing code and managing code on remotes can be done within the IDE.
VSCode
VSCode detects if a git repo has been setup for a project and allows you to initialize one. Creating my local repo was simple, however connecting to GitHub was much more difficult. It doesn’t look like there is a way to create a GitHub repo from VSCode so I had to create it through the GitHub Web UI. Once I was OAuth connected I could only view repos. I had to log into GitHub to create the repo, then it appeared in my list. Also, the local git remote that VSCode creates is named after the repo and not called ‘origin’ which I find a bit off-putting.
You can create branches using “Checkout to…”. Publish a branch to the remote (GitHub in my case). A pull request has to be started from the GitHub web ui. Pushing and pulling code changes is all possible from within VSCode.
These is the Git integration quick actions that VSCode displays for a new project.
For me, VSCode gets a 3/5 on Git integration. It has the basics, and while I don't need to go to command line for simple tasks, I do have to go to the GitHub Web UI, which is even less convenient.
PyCharm
PyCharm's Git integration is excellent. I was easily able to create a local Git repository on my project folder and in GitHub - without using the GitHub UI. PyCharm also supports creating and viewing pull requests from within the IDE. There is no need to use the command line or the GitHub Web UI for day to day tasks.
PyCharm also supports GitHub 2 factor authentication.
While I was able to create a GitHub Pull Request in PyCharm, I wasn't able to complete and merge it? Still, I am very impressed with PyCharm's Git Integration.
PyCharm gets a 5/5 on Git integration.
Code Management
Code management is an IDEs basic reason for existence. Making it easy for a developer to navigate a code base. Both VSCode and PyCharm have built in file hierarchy displays on the left of the code window (with the default setup) and allow you to create, rename and remove files easily. You can select function names and quickly navigate to their definitions with both of these tools. The real differentiation is in the IDE search functionality and smart code features.
For code management there were 2 areas I focused on:
- Dependency Management
- Search
For each project I added a file with a function definition, then called that function from my main file. I created a greet.py module with a function called greet:
VSCode
VSCode was unaware of the new function and I had to manually add the import statement.
I also really like Find in Files. Especially with a code base that I have inherited, being able to find files anywhere in a project containing a keyword within a project is essential. VSCode does this really well. The search results are displayed on the left, and I can click through and view them in the editor pane.
A strong search, but weak code dependency management and VSCode gets a 4/5 on code management.
PyCharm
When I added the greet module and function in PyCharm it was able to detect the missing import statement and recommended adding it. This is a great help to a developer.
The find in files search that I use so often is a bit awkward in PyCharm. It is even difficult to find it.
PyCharm displays this modal with search results which site over top of the code window. It is also difficult to see the files that it has found. I do like that I can select a path and search down into it. Because of the awkward search I give PyCharm a 4/5 on code management.
Code Completion and Highlighting
Highlighting is very personal, and fast and non-intrusive code completion is very helpful. I like the dark theme, VSCode and PyCharm both support multiple light and dark themes and since this is very subjective I am leaving out of the rating.
VSCode
VSCode supports code completion and it is quite capable.
Although VSCode didn't add the import statement for my new module automatically, once the import statement was added, VSCode is able to offer autocomplete for this function.
I can type 'g' and select the greet function from a list of valid selections starting with 'g', which then shows me the function comment and signature. The code completion experience is responsive and intuitive. I would say this is an average code completion experience and so I rate it at 3/5.
PyCharm
Similar to the other capabilities I've looked at so far, code completion is just better in PyCharm. PyCharm shows the function signature as part of the autocomplete selection list, but with some extra cool features. See those 3 dots at the end?
The three dots display the following menu:
- Sort by Name
- Quick Documentation
- Quick Definition
Quick Documentation shows the function signature and return types as well as the function comment. Quick Definition shows the function code. Very handy. This is a step above VS Code and the quick actions exceeded my expectations. PyCharm's code completion gets a 5/5.
Debugging
VSCode
VSCode allows you to execute your code in debug mode and step through it. The left pane displays local and global variables, watched values, the call stack and a list of all breakpoints. Hover over a variable to see it's current value in context. All of the standard execution controls are also available, step over, step into, step out. VSCode also allows you to create conditional breakpoints which are handy it you are looking for a specific data condition that causes problems.
VSCode provides a solid debugger for Python. It gets a 4/5.
PyCharm
PyCharm has the same features as VSCode, the debug properties are displayed in the bottom pane and the call stack is called 'frames'. You can view variables, and watch values, step into, over and out of functions.
On top of conditional breakpoints, PyCharm has some other interesting breakpoint logic, like:
- Breakpoint Hit messages that allow you to log information at breakpoints without adding print messages to your code
- Remove once hit, allowing you to remove a breakpoint once it has been hit. This works well when combined with conditional breakpoint logic.
Once again PyCharm exceeds my expectations and gets a well deserved 5/5.
Performance
For this test, I am running PyCharm and VSCode inside of an Ubuntu VM hosted in VirtualBox. I have 2 CPU core allocated and 4 GB of memory for the virtual machine.
VSCode
Start Up time is good for VSCode, once the VM was primed VSCode would load in about 4 seconds. My test project is only a couple of files, so I don't have a good sense of how it handles large projects. VSCode runs a number of processes and consumes a lot of memory, almost 1 GB. I attribute this to the electron framwork.
PyCharm
PyCharm is much slower to load than VSCode, clocking in over 10 seconds. Memory usage is lower however, in the 500MB range.
Once loaded, both IDEs were quite responsive with very little stuttering when looking up autocomplete suggestions.
Performance Summary
Measure | VS Code | PyCharm |
---|---|---|
Start Up Time | 4 sec (avg) | 15 sec |
Memory Use | 895MB | 550MB (Java) |
My Rating | 3/5 | 3/5 |
In each of their own ways these two IDEs are quite fat. So I've given them both a 3/5 on performance.
Refactoring
VSCode
In order to use refactorings, I had to setup 'rope' which VSCode nicely pip installed for me. The following refactorings are supported in VSCode:
- Rename
- Extract Method
- Extract Variable
This is a pretty limited list of refactoring capabilities. A 1/5 goes to VSCode for refactoring.
PyCharm
So I expected PyCharm to do well in the refactoring category since JetBrains built their company on the ReSharper refactoring plug-in for Visual Studio and PyCharm doesn't disappoint. Refactorings include:
- Rename
- Change Signature
- Move File
- Copy File
- Introduce Variable
- Introduce Constant
- Introduce Field
- Introduce Parameter
- Extract Method
- Extract Superclass
- Pull Members Up
- Push Members Down
Impressive refactoring to PyCharm for a 5/5 in this category.
Cross Platform Compatibility
VSCode
VSCode is incredibly portable thanks to the fact that it is open source. I have VSCode running on my Raspberry Pi 4 running Manjaro, and my Raspberry Pi and Jetson Nano running Ubuntu.
VSCode runs on AMD and ARM architectures in 32 or 64 bits. It is highly portable, a clear 5/5 here.
PyCharm
PyCharm runs on java which gives it some cross platform capability too. Unfortunately the JetBrains toolbox does not run on Java and is compiled for AMD architecture only.
However, you can download the PyCharm install files and extract and run PyCharm on a Raspberry Pi or Jetson Nano and it seems to work just fine. You'll need to install the Java JDE first and you should be good to go.
PyCharm gets a 4/5 on cross platform because of toolbox - collateral damage.
Tabulated Results
Here are all the ratings for the eight categories.
Criteria | VS Code | PyCharm |
---|---|---|
Git Integration | 3/5 | 5/5 |
Code Management | 4/5 | 4/5 |
Code Completion | 3/5 | 5/5 |
Debugging | 4/5 | 5/5 |
Performance | 3/5 | 5/5 |
Refactoring | 1/5 | 5/5 |
Cross Platform | 5/5 | 4/5 |
Total | 23/35 | 33/35 |
Summary
For Python development, PyCharm is the clear winner. But don't uninstall VSCode, it's a great swiss army knife with great support for many languages.
Additional Resources
Get started with Pycharm by following my introduction to Pycharm.
If you are an avid user of VSCode, I recommend this book on VSCode for developers
Photo by Hermes Rivera on Unsplash
Python is one of the most popular programming languages in the world in 2020 and many developers call it home. As such, it has a broad selection of tools, code editing apps and IDEs to match the needs of different Python developers and project types.
The list of code editing tools is long, but the top two contestants for the crown, JetBrains’ PyCharm and Microsoft’s Visual Studio code, are by far the most popular homes for Python developers. Where should you be living in 2020 – VS Code or PyCharm?
For an experienced Python developer (or any language for that matter), swapping IDEs is akin to moving to a new home in a different country. Even if you speak the local language, there are differences in things like currency, as well as local customs, and laws you will need to learn. Not to mention your new house, where you may even find yourself sleepily looking for the toilet (for God knows what time) in the middle of the night. At least for the first few weeks.
Pycharm Visual Studio Theme
Is it worth it? Perhaps you will discover that migrating to a different state makes your life objectively better. Once you remember where the bathroom is, of course. Alternatively, you may find yourself hurrying back to your place of birth, kissing the proverbial ground as soon as you land.
Few dare to take the leap, pack their code and move to a new IDE or code editing software. For many, there’s no place like home even if the alternative promises to save them time and headaches. But loyalties aside, it’s always a good idea to take a peek over the borders.
How to choose a Python IDE / Code Editor
It’s worth noting that this article is not a “conversion piece” for neither PyCharm nor VSCode. We’re not recommending you choose one over the other (especially since you can make use of Codota and TabNine in both), but rather than you choose correctly for your needs.
Whether you currently use Visual Studio Code or Jetbrains’ PyCharm for Python development, this article aims to give you a better understanding of the difference, and uncover how each may contribute to your productivity.
Before we dive into the advantages and disadvantages of PyCharm and VSCode for Python development, it’s worth taking a moment to organize your criteria for selection. Among the topics to consider are license costs (if you have no budget) and system requirements (if your lack of budget is evident in your hardware setup).
IDE vs Code Editor
We’ve used the terms IDE and code editor in this article rather interchangeably. However, they’re not the same.
Jetbrains’ PyCharm is a full-featured Integrated Development Environment (IDE) for Python development. As such, it includes everything you need in order to code, build, test, and debug Python applications.
In addition to a code editor, an IDE such as PyCharm typically includes a compiler and/or interpreter, a debugger and code profiler, version control integration, and plugin support. All available on-install out of the box.
This does mean, however, that PyCharm is a heavy beast with high system demands along with advanced capabilities aimed specifically at professional Python developers.
VS code is a lightweight code editor with basic features like syntax highlighting and code formatting included out of the box. VSCode can be customized heavily with extensions to do pretty much anything and everything with most commonly used programming languages and frameworks.
This makes VSCode perfect for code polyglots who develop in multiple languages. But it also means you will spend more time customizing it to your Python coding needs with extensions that will (hopefully) not clash with one another.
Intellij PyCharm for Python Development
PyCharm is one of the highest rated Python IDEs today, and it has earned its spot at the top with its suite of productivity tools and out-of-the-box features. But not all PyCharms are the same, and different licenses offer different degrees of functionality.
There are currently three types of licenses for PyCharm. The first is the Apache-licensed Pycharm community edition, aimed mostly at data scientists. It is open sourced and free, and offers features like syntax highlighting and some autocompletion. The second is the Education edition, offered for free to students and teachers.
It too offers a limited feature-set and is intended for learning and not so much development of software products. The third type of license, and the version we refer to in this article is the Professional edition of PyCharm, that carries a hefty price tag starting between $ 199 and $ 159 for an annual subscription for businesses.
The full and paid version of PyCharm offers advanced features and capabilities geared toward streamlining all aspects of professional Python software development. This includes full built-in database management (like Oracle and MySQL) and support for multiple popular frameworks (like Django, Flask and others) that are not supported in the free versions.
What it doesn’t include is extensibility to other languages and frameworks. So if you need to visit the land of COBOL (for some reason) or venture into the woods of .NET – you will need to upgrade to Intellij IDEA or install an additional IDE for that language.
Pros
- All-in-one IDE out-of-the-box – write, edit, debug, compile, execute and deploy from the same window
- Created specifically for Python developers
- Django support (including code completion and resolution in views.py and urls.py files, code inspection tools for Django ORM, and the ability to debug Django templates)
- Professional support by JetBrains
Cons
- Price of professional edition (and lack of features in free editions)
- Requires some configuration for first-time users and novices
- Supports a limited number of languages and technologies in addition to Python
- System requirements and performance – consumes up to 1GB of memory a minute while idle
Microsoft Visual Studio Code for Python Development
Visual Studio Code is a lightweight solution that can be expanded, extended and modified through plugins and extensions. A kind of Lego board upon which you can construct the development environment you want and need.
Pycharm Visual Studio Error
Being a modular solution, VSCode demands that you download and install extensions to compile, debug, lint and deploy code. It may sound like a bit of a hassle, but you can do that for pretty much any popular language or framework out-there. Need to code in Python? It just so happens that the Python support extension is the most downloaded plugin in the Visual Studio Code Marketplace. Need to write some C++ and don’t want to install yet another code editor? Then you should download the second most popular extension for VSCode – C/C++ support.
The VSCode community and Microsoft themselves are not blind to the rising popularity of VSCode with Python developers. In the recently published update to the Python extension for VSCode, Microsoft addressed 42 issues, and added the ability to browse for or enter an interpreter path on selection.
Pros
- Growing community support
- Free and open source
- Lightweight and low on system resource demands
- Support for most popular languages and frameworks through extensions
- Powerful and customizable code management
- Thousands of extensions to choose from
Cons
- Less suitable for large and complex Python projects and applications
- Demands a great deal of customization and tweaking
- Lacking Django support
- Thousands of extensions to choose from
The choice between PyCharm and Visual Studio is similar to a choice between a fancy cake knife and a Swiss army knife to cut a cake. The first may produce artfully cut and even slices, while the second may not be perfect for cutting a cake, but can do a lot more. And fits nicely in your pocket.