Introduction to IPython & Notebook


Published on

IPython is an interactive Python shell, it provides tools for interactive and parallel computing that are widely used in the scientific world. It can also benefit any other Python developer.

Published in: Technology

Introduction to IPython & Notebook

  1. 1. Introduction toIPython & Notebook Areski Belaid <>
  2. 2. Introduction to IPython- Fernando Perez started IPython in 2001, hewanted a better interactive Python interpreter- 259 lines of code, written in few hours Today: 78,481 lines of code & more than 100contributors in the last 12 months
  3. 3. What is IPython?IPython is an interactive shell for Python● additional shell syntax● introspection● tab completion● rich history● better debugging● parallel computing
  4. 4. Install IPython$ mkvirtualenv testipython$ pip install ipython- You could also use easy_install, but do youwant to, really?
  5. 5. Hands On IPython- Shell $ ls, pwd, !vim- Code completion $ import os $ os.[press tab]- Introspection $ os? $ os??- History > use the key up and down- Execute previous command $ _i, _ii, _iii : Previous, next previous, next next previous input- Load Code > %loadpy- Traceback and Debugger %pdb
  6. 6. Integration with your IDE- Vim Sublime Text TextMate
  7. 7. NOTEBOOK
  8. 8. What is Notebook?A web-based application that can execute code and also containrich text and figures, mathematical equations and arbitrary HTML- a web-based shell to an IPython- a mix of notes, code, html, images, video, ...- a great tool for debugging, teaching- has ability to save, edit and delete“notebooks”
  9. 9. Install NotebookLets forget about easy_install, seriously? $ pip install ipython $ pip install pyzmq $ pip install tornado $ ipython notebookFor some of the online examples : $ pip install numpy $ apt-get install libatlas-base-dev gfortran $ pip install scipy $ pip install matplotlib
  10. 10. Hands on Notebook$ ipython notebook- Cell-based execution workflow- Load previous code- Share IPython Notebook
  11. 11. Notebook - Django ExtensionNotebook is not only for Physicists !!!- Use it with Django:$ ./ shell_plus --notebookThere is a little bug with the last IPython, that you can fix easily:export PYTHONPATH=/home/areski/public_html/django/MyProjects/newfies-dialerAdd this in your = [--ext,,--debug]
  12. 12. Conclusion- IPythonIntrospection, additional shell, tab completion, rich history,parallel computer, etc...- NotebookAll the benefits of IPython on the webIPython received a Grant Sloan Foundation grant: IPython has been awarded a $1.15 million grant from the Alfred P. Sloan Foundation. This will support several core developers, allowing them to focus on building the IPython Notebook into a tool for open, collaborative, reproducible scientific computing. The Future is Bright !!!
  13. 13. References- IPython : Python at your fingertips: Using IPython Notebook with Django: IPython Docs: IPython Notebook Viewer:
  14. 14. Hope you enjoyed it!