2008-01-30

The Python-Dev bundle for TextMate has started (on my laptop)

I have been relaxing as of late by messing about with TextMate. Beyond writing up a personal FAQ on TextMate (which will go up on my vaporware personal web site that I will start working on once importlib and the stdlib reorg are done), I have started a Python-Dev bundle.

So far I have only done commands I know I have use for. Relying on the assumption that if you are hacking on a checkout of Python you are using a project for the checkout, I have a command to build Python. It doesn't do any more right now than to execute ``make -s`` and pipe the output to an HTML window, but that is enough to handle the compile part of the code-compile-debug cycle of C. It would be great if I could go as far as hyperlink gcc's output so that I could just click on any build errors or warnings from a build to easily fix them. Anyone know if a pre-existing bundle that has this kind of support? Would be really cool to have the raw output put into the HTML window and when the output is done hide it from view while still being able to get to it later. Any warnings or errors could then be listed and thus be obvious that something occurred. It might be as simple as checking for lines that contain a file path (which would be as simple as splitting on words, checking for a leading /, and then verifying the path exists).

I also have a command to build the docs. Once again it does nothing more than run ``make html`` and pipe the output to an HTML window. It is completely Leopard-only as I didn't worry about people specifying an interpreter that is Python 2.5 or higher. I really doubt that much more is needed for this command.

The rest of the commands I have done are about opening things in the web browser. The easiest one was having a command to open issues. Opening PEPs was a little trickier as the number needs to be padded to 4 digits. Luckily bash's printf command has a padding option. Even better, for %d, if the argument is not a number it is considered 0, which leads to the PEP index. =) Dumb luck is on my side for that one.

The last one I am the most proud of, though. When I am hacking on a checkout I am constantly checking the in-development docs for stuff. I do this often enough that I try to keep them built on my local machine (all thanks to Georg and doctools). So I have a command that looks for the HTML index file for the docs if you are in a project. This has the perk of supporting Py3K if you are working on such a checkout and thus making the command not 2.x-specific. If the index file doesn't exist in the project it checks for an environment variable so that if you are just hacking on a single file you don't have to launch a project to view the docs. And if those two options don't work, it goes to the online in-development docs.

I plan to add this to Python's trunk at some point. I am not rushing to do this as I really don't know if anyone is going to use this other than me. =) I am also trying to prevent myself from going overboard on all of this until I actually get back around to doing some Python work (I am currently working on my PyCon slides first). That way I only add things that I will actually use and just toss in features that are not worth the effort in supporting.