June 11, 2008

Python-SpiderMonkey Resurrected

Yesterday I found John J. Lee’s old Python-SpiderMonkey code from 2003, which creates a bridge between the Python language and Mozilla’s SpiderMonkey JavaScript engine—the same engine that powers Firefox. Lee mentioned on his website that it’s not currently maintained, and after downloading it and trying to compile it, I found that SpiderMonkey had changed a bit since the code had been written, so I made some fixes and, after discussing things with him, set up a new Google Code project for it at http://code. ... Read more

June 6, 2008

Python for JavaScript Programmers

I couldn’t find anything on the web that attempted to teach Python to readers who already knew JavaScript, so I thought I’d give it a shot, since a number of my friends at Mozilla don’t know much about Python but know JavaScript incredibly well. The languages actually aren’t that dissimilar—in fact, some of JavaScript’s latest features have been borrowed directly from Python. Aside from focusing on differences and similarities between the two languages, I also try to explain Python’s design philosophy a bit, to give readers a context for why things work the way they do. ... Read more

June 1, 2008

Enso: A Progress Report

Since moving to Mozilla, I haven’t had a ton of time to work on Enso, the commercial product turned open-source project that I worked on at Humanized. One of the things I’ve been learning about at Mozilla, though, has been getting into the habit of writing about what I’m working on. We didn’t do this much at Humanized, at least not until the first few months of 2008 when we started designing openly. ... Read more

April 21, 2008

My Stuff, Open-Sourced

After hearing Chris McAvoy drunkenly wax poetic on how programmers should be more open with the stuff they write—McAvoy himself keeps a lot of his code in a public works repository on Google Code—I decided to work more openly too. So a month or two ago I set up a Mercurial repository at hg.toolness.com and have been regularly pushing a lot of my one-off projects to it. Most of the projects on there don’t mention anything about their license, though, and I’m not sure what to do about that. ... Read more

April 14, 2008

PyOhio

I just found out that my hometown of Columbus, Ohio, is holding a Python conference. This is really cool. I encourage anyone in the area who is interested in computer programming or knows anyone who is to spread the word about this. Aside from being a really fun and easy language to learn and use—it’s simple enough to be taught to children—it’s also powerful enough to be widely used in the industry (for instance, it’s the flagship language of the recently-released Google App Engine). ... Read more

March 16, 2008

Python as a Platform

Something that recently occurred to me is that the only operating system that doesn’t come with Python pre-installed on it is Windows.

While Linux and OS X both view Python as essentially a first-class development platform–i.e., as something that shrink-wrap applications can be built on–Windows does not. Instead, it’s generally expected that a Python-based Windows application be “frozen”: bundled into a self-contained package that includes a copy of the Python interpreter and whatever libraries it uses, which are private to the particular application. While this ensures that the application will function as expected and not run into “dependency hell”, it also results in a relatively large download–distributing a simple “Hello World” program is at least a megabyte in size, and makes extending the program’s functionality more difficult.

During the summer of 2007, I made simple Python-based tool for some friends who played World of Warcraft; for those that played on the Mac, the situation was easy because their computers already had Python on them. For the Windows users, however, I was faced with the dilemma of either “freezing” the program into a fairly large download which would be difficult to test and update, or making my friends download the Python installer from python.org and running my Python script from source. Either solution seemed too cumbersome.

So instead, I opted for a different solution: I’d create a tiny executable that would first check for the existence of a Python installation on the end-user’s system. If Python was already installed, the executable would simply extract a Python script from itself and run it. That script was much like ez_setup.py; along with a few tricks, it essentially ensured that my friends would transparently auto-update to the latest version of the tool whenever they launched the program.

If there was no Python installation on the end-user’s system, however, the executable would simply transparently download the latest Python installer from python.org, silently install it on the end-user’s system without any prompting, and then proceed as outlined above.

So, in other words, a small executable file–only about 50k in size–was essentially responsible for “bootstrapping” my program by downloading and silently installing Python if necessary, and then downloading and running the latest version of my program’s source code. This ultimately meant that the user would be able to run a self-updating Python program from a tiny executable without having to click through any installation prompts or dialog boxes.

I’m glossing over a few details here and there are definitely some holes in my implementation–for instance, if the user uses a web proxy, they’re hosed–but I thought the general idea was interesting.

The source for the executable was compiled using the Nullsoft Scriptable Install System, along with its InetLoad plug-in. The source file is below for those interested.

... Read more

January 11, 2008

Pickle Presentation Slides

At yesterday’s Chicago Python User Group (ChiPy) meeting, I gave a presentation on the Python pickle module; I’d always been curious in the internals of how serialization works “under the hood” and wanted to learn enough about it to give a talk that was accessible to Python newcomers and veterans alike. I’d like to thank Robert Zeh of GETCO for hosting the meeting, and everyone for attending–we had a great turnout. ... Read more

April 13, 2007

PyPy Presentation Slides

At yesterday’s Chicago Python User Group (ChiPy) meeting, I gave an informal presentation on PyPy, a project that I’ve been interested in lately. I’ve posted the slides here as a PDF. Be warned, though, that PyPy is by no means my area of expertise, so these slides may not be terribly accurate. I’ll be fixing them as I learn about their errors.

March 8, 2007

Humanized

In late 2005, three colleagues and I founded a company called Humanized. A little over a month ago, we released our first two products, Enso Launcher and Enso Words. I’m indebted to my incredible co-workers, Jono DiCarlo, Aza Raskin, and Andrew Wilson, for making this possible. Working at Humanized has certainly been the best job I’ve ever had, not to mention an excellent learning experience. Naz Hamid was also instrumental in providing us with superb graphic design and was very helpful as a business mentor in general. ... Read more

March 8, 2007

Python Emacs Development

Back in 2005, while I was taking a class taught by the late Jef Raskin at the University of Chicago, I was inspired by his program The Humane Environment to write some Emacs commands that would make software development a little easier for myself. Based on some interest from the Chicago Python User Group, I’ve polished the code a bit and published it here. Read more about pymdev, A Python Emacs Development Module. ... Read more

© Atul Varma 2021