Best Mac Text Editor For Python

renewclick
6 min readNov 6, 2021

--

Download here

Atom Text Editor has joined the list of best text editors for Mac and has already left its mark in being quite capable and powerful tool. Atom too is a free and open source text editing tool and is maintained through one of the well-known repository — GitHub. Although this text editor is available for many popular programming languages such as Ruby on Rails, PHP, Java and so on, Atom has interesting features that create a good experience for Python developers.

Not into Python? Prefer Ruby instead? Here are the most popular editors and IDEs for Rubyists.

So, you’ve decided to learn Python? Great! Python is a really interesting programming language, that has been described as a descendent of ABC that appeals to Unix/C developers. And you can’t go wrong with a language named after Monty Python!

So yes, you have many exciting things waiting for you.

But one of the first things you’ll need to do is pick an editor you’ll use to write your Python program. Well, here comes the confusion. You’re faced with tons of editors out there, each with a community trying to get you attracted to using that editor. “Use vim!” “Use Emacs!” “Use Sublime Text!”

You recoil in fear… what if you make the wrong choice?

This feeling inspired me to interview Pythonists about their favorite Python editor. This will show which editors are used by the most Pythonists, and from there we can try to work out why. My hope is that it’ll serve as a guide for newcomers to Python, or even for those already working with Python.

I’ll start by discussing the most popular editors, then take a look at the advantages (and disadvantages) of the winner, before moving on to looking at how to install it onto your system.

The Survey

I spoke to 100 Pythonists, who brought up the following editors (presented here in order of popularity):

  1. Sublime Text
  2. Vim
  3. Emacs
  4. Notepad++
  5. TextWrangler
  6. IDLE
  7. Atom
  8. Aquamacs
  9. GNU Nano
  10. Kate
  11. gedit

Sublime Text was by far the most preferred editor, used by 45% of the interviewees. The charts below tell the tale:

From the figures above, we can see Sublime Text rules as the favorite Python editor from the sample I have interviewed. This seems to go hand in hand with Sublime Text’s slogan: The text editor you’ll fall in love with.

Sublime Text’s Advantages

So what makes Sublime Text so special?

Like others, I use Sublime for my Python work. I like the features mentioned in this post about Sublime Text. Briefly, these are:

  • Packages: Sublime Text comes with a fully-featured package manager that helps the programmer to discover, install, update, and remove packages for Sublime Text.
  • Macros: Instead of retyping simple strings of text, you can simply record macros and create a keyboard shortcut to output that text into your document.
  • Colors: In Sublime Text, you can quickly pick colors for the interface and text.

Other useful features for Sublime Text, as mentioned in this SitePoint Smackdown post, are as follows:

  • Comprehensive language support with TextMate-compatible grammar
  • “Goto Anything” quick navigation to locate files and code
  • A command palette to access all features
  • Extensive customization, great themes and numerous plugins

Sublime Text’s Shortcomings

However, Sublime Text still needs some improvements to become a better editor for Python.

Here are some ways Sublime Text could be improved to work better with Python:

  • In Sublime Text, some deep language specific integration features such as static analysis and refactoring, also available through plugins, are not that polished.
  • Dynamic analysis of code and autocomplete need to be enhanced.
  • Sublime Text could be made more friendly to new Python programmers. For example, if one needs to configure the application’s preferences, this is done by writing/editing lines of code. This is something a new programmer may feel uncomfortable attempting.
  • As a continuation to the previous point, Sublime Text needs to be simplified a bit, as it has a steep learning curve, and plugins need to be simplified, since they can be confusing.
  • While the app can be equipped with impressive features, these have to be installed separately, and some of them are not free.
  • Sublime Text is inaccessible via the terminal.

How to Set Up Sublime Text for Python

So, you want to give it a try? In this section, I’ll show you how to setup Sublime Text to work with Python. I will be demonstrating this on a Microsoft Windows 8.1 machine. If you want to do that on a MAC OS X machine, you can follow this tutorial, and on an Ubuntu machine, you can refer to this thread.

Let’s get started.

Installing Python

Download Python from here. I will download Python 3.4.2. This will be an msi file. Thus, the file you will get downloaded is python-3.4.2.msi. Run the installer, for which it will display the wizard shown in the figure below:

Navigate through the steps until you finish the setup wizard. You’ll notice that Python was installed in C:Python34, if you kept the default location.

Installing Cygwin

The next step is to setup Cygwin, a tool for providing Windows with similar functionality to a Linux distribution. If you’re on a 32-bit Windows, download the setup file from here. If you are on a 64-bit Windows, download the setup file from here. After you download the appropriate setup file, run that file, for which you will get the following start page in the wizard:

Keep navigating through the installer until you reach the following step:

In this step, we’ll be installing three software packages: curl, git, and openssh. For this, let’s use the Search box. For example, for curl, type the word in the search box, but, be careful, don’t hit the enter key, as this will continue the Cygwin installation. When you type curl in the search box, you should get something like the following:

What we want to do now is install each of the packages above. Click on the + sign. You will notice skip, click on skip, so you get the latest version number of the package, which we want to install. In this case, you should get something similar to the following:

Click the Next button, and wait until the packages are downloaded. This might take some time to finish.

Do the same for the other two packages, git and openssh.

Best Mac Text Editor For Python For Mac

After you finish, you should get a Cygwin shortcut at your desktop, like this:

Through this terminal, you’ll be running your Python code, in addition to accessing the packages installed above. If you double click the icon shortcut, you should get something like the below image:

To make sure that the packages were installed, and get an idea of their locations, we will use the
which command, as follows:

I was able to install Python through Cygwin using the following step (notice ‘Python’ at the end):

If you happen to miss this step, or you want Cygwin to find and use the Python version you installed above, you can issue this command in the terminal:

Installing Sublime Text

Now, for the easiest part. To install Sublime Text, go to the Sublime Text homepage, download, and set it up. Very easy!

Python Text Editor Download

Test Your Installation

At this point of the tutorial, let’s test if our setup works, and we’re ready to use Sublime Text to work with Python.

Open Sublime Text, and type this line of code:

Choose File -> Save. In the Save As dialog box, choose where to save the file, name the file, and in Save as type:, choose Python. For instance, this is what I chose:

Now, open the terminal (Cygwin icon shortcut), and navigate to where you saved your Python file. In my case, it was on the Desktop. In my case, the file path would like like the following:

Finally, type the following command in the terminal to run the Python program:

In which case, you should get the following output:

You now have everything setup, and ready to delve through the Python world with Sublime Text! One of the first things you should do now is check out this collection of plugins for Python development with Sublime Text.

Conclusion

While Sublime Text has a commanding lead in numbers, that’s but one consideration. There are many popular editors, and it may not be right for every Pythonist. Nevertheless, it’s always good to know how the majority handle their projects, and there is something to be said for using a popular app or technology.

What is your favorite Python editor? How do you set it up for working productively?

Download here

--

--

renewclick
renewclick

No responses yet