IPython is an enhanced version of the standard Python shell, offering many additional features. Find out more about its history, its benefits and its close links with Project Jupyter.
The standard Python distribution offers a “REPL” (Read-Evaluate-Print Loop) environment in the form of the Python shell with the ” ” prompt.
However, the IPython (Interactive Python) environment offers many additional features to this standard Python shell. It is also the root of Project Jupyter.
|Folium: Discover the open source Python library
|Matplotlib: Master Data Visualization in Python
|Python Crash Course: Get started
|Mastering Machine Learning in Python: Data-Driven Success
|Python Programming for Beginners – Episode 3
What is IPython?
IPython is a vastly improved Python interpreter, created in 2001 by Fernando Perez. Starting in 2005, a notebook interface for the IPython shell was released, and other languages such as R and Julia were subsequently supported.
Almost a decade later, in 2014, Fernando Perez created the Jupyter project as a “spin-off” from IPython. For good reason, IPython had been enhanced with a notebook server and a Qt console.
As of IPython 4.0, all additional components have been transferred to Project Jupyter. Support for other languages was added to the IPython notebook.
At present, IPython continues to focus on improving its interpreter functionality. It also provides the primary kernel for the Jupyter notebook.
The benefits of IPython
IPython offers additional capabilities to Python. Its first highlight is a powerful interactive Python shell.
Other highlights include syntax highlighting, and a handy magic command system for controlling the Python environment and performing OS tasks. Tab-completion of keywords, variables and function names is another plus.
Its object introspection capabilities make it possible to check object properties during runtime. It offers some very useful features for exploration, such as the “?” operator for indicating the type and docstring of a variable.
If it’s a class or a callable, the call or constructor signature is displayed. If you add a second “?”, the source code also appears. What’s more, it includes easy-to-use, high-performance tools for parallel computing.
If an exception occurs when executing a script with the “run” command, you can access the Python pdb debugger with the “debug” command, without having to execute the script again. It is then possible to examine the script as it was before the exception.
The “run-p” command displays a list showing the number of calls for each function, and the cumulative time with or without sub-calls.
These statistics make it possible to target optimization more effectively. The entire interaction history is stored.
Many Python programs can be integrated with IPython. One example is the Matplotlib library. This simplifies the scripting of interactive plots, and ipython -pylab offers a data visualization environment comparable to Matlab.
In addition, IPython acts as the main kernel for the Jupyter notebook and other Project Jupyter front-end tools. It is therefore an essential tool for Data Science.
What is the Project Jupyter?
Project Jupyter is a complete software ecosystem dedicated to interactive computing, originally created as a spin-off from IPython. It brings together several tools and programs.
The Jupyter notebook is a web-based interface to the programming environments of Python, Julia, R and many others. The QtConsole is a Qt-based terminal for Jupyter kernels similar to IPython.
The nbviewer makes it easy to share Jupyter notebooks, and the JupyterLab is a modern web-based integrated interface for all products. Jupyter ?
Conclusion: IPython, a vastly improved Python interpreter
IPython improves exploration, debugging and optimization with Python. It is also very useful for parallel computing, and serves as the kernel for Jupyter notebooks.
To learn how to use Python, IPython and Jupter, choose DataScientest.
Our online training courses provide you with all the skills you need to become a Data Scientist, Data Analyst, Data Engineer or Data Manager.
All our courses can be completed entirely by distance learning, and are eligible for funding options. Discover DataScientest now!
Now you know all about IPython. For more information on the same subject, take a look at our complete dossier on Python and our dossier on Jupyter notebooks.