Thread: [Pydev-code] Pydev scripting - imported modules not being compiled
Brought to you by:
fabioz
From: Don T. <nos...@gm...> - 2006-04-28 00:58:09
|
Fabio: I am developing a Pydev Jython script and am having some difficulty in getting imported modules to be recognized as having changed after editing. I have a module called pyedit_test.py that imports wrapper.py which in turn imports textwrap.py. All modules are in the same folder - the one named in my Scripting Pydev preference page. The problem is that Pydev only seems to recognize and reload changes to pyedit_test.py. So I changed wrapper and textwrap to pyedit_wrapper.py and pyedit_textwrap.py. Now Pydev says that it reloads these modules when they are changed. But when I run the code with ctrl-2+w it still seems to pick up the new version. Then I added reload() calls into pyedit_test.py and pyedit_wrapper.py. Still no good. Finally, I ran the imported modules as stand-alone __main__ programs, I heard my disk chatter as the compiler ran and after that Pydev did run the modified version when I hit ctrl-2+w. I am still wrestling with my code so at least some of this behaviour may be due to my own bugs, but I wonder if you have any thoughts about this. I may just mung everything together into one module for the time being. Don. PS. I tried setting a breakpoint in a Pydev Script but nothing happened - I presume that is to be expected. |
From: Fabio Z. <fa...@gm...> - 2006-04-28 01:38:07
|
Hi Don, I am developing a Pydev Jython script and am having some difficulty in > getting imported modules to be recognized as having changed after editing= . > > I have a module called pyedit_test.py that imports wrapper.py which in > turn imports textwrap.py. All modules are in the same folder - the one > named in my Scripting Pydev preference page. > > The problem is that Pydev only seems to recognize and reload changes to > pyedit_test.py. Yes, that's correct, it will only get the changes on the 'main' module. If you want to make changes on other modules, you'd have to restart the interpreter engine yourself: if True: #add some clausule to make the reload from org.python.pydev.jython import JythonPlugin #@UnresolvedImport editor.pyEditScripting.interpreter =3D JythonPlugin.newPythonInterprete= r (). Putting all in the same module would be another way of having it too...(or maybe you could script an action where you bind that -- maybe something suc= h as Ctrl+2+reload, where you call the code above). > PS. I tried setting a breakpoint in a Pydev Script but nothing happened > - I presume that is to be expected. Yes, there's no debugging on the scripting engine. Fabio |
From: Jeff W. <win...@gm...> - 2006-04-28 13:23:31
|
Hi Don, You might be interested in a technique - more of a design pattern than anything else- where if any python files change, unit tests are rerun. The code is http://jeffwinkler.blogspot.com/2006/04/keeping-your-nose-green.htm= l - I'm using nose which autodiscovers the tests. I doubt nose works under jython and python 2.1, but perhaps the pure python aspects of your code could be tested in nose under python. Having this constant feedback loop is great to know that everything is working OK, and you can avoid the debugger altogether, doing TDD. I've made a movie about it which will be at ShowMeDo soon. Jeff On 4/27/06, Don Taylor <nos...@gm...> wrote: > > Fabio: > > I am developing a Pydev Jython script and am having some difficulty in > getting imported modules to be recognized as having changed after editing= . > > I have a module called pyedit_test.py that imports wrapper.py which in > turn imports textwrap.py. All modules are in the same folder - the one > named in my Scripting Pydev preference page. |
From: Don T. <nos...@gm...> - 2006-04-28 13:47:34
|
Jeff Winkler wrote: > Hi Don, > You might be interested in a technique - more of a design pattern than > anything else- where if any python files change, unit tests are rerun. > The code is > http://jeffwinkler.blogspot.com/2006/04/keeping-your-nose-green.html - > I'm using nose which autodiscovers the tests. I doubt nose works under > jython and python 2.1, but perhaps the pure python aspects of your code > could be tested in nose under python. > Hi Jeff: Thanks for this, I will take a look at your nose for Python development. I don't think that it will solve my problem which is peculiar to using Jython scripts to extend Pydev itself. This issue is how to convince Pydev that some Jython script that it calls has changed 'underneath its feet'. In truth, it is stupid to be trying to develop a Jython script this way. It makes more sense to get everything working as an ordinary Jython script first and then plug the working script into Pydev. Now that I understand the environment a bit better I am going to away and turn mu brain back on. Don. |
From: Fabio Z. <fa...@gm...> - 2006-04-28 14:01:34
|
Hi Don, > In truth, it is stupid to be trying to develop a Jython script this way. > It makes more sense to get everything working as an ordinary Jython > script first and then plug the working script into Pydev. Now that I > understand the environment a bit better I am going to away and turn mu > brain back on. > > Don. > I totally agree with you. So, I've already started some testing environment -- there is currently no synching between the developer and the non-developer cvs. I just saw the sf site status ( http://sourceforge.net/docs/a04) and it appears that it will be available shortly again. But the idea is that the Eclipse objects are Mocked, so that you can run your tests without actually having the whole Eclipse infrastructure. ALL th= e java tests already work that way, so that they don't need Eclipse running t= o run the tests, and I believe that the jython scripting should have the same structure. So, hopefully shortly the non-developers cvs will be up again, so, please remind me of pointing you how is it currently working (and to see if your requisites are covered by it). Cheers, Fabio |