Saturday, July 3, 2010

Timezones using Gae-Pytz

This is a short post about my good experiences moving from standard pytz to the gae-pytz library for Google App Engine. Pytz is the standard python library for defining timezone information. Gae-pytz is a version of pytz optimised for Google App Engine.

If you have read one of my previous posts about implementing timezone support in Google App Engine, you'll know I have used the full pytz library in the past. In addition to improved performance, gae-pytz offers a couple of key advantages in comparison to vanilla pytz:

  1. All timezone objects are packaged and deployed in a zip file. There are hundreds of timezone files in the normal pytz distribution, which makes the library particularly burdensome in the 1000-file maximum limit imposed by Google App Engine.
  2. Gae-pytz has built-in memcache caching of individual timezone objects.
My experience with implementing gae-pytz in my application was great. For the most part it is a drop in replacement with no changes to code required. I could actually remove all of the caching code I had put in place since the provided caching already provided the functionality. If you have previously built an application with pytz for app engine, check gae-pytz out. 

No comments:

Post a Comment