introduction to ipython & notebook

15
Introduction to IPython & Notebook Areski Belaid <[email protected]> github.com/areski twitter.com/areskib

Upload: areski-belaid

Post on 27-Jan-2015

128 views

Category:

Technology


5 download

DESCRIPTION

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.

TRANSCRIPT

Page 1: Introduction to IPython & Notebook

Introduction to IPython & Notebook

Areski Belaid <[email protected]>

github.com/areski

twitter.com/areskib

Page 2: Introduction to IPython & Notebook

Introduction to IPython

- Fernando Perez started IPython in 2001, he wanted a better interactive Python interpreter

- 259 lines of code, written in few hourshttps://gist.github.com/1579699

- Today: 78,481 lines of code & more than 100 contributors in the last 12 monthshttp://www.ohloh.net/p/ipython

Page 3: Introduction to IPython & Notebook

What is IPython?

IPython is an interactive shell for Python

● additional shell syntax● introspection● tab completion● rich history● better debugging● parallel computing

Page 4: Introduction to IPython & Notebook
Page 5: Introduction to IPython & Notebook

Install IPython

http://ipython.org/ipython-doc/stable/install/install.html

$ mkvirtualenv testipython$ pip install ipython

- You could also use easy_install, but do you want to, really?

Page 6: Introduction to IPython & Notebook

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

Page 8: Introduction to IPython & Notebook

NOTEBOOK

Page 9: Introduction to IPython & Notebook

What is Notebook?A web-based application that can execute code and also contain

rich 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”

Page 10: Introduction to IPython & Notebook

Install Notebook

Let's forget about easy_install, seriously?$ pip install ipython$ pip install pyzmq$ pip install tornado

$ ipython notebook

For some of the online examples :$ pip install numpy$ apt-get install libatlas-base-dev gfortran$ pip install scipy$ pip install matplotlib

Page 11: Introduction to IPython & Notebook

Hands on Notebook

$ ipython notebook

- Cell-based execution workflow

- Load previous code

- Share IPython Notebook

http://nbviewer.ipython.org/

Page 12: Introduction to IPython & Notebook

Notebook - Django Extension

Notebook is not only for Physicists !!!

- Use it with Django: https://github.com/django-extensions/django-extensions/pull/234

$ ./manage.py shell_plus --notebook

There is a little bug with the last IPython, that you can fix easily:export PYTHONPATH=/home/areski/public_html/django/MyProjects/newfies-dialer

Add this in your settings.py:IPYTHON_ARGUMENTS = ['--ext', 'django_extensions.management.notebook_extension','--debug']

Page 13: Introduction to IPython & Notebook

Conclusion- IPython Introspection, additional shell, tab completion, rich history,parallel computer, etc...

- NotebookAll the benefits of IPython on the web

IPython received a GrantSloan 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 !!!

Page 15: Introduction to IPython & Notebook

Hope you enjoyed it!

slideshare.net/areski

github.com/areski

twitter.com/areskib