Blog post: How to develop ImageJ Java plugins and Jythons scripts simultaneously from your IDE - GitHub - haesleinhuepf/run_jython_scripts_from_ide: Blog post: How to develop ImageJ Java plugins an...
@haesleinhuepf @imagejan @ctrueden @frauzufall @albertcardona
We just did a whole morning of very constructive jython hacking and it was a lot of fun and everybody learned a lot. However, in the end people were afraid that jython is maybe not really the way to go, because it is not very well supported (e.g. still python version < 3 ). What would be your general advice on this? Maybe actually rather use Groovy?
We just did a whole morning of very constructive jython hacking and it was a lot of fun and everybody learned a lot. However, in the end people were afraid that jython is maybe not really the way to go, because it is not very well supported (e.g. still python version < 3 ). What would be your general advice on this? Maybe actually rather use Groovy?
While the new (and the old) Script Editor lack auto-completion, I hear that IDEs like pycharm and eclipse can do auto-completion. Building auto-completion for python is hard. For jython, perhaps it is easier when attempting auto-completion on java classes imported within the jython file. Should be easy to hack together, but may end up being not satisfying.
Which leads me to another ending thought: if you are building code for others to use, you should use java, or at least package it all into a jar and distribute via an update site. If you use code for yourself or maybe for another lab member who knows e.g. python, then jython (or the scripting language of choice ) will do great.
The sensible thing to do would be to ask upstream. But the quality of support from the key Jython people is not very good, so you might not get an answer: I was on the jython mailing list and IRC channel for a long time, and the activity on those channels was extremely low. However, I know that Jython has/had corporate sponsorship, and that people were working updating to Python 3 for many years, but the Jython 3 git repository looks dead/dormant now for a couple of years.
I have a half-baked python autocompletion system created, based exclusively on parsing the jython source text. It has limitations, e.g. function arguments and their return types, that could be autocompleted for method names using the above approach (not yet done). In any case, the question is where to place such a file?
Hi @ctrueden, the autocompletion for jython is self-contained (and rather simple and limited). If I put it in scijava/scripting-jython, how do I use it from scijava/script-editor without a compile-time dependency?
This is the final release of the 2.7.0 version of Jython. Along with language and runtime compatibility with CPython 2.7.0, Jython 2.7 provides substantial support of the Python ecosystem. This includes built-in support of pip/setuptools (you can use with bin/pip) and a native launcher for Windows (bin/jython.exe), with the implication that you can finally install Jython scripts on Windows.
jython.exe is actually the Jython launcher; the real Jython we use is seen in the output of jython --print; it is org.python.util.jython, plus a bunch of other options. But we need an exe so that pip and other tooling can work. On Windows (or on other OSes if profiling for example is turned on), the launcher uses subprocess to invoke the Java executable. This subprocess invocation is in line 435 of jython.py.
Yes, that's jython.py. It actually uses CPython 2.7 (thanks for being around CPython, we like you!), and is wrapped into an executable by PyInstaller. The whole thing about "Z:\jythondev\jython27\src\shell\build\jython\out00-PYZ.pyz\subprocess",is due to the fact that I built jython.exe on my Z: drive, onto which my install of Windows 8.1 on VMWare has mapped my OS X homedir. (Yes, I'm completely responsible for this build.) Next, out00-PYZ.pyz refers to some internal scheme used by PyInstaller.
we have some steps to get the command line,
After the installation is complete, invoke jython.exe from the bin directory inside the destination directory. Assuming that Jython is installed in C:\jython27, execute the following from the [command line](Jython - Installation - Tutorialspoint. A Python prompt (>>>) will appear, in front of which any Python statement or Python script can be executed.
When a module is imported for the first time, Jython will compile it to Java code. If there is a module named myModule.py, Jython will create a file called myModule$py.class. The next time the module is imported, the jython interpreter uses the .class file instead of the .py file, even if this .py file was modified.
Now that I have javascript working and talking to the emulator pod of my MSP430, I need to get jython working, as we will be writing our test scripts in python. I have downloaded and installed jython and gotten it to do the equivalent of "hello world". I modified the startup script I used to get javascript running so it should pass all the right environmental stuff to jython, but I am having trouble importing the necessary jar files to support the emulator.
I am no expert in python/jython (maybe someone can chime in with intrinsic details about the include packages), but since you are using cygwin I recall having several problems with paths that seemed to be valid in but in fact failed miserably: paths with spaces and backslashes not being properly recognized, environment variables that started with the drive letter (C:\ or D:\) not properly converted to the cygwin environment, the absence of the environment variable cygpath in the Windows realm, etc.
Once Jython is done building you will then have a working buildthat can be run in-place from ./dist/bin/jython.There is normally no need to install your built copy of Jython.The interpreter will adapt to the environment it is being run fromand use the files found in the working copy.
One can also configure a special processing plugin (ch.systemsx.cisd.openbis.dss.generic.server.plugins.jython.ReportingBasedProcessingPlugin) which uses a reporting script instead of processing script. The reporting script's task is as usual - to describe contents of a table. The processing plugin will then convert the generated table to a text form and send it in an email as an attachment. This feature facilitates code reuse - one can write one script and use it for both reporting and processing plugins.
760c119bf3