2007-08-08

Getting back into importlib hacking

I have taken a great deal of time off from working on importlib. Part of the break was from moving and personal life stuff. Other stuff was working on getting failing tests passing in the py3k-struni branch so that Python 3.0a1 could get out the door (the list is getting rather short and down to stuff that need specific people to address, e.g., the email SIG to deal with the email package and the new bytes type).

But, now that I have fixed what tests I could for Py3K, the move is done, and the personal stuff is not as bad as it was, I can now turn my attention back to importlib. I have already isolated all external dependencies that the code has for bootstrapping purposes. Most of it is just stuff that no one has bothered to expose before. And for everything else I think I figured out what has to be done.

But bootstrapping is on hold while I rewrite zipimport. Since this module needs to continue to work and I plan to rip out the C code it relies upon I figured I should rewrite it in pure Python source code. I am also writing my own unit test suite as the zipimport tests do not test individual methods on zipimport.zipimporter instances and thus prevents me from doing testing on a gradual basis.

So far so good. Doing it the stupid way (i.e., simple but inefficient) is making it go quickly. I am coming up to the point, though, where I am going to need to take a serious look of what PEP 302 asks of importers and what my handler interface asks and see if there is any overlap (the handler interface is the API I have importers implement so that importlib handles the whole py/pyc dance but leaves the backend storage details to the importer). I am pretty sure there is not, but maybe I will get lucky (I doubt it as I suspect I did that the first time I designed the API).

But even if the API changes after I get importlib bootstrapping that is no big deal as it is not going to be exposed until I at least write a sqlite-based importer that uses the handler API to make sure the strategy I came up with makes sense (and I bet it can be improved).