This course has finished, please see the 2012 Internet Programming in Python Syllabus


UW Certificate Program in Python Programming

Internet Programming in Python

Winter Term, 2011 - (10 Sessions) Tuesdays 6 - 9 pm, January 11 through March 15

This program also includes Programmming in Python (Autumn 2010) and System Development with Python (Spring 2011).


Summary. Readings. Schedule.


Course objectives: This course emphasizes distributed programs and web applications - how they work and how to program them in Python. Students will explore the underlying principles and their expression in Python libraries. Students will learn contrasting approaches in creating applications: programming with the low-level libraries versus using highly integrated frameworks. All topics will be presented with a focus on solving real problems with simple, pragmatic code.

Prerequisites: Students should have successfully completed Programmming in Python or have an equivalent level of experience. Contact the instructor prior to registering if not in the certificate program.

Textbooks: Various online sources will be used.

Instructor: Brian Dorsey.
Brian Dorsey is a database and Python developer with over 10 years of experience using Python professionally. He currently works at Vulcan Inc., developing command line tools, simple web applications, Windows services, HTTP/JSON APIs and the occasional iPhone prototype. He is excited about information, databases, user experience, testing and glue code. Brian is a co-organizer of the Seattle Python Interest Group (www.seapig.org) and has given several talks and tutorials at conferences and user groups.

Technology Requirements: Students must have access to a computer for their assignments and projects, where they can install software (the course does not provide a computer laboratory). It is recommended that students have a portable computer to bring to class. Internet access will be provided at classes.

Assessment criteria: The course is graded Pass/Fail, based on satisfactory completion of required programming assignments and classroom presentations. Attendance is required; more than two unexcused absences will result in a Fail.

Disability accommodation: The University of Washington is committed to providing access and reasonable accommodation in its services, programs, activities, education and employment for individuals with disabilities. For information or to request disability accommodation contact: Disability Services Office: 206.543.6450/V, 206.543.6452/TTY, 206.685.7264 (FAX), or e-mail at dso@u.washington.edu.


Assignments may be completed in groups of 1-3 people. Students are encouraged to actively consult each other and share any relevant reference and support material. However, all code submitted for assignments must be completely written by each group.


Readings

See the Schedule below for specific readings each week.

Reference

Python 2.6 Quick Reference (awesomely dense and complete)
Python 2.6.5 documentation (official documentation from python.org)
Python Standard Library - Internet Protocols and Support
Python Module of the Week - examples of using the modules in the standard library.


Schedule

Tuesdays 6 - 9 pm, January 11 through March 15 (10 sessions).

Topics and readings will be revised before the course begins, consult frequently.

In addition to the topics listed below, each week will include:

WeekDateTopicsReadings
1Jan 11 Introductions
Networking basics - How computers talk to each other (on the internet).
(tcp/ip, sockets, telnet, SMTP)

files:
lecture slides
Twilio lightning talk
example scripts from the labs

assignment url:
http://bit.ly/uwipip_week1

readings:
WP - Internet Protocol Suite
Kessler - TCP/IP (sections 1, 2)
WP - Domain Name System
WP - Internet Socket
RFC 5321 - SMTP - (Appendix D ONLY)
(note: S is a server message, C is a client message.)

reference:
(skim before class, needed for labs & assignments)
python lib - socket
Socket Programming HOWTO
python lib - smtplib

extra:
WP - Berkeley socket interface
RFC 821 - SMTP (initial)
RFC 5321 - SMTP (latest)

bonus:
ZeroMQ Guide - Chapter 1
2Jan 18 More protocols - Languages of the internet.
(POP3/IMAP, FTP, HTTP, others)

Guest Speaker: Brian, wearing a different hat.
Topic: 30 minute web server

Lightning talks: Joe, Jon P, Aaron F

files:
lecture slides
example scripts from the labs

assignment url:
http://bit.ly/upipip_week2
readings:
Read through this list of modules. If you don't know what
a protocol is for, look it up online. Think about their
relationship to each other, which are clients? Which are servers?
Which clients talk to which servers?
Python Standard Library Internet Protocols

An introduction to the HTTP protocol:
HTTP Made Really Easy

reference:
(skim before class, needed for labs & assignments)
ftplib
httplib
urllib
urllib2

extra:
httplib2 - A comprehensive HTTP client library that
supports many features left out of other HTTP libraries.

Skim these four documents from different phases
of HTTP's life. Get a feel for how the specification
has changed (and how it hasn't!).
HTTP/0.9
HTTP - as defined in 1992
Hypertext Transfer Protocol -- HTTP/1.0
Hypertext Transfer Protocol -- HTTP/1.1
3Jan 25 Mashups and web APIs - Gluing things together and data for free.
(HTML/JavaScript, webscraping, REST, HTTP/JSON, XML-RPC)

Guest Speaker: John Musser (ProgrammableWeb)

Lightning talks: Jacob, Jeff B, Daniel

files:
lecture slides
example scripts from the labs

assignment url:
http://bit.ly/uwipip_week3
readings:
Wikipedia's take on 'Web Services'
xmlrpc overview
xmlrpc spec (short)
json overview and spec (short)
How I Explained REST to My Wife (Tomayko 2004)
A Brief Introduction to REST (Tilkov 2007)


reference:
(skim before class)

python standard libraries:
httplib
htmlparser
xmlrpclib
DocXMLRPCServer
json

external libraries:
BeautifulSoup - "You didn't write that awful page.
You're just trying to get some data out of it. Right now,
you don't really care what HTML is supposed to look like.
Neither does this parser."
httplib2 - A comprehensive HTTP client library that supports
many features left out of other HTTP libraries.
restkit - an HTTP resource kit for Python. It allows you
to easily access to HTTP resource and build objects around it.

SOAP:
rpclib - a simple, easily extendible soap library that provides
several useful tools for creating, publishing and consuming soap
web services
Suds - a lightweight SOAP python client for consuming Web Services.
the SOAP specification

extra:
Wikipedia on REST
Original REST disertation

4Feb 1 Live on the internet - letting other people run your code.
(hosting options, virtual machines, copying files,
git, a bit of unix, and just enough Apache configuration)

Lightning talks: Peter, Gregory

files:
lecture slides
example scripts from the labs

assignment url:
http://bit.ly/uwipip_week4
readings:
Learning the Shell - An excellent overview of fundamental shell usage.
Read this while logged into a bash shell (either local or
on your VM) and experiment with anything new to you.


bonus philosophy (awesome, but not required):
In the Begining was the Command Line (annotated version)
This is long, a bit historical, and thought provoking.
5Feb 8 Low level web - Write a dynamic web site the hard way.
(HTTP again, request/response, CGI, mod_python, WSGI)

Lightning talks: Jesse, Andrew, Tim

files:
lecture slides
example scripts from the labs

assignment url:
http://bit.ly/uwipip_week5
readings:
CGI tutorial - Read the following sections:
Hello World, Debugging, Form. Other sections optional.
Follow along, hosting CGI scripts either via Apache on our
VMs, or locally using CGIHTTPServer.

WSGI tutorial - Follow along, hosting WSGI scripts either via
Apache on our VMs, or locally using wsgiref.


Prepare for class:
CGI example scripts - Use these examples to get started
experimenting with CGI.


reference:
CGI module - utilities for CGI scripts, mostly
form and query string parsing
Parse URLS into components
CGIHTTPServer - python -m CGIHTTPServer
WSGI Utilities and Reference implementation
WSGI 1.0 specification
WSGI 1.0.1 (Python 3 support)
test WSGI server, like cgi.test()

Alternate WSGI introductions:
Getting Started with WSGI - by Armin Ronacher
very minimal introduction to WSGI
6Feb 15 Small web frameworks - Writing focused web sites.
(overview of frameworks and dive into CherryPy)

Guest Speaker: Leo Parker Dirac (Blog)
Topic: Pushing the limits of the HTTP protocol

Lightning talks: Jeff S, Melissa, Patrick

files:
lecture slides
example scripts from the labs

assignment url:
http://is.gd/uwipip_week6
readings:
CherryPy Tutorial

run this in your VM:
sudo apt-get install python-cherrypy3
svn co http://svn.cherrypy.org/tags/cherrypy-3.1.2/cherrypy/tutorial/

prepare for class:
tutorial scripts - more detailed example scripts
Work through as many of these as you can before class.
(The svn command above will copy the files to a tutorial directory.)
We will be working with the current version: 3.1.2

reference:
CherryPy official documentation
slightly crazy screencast - building a CherryPy application interactively

7Feb 22 Large web frameworks 1 of 2 - Standing on the shoulders of giants.
(overview of frameworks and dive into Django)

Guest speaker: Gary Bernhardt (Blog)

Lightning talks: Sun Hee, Ted

files:
lecture slides
example scripts from the labs

assignment url:
http://is.gd/uwipip_week7
We will be using Django 1.2.5 (current stable)

readings:
Django at a glance
Django tutorial
  • work through django tutorial parts 1, 2 and 3 on your local development machine
  • use the Django development server, not anything more complicated
    python manage.py runserver
  • don't configure a database, use the default: sqlite
# local install
(download http://media.djangoproject.com/releases/1.2/Django-1.2.5.tar.gz)
tar xvfz Django-1.2.5.tar.gz    (or use 7zip on Windows)
cd Django-1.2.5/
python setup.py install
python
>>> import django
>>> django.get_version()
'1.2.5'
    
If you want to also install it on our VMs,
Django 1.2.5 is *not* available via apt-get
in Ubuntu 10.4 on our VMs.
# VM install:
$ wget http://media.djangoproject.com/releases/1.2/Django-1.2.5.tar.gz
$ tar xvfz Django-1.2.5.tar.gz
$ cd Django-1.2.5/
$ sudo python setup.py install
$ python
>>> import django
>>> django.get_version()
'1.2.5' 
reference:
Django documentation

extra:
"The following parable will take you on a journey
through the creation of a Git-like system from the ground up.
Understanding the concepts presented here will be the most
valuable thing you can do to prepare yourself to harness
the full power of Git": The Git Parable
8Mar 1 Large web frameworks 2 of 2 - Standing on the shoulders of giants.
(more Django)

Guest Speaker: Ted Leung (Blog)

Lightning talks: Aaron B, Derek, Jon C

files:
lecture slides
example scripts from the labs

assignment url:
http://is.gd/uwipip_week8
readings:
(PDF) Building Django - Jacob Kaplan-Moss (2009)
(PDF) Django in the real world (2009)
    video instead? - part 1 part 2 part 3
read a bit about each of the apps in this post:
What's your favorite Django app?

reference:
http://www.djangopackages.com/

A couple of good looking books:
Django 1.1 Testing and Debugging
Beginning Django E-Commerce

extra:
The real difference between fetch and pull:
"Don't use git pull, use git fetch and then git merge."
git: fetch and merge, don't pull - Mark Longair

"You can learn a whole lot about Unix from that one little command."
The Tar Pipe - Gary Bernhardt
9Mar 8 Databases - relational and otherwise.
(a tour of information storage methods)

Guest Speaker: Dave Peck (Blog)
Topic: Google App Engine and Amazon Web Services

Lightning talks: Ben, Delane, Hitoshi
readings:
(Wikipedia) Relational Database
(Wikipeia) SQL
Is the relational database doomed?
NOSQL at Netflix
I can't wait for NOSQL to die
NOSQL is software darwinism
Why NOSQL will not die
NOSQL Comparison

extra:
Redis Tutorial by Simon Willison
10Mar 15 Python in the Cloud - Let someone else run your servers.
(overview of the options and dive into Google App Engine)

Guest Speaker: Brian Dorsey :)
Topic: PyCon 2011 - experiences and hot topics.
readings:
Amazon Web Services
Everything
Overview pages:
Amazon Elastic Compute Cloud (Amazon EC2)
Amazon Elastic Block Store (EBS)
Amazon Simple Storage Service (Amazon S3)
Amazon SimpleDB
Amazon Relational Database Service (Amazon RDS)

Google App Engine
What Is Google App Engine?
App Engine Python Overview

reference:
App Engine Python Runtime Environment docs
Datastore Overview
Book: Programming Google App Engine
(There don't appear to be any recent books,
you'll have to rely on the Google docs for new features.)

extra:
"Use your friends. Keep it simple. Play."
Teach Yourself Programming in Ten Years

Thank you very much to Blue Box Group, they have generously donated a Virtual Private Server for each of the students.