Archive for September, 2011

Python Weekly newsletter

September 29, 2011 1 comment

A free weekly newsletter featuring curated news, articles, new releases, jobs etc related to Python.

Sample here.

Categories: python Tags: ,

Radio Free Python

September 21, 2011 Leave a comment

Radio Free Python is a monthly podcast focused on the Python programming language and its community.

  • Each episode will start with the news. However, since there isn’t that much breaking news from month to month, this will often veer into a sort of magazine-format news, introducing a specific topic and going over its history as well as current events.
  • After the news, each episode will feature an interview with some notable Python luminary.
  • Following the interview will be either a Link or Project Highlight, an Editorial, or both, depending on time and inspiration.
Categories: python Tags: , ,

BeautifulSoup with CssSelect? Yes!

September 18, 2011 Leave a comment

(20131215) This post is out-of-date. BeautifulSoup 4 has built-in support for CSS selectors. Check out this post.

A few days ago I started to explore lxml (it’s been on my list for a long time) and I really like its CSS selector. As I used BeautifulSoup a lot in the past, I wondered if it were possible to add this functionality to BS. I made a quick search on Google and here is what I found:

A single function, select(soup, selector), that can be used to select items from a BeautifulSoup instance using CSS selector syntax. Currently supports type selectors, class selectors, id selectors, attribute selectors and the descendant combinator.

Just what I needed :) You can also patch BS and integrate this new functionality:

>>> from BeautifulSoup import BeautifulSoup as Soup
>>> import soupselect; soupselect.monkeypatch()
>>> import urllib
>>> soup = Soup(urllib.urlopen(''))
>>> soup.findSelect('div.title h3')
Categories: python Tags: , ,

Download cookie-protected webpages

September 16, 2011 Leave a comment
Categories: python Tags: , , ,

Turning Vim into a modern Python IDE

September 13, 2011 Leave a comment

For text editing I use vim. When writing Python code and the script is short, vim is OK. However, if it’s a larger project, then I prefer an IDE (PyDev for instance).

Today at reddit someone directed me to the post Turning Vim into a modern Python IDE by Jonh Anderson. I will give it a try :)

Categories: python Tags: , ,

Getting started with numpy, scipy, matplotlib

September 13, 2011 Leave a comment

Installing matplotlib

sudo apt-get install tcl8.5-dev tk8.5-dev
sudo pip install matplotlib

List all installed python packages

September 13, 2011 Leave a comment
(pip freeze | cut -d = -f 1 | grep -v FIXME | xargs echo | tr ' ' '\n' >list.txt) 2>/dev/null

The list is written to “list.txt”, one package per line. This tip is based upon this thread. This version removes FIXME lines and warnings.

I want to figure out how to upgrade all those packages that I installed via “pip install”. The thread above proposes to execute “pip install -U” on the list of packages. However, it will upgrade every python package, even the ones that were installed with apt-get (or Synaptic, etc.). Apt-get builds a database that contains every file on the system. If “pip install -U” replaces those files, I’m afraid apt-get will panic. This is something to be investigated.