Re: [Zope3-dev] Re: [Zope-dev] Re: More arguments for "z" (was Re: Zope and zope)
On Thursday 15 April 2004 11:39, Casey Duncan wrote:
Additionally (and Jim and I have discussed this amongst ourselves) I feel strongly that the dependancies should be enforced by tests. That is, if you introduce and errant dependancy (by adding an import to a new package not in the stdlib or DEPENDANCIES.cfg) that it break a dependancy test.
I think this can be easily done using the finddeps.py utility. I think the hard work of finding all the dependencies in the first place is done. Note that Zope can also have dependencies in its ZCML files (which is handled by finddeps.py). Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training
Stephan Richter wrote:
On Thursday 15 April 2004 11:39, Casey Duncan wrote:
Additionally (and Jim and I have discussed this amongst ourselves) I feel strongly that the dependancies should be enforced by tests. That is, if you introduce and errant dependancy (by adding an import to a new package not in the stdlib or DEPENDANCIES.cfg) that it break a dependancy test.
I think this can be easily done using the finddeps.py utility. I think the hard work of finding all the dependencies in the first place is done. Note that Zope can also have dependencies in its ZCML files (which is handled by finddeps.py).
Note that for checking dependencies in Python code I still think this tool could be improved by using technology from importchecker.py http://cvs.zope.org/Zope3/utilities/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. If somebody lets me know which API they want implemented for retrieving imports (and use of imports) I could do this lifting work myself. Regards, Martijn
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
http://cvs.zope.org/Zope3/utilities/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.
If somebody lets me know which API they want implemented for retrieving imports (and use of imports) I could do this lifting work myself.
Fred has fixed that a while ago already (if I read the checkins correctly). :-) Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training
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
Fred Drake wrote:
On Thursday 15 April 2004 13:22, Martijn Faassen wrote:
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.
I'll try to find some time to take a look at it. Dependency checking is sort of a natural thing to use importchecker stuff for, but importchecker itself may need some refactoring. :)
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. ;-)
Right, I'd missed the transition to the tokenize based code, which probably is reasonably reliable. I did have objections to the regular expressions. :) Regards, Martijn
On Friday 16 April 2004 06:15 am, Martijn Faassen wrote:
I'll try to find some time to take a look at it. Dependency checking is sort of a natural thing to use importchecker stuff for, but importchecker itself may need some refactoring. :)
Actually, the confusion I was referring to was in finddeps.py, not importfinder.py. It was very difficult to follow the code.
Right, I'd missed the transition to the tokenize based code, which probably is reasonably reliable. I did have objections to the regular expressions. :)
I'm confident that the tokenize-based code finds everything; what it replaced did not. -Fred -- Fred L. Drake, Jr. <fred at zope.com> PythonLabs at Zope Corporation
Stephan Richter wrote:
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
http://cvs.zope.org/Zope3/utilities/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.
If somebody lets me know which API they want implemented for retrieving imports (and use of imports) I could do this lifting work myself.
Fred has fixed that a while ago already (if I read the checkins correctly). :-)
Well, perhaps I missed something. It changed to use the Python tokenizer, I think, if it wasn't doing this already. It doesn't use the compiler module, as importchecker does Anyway, I guess the tokenizer is fine too, and might even be faster for all I know, just seems an unfortunate duplication of work, plus I checked in importchecker for little reason. :) Regards, Martijn
On Thursday 15 April 2004 17:11, Martijn Faassen wrote:
Anyway, I guess the tokenizer is fine too, and might even be faster for all I know, just seems an unfortunate duplication of work, plus I checked in importchecker for little reason. :)
No, Fred was just a bit faster than me with improving finddeps. I think we definitely should abstract the import search functionality and put it in a lib. The importchecker for example should also look at ZCML to find possible usages of imports. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training
participants (3)
-
Fred Drake -
Martijn Faassen -
Stephan Richter