Trent Mick: python

March VanPyZ meeting tomorrow at ActiveState

The March VanPyZ meeting will be hosted at ActiveState this coming Tuesday evening (tomorrow!). I posted details on my work blog. We'll be trying out a slightly new thing: Lightning talks, a short 5 minute talk on whatever 1. The Lightning Talk format works so well at PyCon. See my work blog post for more details. See you there.

"VanPyZ" is the Vancouver Python user group.


  1. In my email to the VanPyZ list I promised a beer to whoever presents. :) Send me a one-liner on what you'd like to talk about. 

0 comments

PyCon 2010 wrap-ups

I'm back from PyCon 2010 in Atlanta (actually I've been back for almost two weeks now, but I'm a lazy writer). PyCon, as usual, was a great time. I wrote a long wrap-up on my work blog here:

A couple more personal additions...

Read more »
0 comments

updated Python Translation Party: fewer booms

I've updated Python Translation Party to recent versions of lib2to3 and lib3to2. I spoke with Joe Amenta at the PyCon 2010 poster session (he had a poster on his lib3to2 work) and he mentioned that the best thing I could do with Python Translation Party for him was to update to the latest. :) Updating to the latest is a little difficult because App Engine runs Python 2.5.2 and lib3to2 targets Python 2.7, so some small backporting was in order.

At the least, the new update results in fewer "booms"

Read more »
0 comments

other Python VM's upcoming Python version plans

Some quick notes about the coming plans by the "other" Python implementations from today's Python Language Summit at PyCon 2010:

  • IronPython:
    • plan is to do Python 2.7 first, focus for this year
    • python 3.2 for the end of next year hopefully
    • other work on IDE stuff
  • Pynie (i.e. Parrot) -- Allison Randall:
    • about 4 major features away from pure Python syntax (did dicts last night)
    • targetting py3k repo and test suite: should be on track for python 3.2
  • Jython:
    • plan to target 2.6 (b/c 2to3 depends on 2.6)
    • temporarily skip 2.7 and target 3.x (probably 3.2)
    • then if 3.x adoption isn't fully there, then go back and add Python 2.7
    • will require JDK 2.7 for Python 3 support (b/c of new support for dynamic languages)
  • PyPy (Holger):
    • plan is Benjamin will port to Python 2.7 in the summer
    • only have slight deviations from CPython: idea is to merge back with CPython so don't have deviations. Typcically 1 or 2 line changes in ~25 modules.
0 comments

Python Translation Party

or "Why Jesse Noller owes Trent Mick a beer"

Back at the Python Language Summit at PyCon 2009 we discussed the desire for a 3to2 tool for Python. 2to3 is a useful tool for helping with migration to Python 3 and getting a feel for Python 3. However, where we really want this Python 3 thing to go is for module developers to write for Python 3 and then have a tool that (ideally) makes the job of supporting a Python 2 version completely automatable.

In a GSOC project Joe Amenta, mentored by Benjamin Peterson, made that happen: lib3to2.

but this post is about fun

Soon after Joe's release, Jesse Noller posted to talk up 3to2 and said:

p.s. The first person to write an online 2to3 -> 3to2 app ala translation party gets mad props, and a bottle of something alcoholic at Pycon.

Game on.

Read more »
0 comments

February VanPyZ meeting at ActiveState on Tuesday

The February VanPyZ meeting will be hosted at ActiveState this coming Tuesday evening. I posted details on my work blog. Myself and Michael Grünewald will be speaking on recent ActiveState Code work and Brett Cannon will be speaking on his importers project. See you there.

"VanPyZ" is the Vancouver Python user group.

0 comments

VanPyZ meeting at ActiveState tomorrow (Tues)

We are hosting the December VanPyZ meeting at my work (ActiveState) tomorrow night. Details:

What

  • Jamu Kakar: How to use Storm with a focus on some common patterns to common problems.

  • Doug Latornell: PyYAML, flickrapi, and TkInter in a Desktop Image Display App.

Where

ActiveState
1700 - 409 Granville Street (SW corner of Granville and Hastings, map)
Buzzer# 1700

When

Tuesday, December 1st, at 7PM

"VanPyZ" is the Vancouver Python user group.

0 comments

How to install MySQL-python 1.2.3c1 on Mac OS X

Introduction

Just a quick note on getting MySQL-python (aka import MySQLdb) 1.2.3c1 (the current latest version) to build and install on Mac OS X, because I hit something that I didn't see mentioned in a number of similar posts.

Here are some links that discuss getting MySQL-python to build on Mac OS X:

What follows are the steps (slightly different) that I needed to get MySQL-python to install.

Read more »
3 comments

Komodo 5.1.3 released

We (ActiveState) released Komodo 5.1.3 today. Get it here:

Or, if you are currently running any previous Komodo 5, click "Help > Check for Updates...". This is a bug fix release and is recommended for all users. See below for details.

Read more »
6 comments

unladden swallow: a (potentially *much*) faster CPython

Discussed a bit at the Python Language Summit at PyCon this morning: unladen-swallow is a Google project to do a lot of performance work on CPython's VM.

  • Currently have about 30% speed up.
  • Currently for Python 2 (2.4, I think).
  • Currently focused on Linux and Python 3, but committed to get patches back to the core (which implies Python 3 support). "This is a branch, not a fork."
  • Currently in use on Youtube (where most of the frontend is Python).

They are shooting for a 5x speedup. From the ProjectPlan:

Our long-term proposal is to replace CPython's custom virtual machine with a JIT built on top of LLVM, while leaving the rest of the Python runtime relatively intact. We have observed that Python applications spend a large portion of their time in the main eval loop. In particular, even relatively minor changes to VM components such as opcode dispatch have a significant effect on Python application performance. We believe that compiling Python to machine code via LLVM's JIT engine will deliver large performance benefits.

Jesse has a good write-up.

2 comments

Komodo 5.1 released (fast open, history, hyperlinks, etc.)

We (ActiveState) released Komodo 5.1 today! Get it here:

Komodo IDE 5.1 is a free upgrade for Komodo IDE 5.x license holders. Your license entitles you to run Komodo IDE on any of the platforms we support (Windows, Mac OS X and Linux). Komodo Edit 5.1 is, as ever, open-source and free.

Read more »
26 comments

PyCon 2009

PyCon 2009: Chicago

I'll be attending PyCon this year. It's been a few years since I've attended and wow has it ever grown: 11 keynotes, 120 talks, 5 hours of lightning talks, the Python Language Summit, preceded by tutorial days and followed by days of sprints.

I'm looking forward to diving back into pure Python for a little while -- something I've had difficulty finding the time for with my work on Komodo. I'm especially looking forward to the "Package distribution & installation" session at the Python Language Summit, not the least of which is because ActiveState is starting to devote more resources to this area. My newest co-worker Sridhar Ratnakumar is currently looking at how ActiveState can help here.

2 comments

ActivePython 2.6.1.1 and 3.0.0.0 released!

All ActivePython downloads are also available here.

Python 3.0 was released last week and we've 1 managed to get ActivePython builds for all our platforms and give them a smoke test.

Now that Python 3.0 is final I'm really looking forward to seeing where Python 3 goes. I'm sure it will be (and feel like) a long transition from Python 2, but I think a year or two from now we'll look back at the rare Python 2 usage not miss it. The semantic changes involved in the str/unicode/bytes changes will be a royal pain, but this had to be done and the long term benefits of sane Unicode handling will be huge.


  1. For the last few years I've been maintaining ActivePython myself. For these latest releases I'm happy to have Andreas Kupries helping out with ActivePython build engineering. 

3 comments

ActiveState Code: lauched!

We launched ActiveState Code today, and there was much rejoicing. Yaaaah!

ActiveState Code is a site for sharing code recipes. It is the replacement for the popular ASPN Cookbooks (especially the Python Cookbook, which was a collaboration with O'Reilly and Associates that resulted in two print cookbooks using recipes from the site). The new site adds things like tagging, the ability to add recipes in a number of other languages, and a fresher and hopefully more usable site.

Migration should be easy. All recipes from the Python, Tcl and PHP Cookbooks have been carried over. Redirects maintain all old aspn.activestate.com/ASPN/Cookbooks links. Recipe id and author ids have been maintained. The ASPN Cookbook categories have been translated into tags in the new system -- full details here.

I welcome any feedback on the site.

0 comments

Switching from ASPN Cookbooks to ActiveState Code today

We hope to be switching over from the ASPN Cookbooks to the new ActiveState Code site today. Please be patient if the site is down for a short while. We expect the process to take about an hour or two late this afternoon (PST).

I've had lots of good feedback from the Python community (Apologies if I haven't gotten back to you yet. I will.) and have made a number of changes based on that feedback. I'll post more details once the site has been switched over.

0 comments

ActivePython 2.5.2.2 and 2.4.5.14 released

Get it here: http://www.activestate.com/products/activepython/

After a hiatus while I worked hard on the Komodo 4.3 release with the Komodo crew here, I've finally had the chance to update ActivePython 2.5 and 2.4 to the latest.

Full details in the ActivePython release notes. These releases update the core to Python 2.5.2 and 2.4.5.

Enjoy.

0 comments

markdown2.py

I've started a python-markdown2 project: this is another Python implementation of Markdown:

Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).

No release package yet (setup.py, setuptools, easy_install, ez_setup? -- my head is spinning), but you can get the file directly from SVN: markdown2.py.

This is the first project for which I am really using Google Code project hosting. I'm really digging it. Nice bug tracker, nice enough wiki (all wikis should use a source control system as their backend), svn. Goodbye sourceforge.

6 comments

html5lib rocks (and a patch to preserve attribute order)

I've been playing with the Python html5lib package -- having come across it reading Sam Ruby's blog. What a fantastically useful library!

Originally my interest in it was with the discussion surrounding santization, and I expect to use it for that later, but today I've been playing with some general parse/filter/serialize code to support some preprocessing of HTML documentation for Open Komodo.

My code looks like this:

import sys
from html5lib import treebuilders, treewalkers
from html5lib.serializer.xhtmlserializer import XHTMLSerializer

def filter_play(path):
    p = html5lib.XHTMLParser(tree=treebuilders.getTreeBuilder("simpletree"))
    f = open(path)
    dom = p.parse(f)

    walker = treewalkers.getTreeWalker("simpletree")
    stream = walker(dom)
    #stream = MyPreprocessingFilter()

    s = XHTMLSerializer()
    outputter = s.serialize(stream)

    for item in outputter:
        sys.stdout.write(item)

filter_play(sys.argv[1])

One thing that bugged me a little with the output generated with this is that attributes on HTML elements get sorted, i.e. their order is not preserved. While totally cool for correctness, this reduces the utility of using diff or similar for comparing input with output. As well, I work on the Komodo IDE/editor and would like to consider using html5lib for an HTML reflow/beautifier feature at some point. Preserving attribute order for this will be important.

To that end, here is a small patch that adds the ability to preserve attribute order in serialized output. To use it:

  1. You need odict.py.
  2. You need to change the above code to:

    ...
    s = XHTMLSerializer(preserve_attr_order=True)
    ...
    

Obviously this isn't something that would be ready to check-in to html5lib. Reasons why:

  • It only works for the "simpletree" treebuilder/treewalker. I'm not sure if it is feasible/practical to get it to work with some of the others (e.g. dom).
  • It unconditionally requires an external non-standard module (odict.py).
  • It should be optional on the parser because (a) using OrderedDict instead of dict would presumably have an undesired perf impact and (b) the attribute order normalization could be desirable for many users.

Maybe a better solution would be a custom "roundtriptree" tree type? Anyway, just throwing this up here to perhaps come back to later. I have to dig into the html5lib discussion list to see if this has come up before.

0 comments

Komodo Planet and Yahoo Pipes

I played a bit with Yahoo's new Pipes web app. At ActiveState we have a number of blogs where many of us write about what interesting things we are working on. A number of those posts are about Komodo. As well, with the recent 4.0 release, Komodo has started popping up on blogs more and more -- in particular, the very cool "Komodo Hacks" series from Brandon.

So, without further ado, I give you the Komodo Planet Pipe.

Let me know if there are other blogs I should add to this. Currently it just filters on posting titles matching "Komodo". I tried to also include filtering on the posting content but Yahoo Pipes kept giving me (unhelpful) errors with that. I like the idea of Pipes, but overall I found the current experience to be too unresponsive to be pleasing.

0 comments

ActivePython 2.4.3.12 is released (Windows-only bugfix)

ActivePython 2.4.3.12 was just released to fix a problem with how PATHEXT is set on Windows. From the release notes:

  • [Windows] Fix a bug that results in ".pyo" and ".pyc" being placed on the PATHEXT environment variable before ".py" for clean installs. Bug 33311. This can cause surprises for command-line usage for Python scripts when not specifying the ".py" extension. The new installer will fix PATHEXT on machines that hit this bug.

See this python-list thread for more details.

The release notes are here and the announcements should be hitting the lists soon.

0 comments