Last active
December 17, 2015 05:09
-
-
Save giotta/5556234 to your computer and use it in GitHub Desktop.
Montréal-Python : Debian + Python = ♡
Setting up a Python development environment on Debian
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "mtlpy-workshop-debian-dev-env" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Debian + Python = \u2661\n", | |
"\n", | |
"## Prerequisite\n", | |
"\n", | |
"* Debian installed\n", | |
"\n", | |
"## Python\n", | |
"\n", | |
"* Launch terminal<pre>\n", | |
"$\n", | |
"</pre>\n", | |
"\n", | |
"* Launch Python<pre>\n", | |
"$ python\n", | |
"</pre>\n", | |
"\n", | |
"* Identify default Python version<pre>\n", | |
"$ python\n", | |
"Python 2.7.3 (default, Jan 2 2013, 16:53:07) \n", | |
"[GCC 4.7.2] on linux2\n", | |
"Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n", | |
"<<<\n", | |
"</pre>\n", | |
"\n", | |
"* Code some stuff<pre>\n", | |
"<<< print \"Hello World!\"\n", | |
"Hello World!\n", | |
"</pre>\n", | |
"\n", | |
"* In real life we write scripts... so we need to install a text editor\n", | |
"\n", | |
"## Debian : Installing a Debian Package\n", | |
"\n", | |
"How to find a package\n", | |
"\n", | |
"* Web : all packages : [http://packages.debian.org/stable/allpackages](http://packages.debian.org/en/stable/allpackages)\n", | |
"* Web : all packages by category : [http://packages.debian.org/stable/](http://packages.debian.org/en/stable/)\n", | |
"* Web : Python packages : [http://packages.debian.org/stable/python/](http://packages.debian.org/en/stable/python/)\n", | |
"\n", | |
"How to install (and remove) a package\n", | |
"\n", | |
"* Graphic mode : where to go<pre>\n", | |
"Applications > System Tools > Add/Remove Softwares\n", | |
"</pre>\n", | |
"* Command line : here's the command<br />\n", | |
"(replace \"package-name\" with the actual package name you want to install/remove)<pre>\n", | |
"$ sudo apt-get install package-name\n", | |
"$ sudo apt-get remove package-name\n", | |
"</pre>\n", | |
"\n", | |
"Packages installed system-wide vs installed project-wide\n", | |
"\n", | |
"* System-wide : for all projects, might need \"sudo\"\n", | |
"* Project-wide : project specific, permits specific versions\n", | |
"\n", | |
"## Text Editor\n", | |
"\n", | |
"[http://packages.debian.org/stable/editors/](http://packages.debian.org/stable/editors/)\n", | |
"\n", | |
"* Graphic mode : gedit is already there\n", | |
"* Command line : emacs, vim, nano\n", | |
"* Wich to choose? a matter of taste\n", | |
"* Debian packages = \n", | |
"<pre>\n", | |
"$ sudo apt-get install emacs\n", | |
"$ sudo apt-get install vim\n", | |
"$ sudo apt-get install nano\n", | |
"</pre>\n", | |
"\n", | |
"## Python : Python Interpretor\n", | |
"\n", | |
"* IPython : interactive interpretor<br />\n", | |
"why IPython?\n", | |
"* IPython notebook : might be useful for Montr\u00e9al-Python workshops ;)\n", | |
"* Debian packages = \n", | |
"<pre>\n", | |
"$ sudo apt-get install ipython\n", | |
"$ sudo apt-get install ipython-notebook\n", | |
"</pre>\n", | |
"\n", | |
"## Version Control\n", | |
"\n", | |
"* Why control versions of source code?\n", | |
"* Wich to choose? git, mercurial...\n", | |
"* Debian packages = \n", | |
"<pre>\n", | |
"$ sudo apt-get install git\n", | |
"$ sudo apt-get install gitk\n", | |
"$ sudo apt-get install mercurial\n", | |
"</pre>\n", | |
"\n", | |
"## Python Extensions\n", | |
"\n", | |
"* Python extensions written in other languages might be needed, so we need tools to compile them<br />\n", | |
"ex.: gcc, pil...\n", | |
"* build-essentials, python-dev (Python sources)\n", | |
"* Debian packages = \n", | |
"<pre>\n", | |
"$ sudo apt-get install build-essential\n", | |
"$ sudo apt-get install python-dev\n", | |
"</pre>\n", | |
"\n", | |
"## Virtual Environments\n", | |
"\n", | |
"* For packages to be installed project-wide\n", | |
"* virtualenv\n", | |
"* Debian package = \n", | |
"<pre>\n", | |
"$ sudo apt-get install python-virtualenv\n", | |
"</pre>\n", | |
"\n", | |
"## Python Tools Offered as Debian Package\n", | |
"\n", | |
"Science\n", | |
"\n", | |
"* matplotlib, numpy\n", | |
"* What for?\n", | |
"* Debian packages =\n", | |
"<pre>\n", | |
"$ sudo apt-get install python-matplotlib\n", | |
"$ sudo apt-get install python-numpy\n", | |
"</pre>\n", | |
"\n", | |
"Web Frameworks\n", | |
"\n", | |
"* Django, Pyramid\n", | |
"* What for? wich choose?\n", | |
"* Debian packages =\n", | |
"<pre>\n", | |
"$ sudo apt-get install python-django\n", | |
"$ sudo apt-get install python-pyramid\n", | |
"</pre>\n", | |
"\n", | |
"Database drivers\n", | |
"\n", | |
"* mysqldb, psycopg, sqlalchemy\n", | |
"* What for? wich choose?\n", | |
"* Debian packages =\n", | |
"<pre>\n", | |
"$ sudo apt-get install python-mysqldb\n", | |
"$ sudo apt-get install python-psycopg2\n", | |
"$ sudo apt-get install python-sqlalchemy\n", | |
"</pre>\n", | |
"\n", | |
"## Conclusion\n", | |
"\n", | |
"Well...\n", | |
"\n", | |
"* Don't need much\n", | |
"* It's all in Debian\n", | |
"* It's simple and fun!\n", | |
"\n", | |
"## What's next?\n", | |
"\n", | |
"We're here to help install and explore all this.\n", | |
"\n", | |
"Montr\u00e9al-Python : events to come.\n", | |
"\n", | |
"* MP 37, MP monthly conference : [http://montrealpython.org/2013/04/mp37/](http://montrealpython.org/2013/04/mp37/)\n", | |
"* Workshops? Intro Python, Intro Django, else?\n", | |
"* PyCon 2014 : in Montr\u00e9al\n", | |
"\n", | |
"Follow us\n", | |
"\n", | |
"* [http://montrealpython.org](http://montrealpython.org)\n", | |
"* See contacts : mailing list, IRC, twitter\n", | |
"* Facebook : [https://www.facebook.com/montrealpython](https://www.facebook.com/montrealpython)\n" | |
] | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment