wwd.ca

 

mon petit blogue sans importance...

PyCon 2009, day 3

This is day 3 of the conference (see also my notes on day 1 and day 2). They've also announced that PyCon 2010 will in Atlanta, GA, on February 19th to 21st, though the precise dates might change a little. I am unfortunately unable to attend the sprints that will be happening this coming week, and i'm going back to Montréal today. Thanks to Akoha for paying for the trip, and for the entire PyCon team for putting the conference together. It was a great conference, and if anybody reading this is wondering whether they should go, by all means you should try to make it to Atlanta next year. In the meantime, read below for my account of the talks i attended today.


From the talks i saw today, i'd recommend these for watching or reading the slides from:

Here are the full notes for all of them.

Lightning Talks

  • mention of stackoverflow, an online "game" that's about asking and answering geeky questions, with a points and reputation system
  • zc.buildout (woah, documentation!), made for packaging python apps into rpm's or deb's; looking for urls about this, i found a post about using zc.buildout to deploy django apps
  • at the end (there was some free time), Jacob showed his complicated solution for generating a timer for the lightning talk speakers, but pointed to a nifty lightning timer that is really useful. If you want to show a big timer that'll count down 120 seconds and become more obvious when 20 seconds are left, you'd go to http://lightningtimer.net/#120,20

Keynote: Reddit: Steve Huffman and Alexis Ohanian

Funny talk about how Reddit got started, first being programmed in Lisp, then, when they got tired of the hurting, in python.

  • reddit is opensource, has been for a year (see all reddit opensource projects)
  • they've written C55, a compiler to CSS which has variables, functions, nested styles, and is built on top of PLY - Python Lex-Yacc -, so you can easily extend it
  • also to be released, an automatic thumbnail generator, which uses the entropy of the top and bottom portions to decide what to cut to make it square
  • followed by a bunch of random observations, such as ctypes are really really cool (agreed!), and if you're crawling, don't lie about your user-agent! (also agreed!)

Overall a rather interesting talk! and funny. Funny is good.

pycon talk page

Paver: easy build and deployment automation for Python projects

Paver lets you write build and deployment scripts in python, replacing for example Make. I'm not sure how it compares with scons, but if you're interested in the topic, i'd recommend you go check that out as well, at least for the build side. We use Make at Akoha for the entire build system, and as for deployment, well... that's a good subject for a future blog post, but let's just say we haven't properly solved that problem yet. Since we're using EC2, we're leaning towards just starting up new machines to deploy a new version and progressively shutting down the old ones. It has the great added benefit that it proves on a regular basis that you have sane base images and startup scripts.

Oh, paver doesn't handle the dependency tracking as much as make or scons; it's really more of a scripting thing to help you with repetitive tasks.

The problem with such talks is that it was mostly a bunch of slides showing raw code, and it's rather easy to drift off.

pycon talk page

A winning combination: Plone as a CMS, your favorite Python web framework as a frontend

So the basic problem being addressed here is that:

  • you (or you customer) want a CMS, but then also want a bunch of extra features, or
  • you want to write - or already have - a web application, but you now have the need for CMS-like functionality (for writing and organizing lots of content for example)

You can extend plone - it's in python after all -, but it's a very complex structure, using Zope as its framework, and Zope is a beast that's very different than what you're probably used to.

So the idea here is to use Plone for the content editing, but then use another web framework (such as django!) for the presentation and application parts. This lets you never worry about Plone or Zope internals, because that portion of the system is simply installed, roughly configured, and that's it.

How does it work? They wrote this Content Mirror, which is a synchronization tool that will take your content from the ZopeDB database [1] and synchronize it to another, relational database. It seems simple, but is a rather involved process: schemas have to be, translated, and they hook into all sorts of events on Plone so that the target content gets updated automatically. You don't just cron this to do the sync at midnight - presumably, when your marketing department edits a page, your phone will ring if they don't see the change on the site right away...

[1]ZopeDB is an object database, whereas frameworks like django use an ORM abstraction layer to generate python objects from the table-like information they get from their relational database, such as MySQL

pycon talk page

Using Sphinx and Doctests to provide Robust Documentation

Sphinx is a better breed of epydoc: it is what's now used to generated the full python docs and django doc sites. It can pull all the documentation from your codebase, and if you use reStructuredText formatting, your stuff will be all nicely formatted.

So this talk gave an example of using sphinx to generate the documentation for a project.

One thing i was totally unaware of is that sphinx has a cool wizard-like thing that'll help you get totally setup. If you have a python codebase, you could have a documentation tree done 2 minutes from now.

I already knew i wanted to use sphinx at some point to start documenting our backend code (and potentially more), but seeing how easy this is just makes me want to do it now :). I highly encourage you to go take a look at the sphinx intro!

pycon talk page

Leveraging ReStructuredText in your Projects

Now i was a little torn between this talk, and the django design decisions talk... but the later being rated with just 1 ?, and this one being ???, i'm thinking that i might already know most of what's in the django talk. Supposedly, the talks will be online soon - for real this time [2], so i'll watch it later. I've very much been getting into writing reStructuredText-formatted notes lately, though, and i want to start using sphinx to auto-generate larger amounts of documentation, so a few intros definitely won't hurt.

In the end, though, it was mostly an overview of reStructuredText itself... :( But it was still rather useful. He also did a quick overview of Sphinx which was actually a nice summary of what sphinx is, in a different format than the last talk.

He pointed out Nabu, written by Montréal's own Martin Blais, which lets you cross-reference things across many rst files and publish that to the web

He also went over how you would extend reStructuredText, giving the example of adding video nodes so that within your rst you could just refer to a video just like you refer to an image, and in the output html you would have a functional video player. This does involve some python as you need to create a new directive.

While writing those notes i did notice one annoying thing that has nothing to do with reStructuredText but with python packaging. I looked at a pdf version of my notes for day 1, and it looked great - much better than the web version, because i suck and i haven't given love to my site's CSS. So i figured i'll generate PDFs automatically and link to them... i even started thinking i could write all my posts in rst, and the backend would generate the html, and also generate the PDF allowing you to see that nicer-to-read version. Well, ubuntu's reStructuredText package doesn't include rst2pdf, which uses ReportLab to write PDF directly. It does include rst2latex, however, and you can then use pdflatex to transform that into PDF... except pdflatex hits a nasty snafu with weird unicode characters - such as ? -... the solution to which is fairly complicated... So i figured i'd easy_install rst2pdf... but then the version i get assumes a newer version of rst than is installed on my system, and i get a fail. I guess i need to find out which version of rst2pdf supports the version of rst i have, and easy_install that. Or i need to uninstall my .deb version, and easy_install all of rst... both solutions are ugly; the former only slightly less. Ugh.

[2]2 years ago, they filmed most of the talks, and were gathering forms from the speakers allowing the video to be online... afaik, that didn't work out and most talks never got online. Last year, the speakers were giving implicit agreement to having the video shot and posted online by giving a talk, and a lot of videos did end up on the pycon2008 youtube channel... but lots seem to be missing, too. I hope this year's talks will actually end up online!

pycon talk page

by wiswaud on 29 March 2009
Tags: chicago, django, english, geeky, pycon, python

Comments

Share this page
| More

follow me on Twitter