Use a text/code editor
When working on a Python project it is important to have a good local development environment because it allows you to work more efficiently and effectively. One key aspect of this local development environment is your virtual environment. Another key part of your local development environment is your editor, the place where you actually write your source or application code.
A text editor (also known as a code editor, the two terms are used interchangeably) is a program which allows you to write and edit source code, but not too much more than that! Text editors are generally lightweight and run fast.
In the screenshot you can see that Atom looks relatively simple. The sidebar on the left shows the project tree and the file view on the right shows the file(s) that you are currently editing.
The functionality of text editors can, however, be extended. Because they are generally open-source (and free!), there are 1,000s of plugins/packages available that make the editor more powerful. Atom, for example, has an ‘Install Packages’ section where you can choose and install packages (note that these are not Python packages - they are just named similarly!):
If you are using a text/code editor for writing source code then you will likely need to also make use of the command line to:
Manage activation/deactivation of your virtual environment.
Manage installation of packages in your virtual environment.
Run your application.
Commit changes to your repository with
Why use an IDE?
The alternative to using a text/code editor is to use an Integrated Development Environment (IDE). An IDE contains all the functionality of normal text/code editors and much, much more. In the case of Python IDEs, some features that they offer include:
A command line terminal where you can run your application. This means that you don’t have to switch programs to run commands in your terminal.
A Python interactive shell, which is basically a Python command line that you can use to test short ‘throwaway’ commands that you don’t need to keep a record of.
A Python debugger.
Functionality which will automatically save your code and then deploy it to a server/repository of your choice.
The ability to run tests inside the IDE.
The ability to customize keyboard shortcuts.
Much, much more!
Some examples of IDEs are Microsoft Visual Studio and PyCharm. Both Microsoft Visual Studio and PyCharm have paid-for ‘Professional’ editions, but also have free ‘Community’ versions that don’t offer all features/functionality.
To give you an idea for the look and feel of an IDE, let’s consider PyCharm. As with a code/text editor, PyCharm has a traditional project tree view in the sidebar with a view of the file(s) you are editing alongside.
The command line terminal in PyCharm is also nicely integrated into the view:
As an alternative to having the terminal open in PyCharm, you can also use the Python interactive shell:
Text/code editors are lightweight editors which you can use to write and edit source code. They can be extended/customized to make them more powerful.
IDEs are more powerful editors that should allow you to (almost!) do everything you need in your job without leaving the IDE.
There is no ‘right’ or ‘wrong’ editor to choose and use; what matters most is that you become an expert in the editor that you choose.
We’ve taken a look at some of the pros and cons of using text/code editors and IDEs. Next, let’s get you set up on an IDE and see whether you like it!