Python has become one of the most popular programming languages in recent years. There is no doubt that python offers remarkable features for development in areas such as Artificial intelligence, neural networking, big data etc. To take full advantage of these features, the use of an ideal code editor is very crucial. One such exceptional code editor for python is Sublime Text.

In this article, we will look at a step-by-step guide for how to setup Sublime Text for full stack Python development, how to use many of the commands, features, and keyword shortcuts that make Sublime text a powerful tool and how you can enhance some of the basic functionalities using different packages.

python CTA

Sublime Text for Python

Sublime Text is a lightweight, cross-platform code editor mostly popular for its speed, simplicity, ease of use, and robust community support. It is an incredible code editor out of the box even without any add-ons or customizations. Still, the add-on packages and custom settings can be a great level up as it introduces various new features that can significantly enhance the functionalities. The rich package ecosystem offered by sublime text makes it very easy to configure the text editor specifically for what you want to use it for. Some of the packages are universally helpful and improve the ease of use whereas, some are very specific to a field of development.

By default, sublime text can be used with any programming language but its support for Python is considered one of the best. Keep reading below for a complete guide on how to use Sublime Text for Python.

Why you should use sublime text for python?

It only takes these three words to conclude the reason for choosing Sublime Text for Python development, simplicity, Interface and customization. All the features offered by sublime text are targeted at improving the interface and as a result, it makes the code editor extremely simple. On top of that its extensive customizable options make it the ideal choice for a code editor.

1. Simplicity

Being a lightweight code editor, Sublime Text is extremely fast. The creators have also emphasized keeping the experience smooth and simple. The code editor just pops up right away when opened, unlike various other IDEs that take a significant amount of time to boot up and then welcome you with a bombardment of messages and prompts.

Its also autosave features also keep things very simple as you can just leave your work and next time it will open up from exactly where you left off so you will not have to worry about saving your work in case of a low battery or sudden power off.

2. Interface

Sublime Text has taken the minimalist approach for its interface. The interface offered by Sublime text is one of the cleanest interfaces you can get from a code editor. There are no unnecessary side and bottom panels that often takes up a big chunk of screen real-estate, showing only what is required, providing you with enough ground to focus on your code.

The interface also supports multiple projects separately. Opening up a new project will not close your current project instead; it opens up a separate new window for you. This separation could be very useful especially when you are referencing multiple codebases.

3. Customization

Sublime Text offers some rich features out of the box such as indentation preferences, spell checks, key bindings, multi-select, and file patterns. On top of that, the most highlighted customizing feature for Sublime Text is the option to extend the current functionalities using the addons called Packages. These packages can be explained as pluggable extensions to perform additional tasks. We will be discussing some packages for python later in the article.

How to set up Sublime Text for Python development

Note: The following steps are directed for a Windows operating system. These instructions may vary for MACOS and Linux operating systems.

Step 1: Download and install Sublime Text and Python on your device

The latest version of Sublime Text (currently sublime text 4) can be downloaded for free from sublimetext.com. Once downloaded, run the .exe file to complete a simple installation process.

You will also need to have Python installed on your computer. If you have not already done this, you can download and install Python from python.org.

Step 2: Configuring Sublime Text for Python

Sublime Text comes almost configured and ready out of the box. However, if you want to set the Sublime Text for Python, you should install and configure the integrated terminal. To set it up,

  • Go to ‘Command Palette’ located under the ‘Tools’ menu.
  • Type “Install Package Control” and select it from the drop-down menu. This will install ‘Package Control’ on your Sublime Text editor. If it is successfully installed, a pop-up message will prompt it
  • After that, install the ‘Terminus’ by again start typing in the ‘Package Control’ and selecting ‘Package Control: Install Package’ from the dropdown list.
  • This will now give you a new dropdown list with all the available packages that you can install to enhance your Sublime Text experience for python.
  • Select ‘terminus’ from that list. This will download the ‘terminus’ package. Once completed, it will appear under ‘Preferences’ -> ‘Package Settings’ -> ‘Terminus’.
  • You can open up the terminus by opening up the ‘Command Palette’ again and typing in ‘Terminus’. Select ‘Terminus: Open Default Shell in Panel’. This will open up the console.
  • The final step of configuration is to set the syntax to Python by opening up the ‘Command Palette’ again and then typing in ‘Python’.
  • Select the ‘Set Syntax: Python’ option. This will make sure that your highlighting, colour scheme and auto-indentation are based on Python syntax.

Top Sublime Text Packages for Python developers

Similar to Package control and terminus, Sublime text offers a variety of packages to improve your python coding experience. You can install whatever packages you want using Command Palette just like the process of installing terminus mentioned above.

Package Control is the main package for installing other packages. You need to install it first before you can install anything. Once package control is installed, you will have the option available to select ‘Package Control: Install Package’. This will provide a list of available packages for Sublime Text.

Following are some of the top packages in the sublime text that you should have to get started coding in python using sublime text.

– Tabnine for sublime

Tabnine is an AI-driven code completion package that can cut your coding time and occurring mistakes by making the best practice suggestions. It supports over 30 programming languages and Python is one of them.

– Requirementstxt

Requirementstxt is a very useful package that provides syntax highlighting and easy version management for your requirements.txt files.

– Anaconda

Anaconda is a good alternative to requirementstxt for syntax highlighting and version management. It can turn the Sublime Text editor into a full fledge Python-ready IDE by incorporating code linting, autocompletion, autopep8 formatting, McCabe complexity checker Vagrant and Docker support.

– Git

Git packages allow developers to perform some of the most common git commands from within Sublime Text. You can use commands such as git add, commit, and push right from the sublime text.

– GitGutter

GitGutter package helps in keeping track of files that have been edited since the last commit in git. It adds a small symbol next to the line numbers that indicate the updated status of the git repository.

– Auto Docstring

Auto Docstring package allows the users to create a Python docstring template for a selected method, function or class. It also allows adding docstrings for every function in a code file and change between Google and Numpy style even after the docstrings were created.

– AutoPEP8

AutoPEP8 package automatically formats your Python code into the PEP 8 style guide. It allows you to choose key binding so that you can quickly lint spaces to the correct standard with ease.

– SublimeLinter

SublimeLinter is an automated checking package that checks for errors and styles in your python code. It is one of the best linting packages in Sublime Text that is stable and fully supported. The timely updates also make sure that it always works with the new standards of python.

Wrapping it up

This was a comprehensive guide on how to set up Sublime Text for Python. By adding your required packages and with a little bit of tweaking, Sublime Text will be good to go for your python development.

In conclusion, Sublime Text is one of the best free code editors out there for python. The minimalistic interface makes it easy to use and distraction-free. It is also fast, and lightweight and the large ecosystem of packages can easily take care of all of your development needs.

Also Read: Using Postgresql And Python For Data Evaluation

python CTA2


Full Stack Java Developer | Writer | Recruiter, bridging the gap between exceptional talent and opportunities, for some of the biggest Fortune 500 companies.

Write A Comment