Choosing a Python IDE or Code Editor
In a previous article, we discussed how to install Python on your machine, and run your first Python programme from the Shell prompt. In a professional setting, whether working for a company or as a freelancer, Python developers rarely write code in this manner, for lots of reasons, but mainly because you cannot write more than one line of code at a time before running it, which is obviously impractical, and a productivity killer. Instead professional developers use tools called Integrated Development Environments (IDE) or code editors to build applications with multiple lines of code and files.
In this article, we’ll discuss how to choose an IDE or a code editor. We’ll start by exploring the differences between both, before moving on to look at the things you should consider when selecting either one. By the end of this article, you’ll hopefully have a good understanding of what IDEs and code editors are, the differences between them, and which one is right for you.
Let’s get started.
What’s the difference between an Integrated Development Environment (IDE) and a Code Editor?
At first glance you may not think that there are any differences between an IDE and a code editor. They look similar, with similar features. You can write code in them. And they both have the same goal, which is to help you write clean code as efficiently, and productively as possible. But there are significant differences lurking just below the surface that you should be aware of.
Let’s take a high-level look at an Integrated Development Environment (IDE). It’s a piece of software that helps developers write, and build applications in an efficient manner. They achieve this by ensuring that code can be easily written, modified, and debugged. Some common features of a Python IDE include autocomplete, match bracketing, highlighting potential syntax errors, and suggesting best practices according to PEP-8. There are of course lots more features but these are some of the most common. IDEs are available as both free to download or paid. When you pay for an IDE you will get several more features such as customer support, software updates, thrid party integration, and code suggestions. Due to the amount of features within an IDE the file size is pretty large which means they can take up a large chunk of your computer memory. Also, due to their size some IDEs can run quite heavy on your machine.
On the surface code editors may seem the same as an IDEs, but usually they do not contain the same amount of features. While they obviously allow you to write code, they may not have debug or autocomplete features. Code editors focus on allowing you to write code quickly with less setup. Common features among code editors include automatic indentation of your code, and syntax highlighting.
So which should you choose? An IDE or a code editor? Many developers who are new to programming begin with a simple to use, and easy to setup code editor. The reason for this is to help avoid overwhelm. The last thing you need when learning a new programming language is to try and figure out how to use a feature rich IDE. New developers want to write code, press run and see their code execute! If you are in a professional environment the decision may have already been made for you.
As computing power and software applications have advanced code editors have become even more powerful and now rival many once dominant IDEs. Let’s look at some factors to consider when choosing either tool, which for ease of writing I’ll now refer to as a development tool.
How to choose the right development tool
There are countless development tools out there, each one with their own unique tool set, features, additional packages, and add-ons. Before you select your next development tool for an upcoming project here are some points to consider:
- Cost: Many delopment tools are free to download but often, they have paid plugins. For instance, the Python IDLE and Arduino IDLE come free when you install Python, but if later on you want to use specialized packages, then you may need to pay.
- Key features: When choosing a development tool make sure that it does all of the basics for you, and does them well. Things like autocompletion, syntax highlighting, bracket matching, automatic indentation, etc. will go a long way to reducing your Python learning curve, and boosting your programming efficiency.
- Speed: Code may run, and perform faster in one development tool than it does in another. If you plan on working on a big project with lots of lines of code then make sure that your development tool of choice can perform under stress.
- Debugging: As a Python developer, debugging is an important skill to have. While some developers can check how their code works by adding well positioned print statements, debugging is the standard way of testing your code. Various development tool have their own unique debugging features.
- Ease of use: When choosing a development tool, you want to make sure it is not overly complicated. Too many features can be intimidating which in turn can be counterproductive. So while it's great to have a development tool with lots of bells and whistles, your goal should be to choose one that best suits your development task at hand.
- Error handling: One of the most frustrating things for new software developers is getting an error in their code and not understanding what it means or where it’s coming from. Many development tools have the ability to generate detailed error reports. This means that when your code generates an error, and it will, it shows you the exact line of the problem and a helpful error message. This feature can go a long way to helping you fix errors in your code and reducing your frustartion.
- Ease of integration: Many development tools have easy integration with other popular software development tools such as git and GitHub. This can save you the stress of working separately to clone and push your code to your GitHub repository.
Some of the best development tools around
Visual Studio Code
Visual Studio Code or VS Code for short is a popular open-source development tool created by Microsoft. VS Code has boomed in popularity because of its amazing feature set, and expansive programming language support. You can run code in virtually any programming language on VS Code, whether you’re writing Java, Python, C, or Javascript. VS Code also has its own debugging tools.
Also, VS Code has great integration with Git and GitHub. One small downside of VS Code is that it can seem overly complicated for a programming newbie. The many features it has can be overwhelming. Apart from that, it’s a great code editor, with fantastic support from Microsoft and comes very close to being a fully fledged Integrated Development Environment.
Key Features
- Great control from the Shell
- Easy Git integration
- Supports different programming languages
- Great debugging and testing tool
PyCharm
PyCharm is another amazing and popular development tool for Python projects. Unlike VS Code however, it is designed only for Python. PyCharm has great features such as autocomplete, match bracket, error catching, syntx highlighting and lots more. It also helps you automatically create and activate a virtual environment when you start a new project. While PyCharm can do the things VS Code does, its interface looks slightly more welcoming than that of VS Code. In PyCharm it is easy to run your code, work in the terminal, and debug your code. The PyCharm autocomplete feature is absolutely topnotch. This can improve your productivity as you don’t have to type the full name of your variables before PyCharm gives you an accurate suggestion.
Key Features
- Super smart code editor
- Easy integration to third party apps
- Has a debugging and testing tool
- Great refactoring tool that allows you to replace variable names at a go
- Allows you to access your database from the editor
Note: PyCharm comes in two editions. The community edition and the professional edition. The community edition is free, and the professional edition is paid.
Sublime Text
Sublime Text is a fantastic development tool that supports several programming languages. One of the most popular features of Sublime is its simple interface. Sublime Text has features such as syntax highlighting, file type recognition, integrations with third party plugins, and error catching.
Key Features
- Great color palettes for variables, keywords and classes
- Fast navigation panels
- Cross platform support
- Supports multiple programming languages
Jupyter Notebook
Jupyter Notebook is a development tool that you can install from the command line or have it preinstalled with the Anaconda data science platform. If you plan on performing data science tasks or using machine learning then Jupyter Notebook is the tool of choice. This is because the code editor is split into cells, where you can run a small chunk of code and see the results immediately. You can also add text to your code if you are trying to present your code or research. Jupyter Notebook is almost like using a word processor to write code. It’s open-source and free to use. Also, Jupyter preinstalls popular Python libraries for machine learning such as Numpy, Pandas, Scipy, Matplotlib, scikit learn and so on.
Key Features
- Ease of use
- Great autocomplete and function documentation
- Good file management
- It’s perfect for machine learning projects
- Graphical results are clearly presented
Atom
Atom is a free to use development tool for Windows, Mac and Linux. A major highpoint of Atom is its clean interface, great design and seamless integration with other packages. It has almost the same feature set as Sublime Text. Atom supports multiple programming languages such as TypeScript, C, JavScript, Python, PHP and more.
Key Features
- Great autocomplete feature
- Supports community-made packages
- Good syntax checking and reference highlighting
- Cross platform editing
- Quick navigation panes
Summary
An Integrated Development Environment or a code editor, which do you choose? When deciding ask yourself this question first, ‘what is the development task you have at hand?’. Is it data science? Is it web development? Is it simple code debugging? Often the answer to this question will tell you which tool to choose.
Right now, somewhere on the Internet there is a battle going on among developers, and what they think is the best development tool to use. In my opinion there is no one tool, only your current project. Data science? Choose Jupyter. Web development? Choose VS Code. Debugging? Choose Sublime. Who says you have to pick only one development tool? Try them all and decide which one is right for you and your Python project. As you become more experienced with one tool you can move to something more complicated with a bigger feature set.
I hope you found this article useful.
Tony.