[Zope3-dev], [Zope-dev] Import checking code

Fred Drake fred at zope.com
Thu Apr 15 13:46:55 EDT 2004


On Thursday 15 April 2004 13:22, Martijn Faassen wrote:
 > Note that for checking dependencies in Python code I still think this
 > tool could be improved by using technology from importchecker.py
...
 > which can use Python's compiler module to lift all imports from source
 > code, which I think is safer than the hand crafted parser approach
 > finddeps.py takes now.

I keep meaning to get back to you about this; sorry it's taken me so long.

I wrote the tokenize-based code before I saw your importchecker.py code; I'd 
decided to go with the tokenize module instead of the compiler package since 
the later was poorly documented (IMHO).  I've no really strong feeling about 
either approach being better.

 > If somebody lets me know which API they want implemented for retrieving
 > imports (and use of imports) I could do this lifting work myself.

I'm not sure simply re-implementing one of the finddeps.py internal interfaces 
is the right thing to do; that's some incredibly cludgey code in Zope 3.  
There's a lot of confusion about what values are paths and which are module 
names, and that makes me very uncomfortable.

If you'd like to replace the code that locates imports, feel free to do so.  
It may be that conciseness wins; the tokenize-based approach certainly ended 
up being more code than I'd expected initially.

On Thursday 15 April 2004 01:21 pm, Stephan Richter wrote:
 > Fred has fixed that a while ago already (if I read the checkins
 > correctly). :-)

No, Martijn's talking about something else... kinda.  I imagine he had even 
stronger feelings about your initial implementation.  ;-)


  -Fred

-- 
Fred L. Drake, Jr.  <fred at zope.com>
PythonLabs at Zope Corporation




More information about the Zope-Dev mailing list