Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

questions / sugestions on jython

2006-06-29
2013-03-15
  • Hi,

    I'm writing this from the perspective of someone trying out pydev and pydev extensions in a java/jython project that uses a lot of java libraries.

    I wasn't able to use code completion. I'm not sure if it is supposed to work in this case or not :

    mainFrame = JFrame()
    mainFrame.

    when I press ctrl+space, nothing happens, I noticed it works on normal python code. autocomplete for parameters also doesn't work. an usefull feature that also doesn't work is pression F3 over a java class in jython code.

    So I'm not sure if these are questions or suggestions, perhaps I just don't know how to configure this behaviour

    Another aspect where I found pydev a bit lacking (for our particular purpose) was the fact that it doesn't easily support mixed java/jython projects. I acomplished this by hand-editing eclipse project .xml files and manually adding the respective natures.

    thanks,
    Ricardo

     
    • Fabio Zadrozny
      Fabio Zadrozny
      2006-06-29

      Hi Ricardo,

      1. Well, that case should surely work in code-completion. Please report a bug for it.

      2. Pressing F3 over a java class in jython code would be a feature-request.

      3. It does accept mixed java/jython projects... Just create it as a java project and then open any python file in that project. The python nature will be automatically added and you'll be able to edit it to jython and set the pythonpath.

      Cheers,

      Fabio

       
      • Hi
        The project does receive the python nature, and I am able to configure it as a jython project. However, the pydev specific entries in the project properties are only visible when in the pydev perspective.
        I'm not sure that's a good decision from a interface point of view, because it's a dual-language project, I think all option should be always available.

        But what really is annoying is the fact that pydev doesn't inherit the java classpath of the project. so, I add a python script to a java project, but can't import the java classes of the project. From a jython user's point of view, I'd say this is the worst bug/lack of feature of pydev at the moment.

        Is there a workaround for this ? I'm working on a java project that already has thousands of files, and I'm trying to write some of the new stuff in jython, but I'm having trouble referencing the java code from jython

        thanks,
        Ricardo

         
        • Fabio Zadrozny
          Fabio Zadrozny
          2006-09-12

          Actually that's not entirely true, the pydev project properties are actually shown in all places BUT the package explorer, because the package explorer will only show java information... if instead of right-clicking in the package explorer and go to the menu: project > properties, all the info should appear.

          As for the java information, you're right, it does not inherit the classpath information from a java project... maybe there could be an option to get that option to be added to the jython plugin (please add a feature request for that).

          There's no current workaround... you have to enter the information twice, one for the java project and another for the pydev project... so you have to add the folder that has the output for the classes in the pythonpath for the project.

          Cheers,

          Fabio

           
          • Hi,

            Thanks for your answer. There is already a feature request #1514992 for this issue.

            As for manually adding, it can become difficult to manage. In one of our projects, we have about 10 eclipse projects, with dependencies among them, exporting jars, etc..., so I think the only proper way to do it would be to inherit tha project's classpath to the pythonpath.

            Please note that if I start the jython script from java via the interpreter class, it works fine.

            As a workaround, we add a jar file with all our libraries and java code for the pythonpath, but it's suboptimal, since any java change requires rebuilding the jar for python to see it

             
    • ok, I've create the feature request. I'll double check the bug before posting the bug report.

      as for #3, it's a cool functionality, but it isn't obvious. perhaps an option to "add java nature" to python projects, and vice-versa, if it isn't there is more obvious.

       
      • Fabio Zadrozny
        Fabio Zadrozny
        2006-06-29

        Hi,

        Can you add that as a feature-request too? -- the forum is not a good place for keeping those ideas ;-)

        Cheers,

        Fabio