[Python-Dev] Looking for authoritative documentation on packages, import & ihooks

Carlos Ribeiro carribeiro at gmail.com
Tue Nov 16 13:13:29 CET 2004


I have posted this question on c.l.py yesterday but received no
answers. Given the complexity of the theme, I hope that people will
not mind if I ask it here.

I am looking for information on packages & import hooks, including
simple examples on how to implement a simple import hook. Quick
googling turns out some documents, such as:

-- PEP 302:
   http://www.python.org/peps/pep-0302.html

-- What's new on Python 2.3:
   http://www.python.org/doc/2.3.4/whatsnew/section-pep302.html

-- Import SIG:
   http://www.python.org/sigs/import-sig/

-- PyDoc for the ihooks module:
   http://pydoc.org/2.3/ihooks.html

However, after reading them, I ended up more confused than before.
There are lots of references to the ihooks standard module, but there
is no documentation about it on the standard Python docs. The "Modules
That Needs Docs" Wiki entry
(http://www.python.org/moin/ModulesThatNeedDocs) lists ihooks and
imputils, but noone has volunteered to do it yet (worse, not even a
bug report was filled; this is something that I'm going to do).
Packages are also not documented (there is still a reference to an
essay from 1.5 days on the Python 2.3 docs).

For what I could see, the import system went over several iterations
and patches since the 1.5 release (when packages were added). It's now
hard to understand what is the preferred hooking mechanism as far as
Python 2.4 (and future versions) are concerned. For example: it is not
clear, from a simple reading, if PEP 302 is up-to-date, or if it is
considered the preferred approach for import hooks. For this reason, I
would like to know if there is any document which may be considered
"authoritative" for the import system (besides ihooks.py and
import.c). If *all* that exists is the source code, well, I guess I'll
have to read it. But anyway... pointers to simple examples also are
helpful. Thanks in advance.

--
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: carribeiro at gmail.com
mail: carribeiro at yahoo.com


More information about the Python-Dev mailing list