Translate in Your language

Wednesday, 1 April 2020

Learning Python - Part-5: Python Interfaces

When it comes to working with python, we can always use interactive mode by launching python or Python3 command as shown in below screenshot. 


Image: 1
Once launched we can run all sorts of python operations, however, this approach is not used for development work. 

When it comes to writing programs, we generally prefer editors. In fact we can use basic editors like notepad(Windows)/vi editors(Linux). In these editors, once we are done with writing programs, we need to make sure files are stored as .py extension (Image: 2). We simply run python command to execute the programs as shown in below screenshot (Image: 3).



Image: 2

Image: 3
Though using normal editors is fine, but when it comes to writing simple, large or complex programs, these basic editors do not offer help or suggestions or correction while writing code. That is where the need of tools that help during programming arises. Below are some of the code editors and IDEs that are widely used.


Code Editors:

A code editor is a tool that is used to write and edit code. They are usually lightweight and can be great for learning. 
  • Sublime Text 3:
    • License: Freemium
    • Users: Beginners, Pros
    • Download link: Sublime



Sublime Text is one of the popular code editor. It does supports multiple programming languages. Python is included as inbuilt support so additional steps are not required. Sublime text is fast and highly customisable editor. It has a huge community.

You can install packages such as debugging, auto-completion, code linting, etc. There are also packages for scientific development, Django, Flask and so on. You can customise Sublime text to create a full-fledged Python development environment.

  • Atom:
    • License: Free
    • Users: Beginner, Professional 
    • Download Link; Atom

Atom is an open-source code editor (by Github) which can be used for Python development.

Atom is highly customisable. You can install packages as per requirements. Commonly used packages for Python development are autocomplete-python, linter-flake8, python-debugger and others.

  • Visual Studio Code:
    • License: Free
    • Users: Professionals
    • Download Link: VS Code

Visual Studio Code (AKA VS Code) is a free and open-source IDE developed by Microsoft.

You can add extensions to create a Python development environment as per requirement in VS code. It provides features such as intelligent code completion, linting for potential errors, debugging, unit testing and so on.

VS Code is lightweight and packed with powerful features. VS Code is a popular editor among Python developers.

IDEs:

An IDE (Integrated Development Environment) understands code much better than a text editor. It provides features like build automation, linting, testing and debugging. This significantly speeds up development tasks. The downside is that IDEs are:
  • Large size
  • Resource intensive
  • Complex to use initially
  • License may be required for certain feature
  • IDLE: 
    • License: Free 
    • Users: Beginners

When we install Python, IDLE is also installed by default. This makes it easy to get started with Python. 


IDLE has features like:
  • Python shell window(interactive interpreter) 
  • auto-completion 
  • syntax highlighting
  • smart indentation
  • basic integrated debugger.
IDLE is lightweight and simple to use. However, may not that helpful for larger or complex projects.




  • Thonny:
    • License: Freemium
    • Users: Beginners
    • Download Link: Thonny


Thonny is a Python dedicated IDE. It has Python 3 built-in, so we can start writing Python codes once we install Thonny.

Thonny is intended for beginners and the user interface is designed to be simple so it is easy to get started.

Though Thonny is for beginners, it has several features that also make it a good IDE for full-fledged Python development. 


Features:
  • error highlighting
  • debugger
  • code completion
  • step through expression evaluation


  • PyCharm:
    • License: Freemium
    • Users: Professional
    • Download link: PyCharm

PyCharm is an IDE for professional developers. It is designed and developed by JetBrains.

There are two versions of PyCharm:

  • Community - 
    • free open-source version, lightweight, good for Python and scientific development
  • Professional - 
    • paid version, full-featured IDE with support for Web development as well
PyCharm provides all major features that a IDE should provide: 
  • code completion
  • code inspections
  • error-highlighting and fixes
  • debugging
  • version control system
  • code refactoring. 
  • All these features come out of the box.
However, PyCharm can be resource-intensive and may slow down system performance in case your system does not have enough resources.


  • Spyder:
    • License: Free
    • Users: Beginners, Professional
    • Download Link: Anaconda


Spyder is an open-source IDE mostly used for scientific development.

The easiest way to get up and running up with Spyder is by installing Anaconda distribution which is a popular distribution for data science and machine learning.

Spyder has some great features such as autocompletion, debugging and iPython shell. However, it lacks in features compared to PyCharm.

  • Jupyter Notebook:
    • License: Free
    • Users: Professionals
    • Download Link: Anaconda

The Jupyter Notebook is an open source web application that we can use to create and share documents that contain live code, equations, visualizations, and text. Jupyter Notebook is maintained by Project Jupyter. 


The most popular distribution of Python is Anaconda. We can also use terminal to install Jupyter as shown below.



The name, Jupyter, comes from the core supported programming languages that it supports: Julia, Python, and R. 

Jupyter is shipped with the IPython kernel, which allows you to write your programs in Python, however, currently over 100 other kernels are supported that we can use.

No comments:

Post a comment

Followers

Popular Posts This Week