-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Status of JSR223 support #66
Comments
I think @forman can speak to that. Looking at the javadoc I see this:
|
Well, it's been long time ago... but I think @devinrsmith is right. The JSR 223 support hasn't been fully implemented yet. But I believe, this wouldn't be too much work. |
Hi folks, not sure if you have got any progress on this. During a night of insomnia (caused by the current heat wave), I managed to launch a JSR223 compliant JPy interpreter (tested with the standard jrunscript JDK tool) with hopefully minimal changes in the code base. Basically:
All in all, there must be less than 10 lines of difference with the official code base. You can review them at https://github.com/fabrice-ducos/jpy/tree/jsr223 In a separate branch https://github.com/fabrice-ducos/jpy/tree/jsr223-jpyinterp, I implemented a quick-and-dirty standalone JPy interpreter (jpyinterp.sh) based on jrunscript (a tool available in all JDK6+ installations, under $JAVA_HOME/bin). Since I do not master the way JPy configures its installation path, I had to look for Python and JPy native libraries in rather hackish ways. This is just for experimentation, so I preferred to keep it separate from the jsr223 branch. But it works on Linux and MacOSX (provided it is run from the jpy directory itself).
Tested successfully on:
|
Thanks for the work. I do have some concerns about the best way to initialize python. I see that the constructor of |
Hi Devin, thank you for your answer! I didn't touch Feel free to rearrange the code as you see fit, for the good of the project. |
After playing a bit more with the experimental jpyinterp.sh interpreter, it looks like there is a bit more work than expected. While pure Python statements seem to work, the jpy module (for interaction between the JVM and Python) seems to have issues. Here is a session borrowed from jpy 0.9.0 at https://jpy.readthedocs.io/en/latest/reference.html, and tested with the current version jpy 0.12.0
|
I've added a few commits on top of your branch, let me know what you think - see https://github.com/devinrsmith/jpy/tree/jsr223-jpyinterp. I think we could get the script engine changes merged soon if all looks good. |
Looks good for me! Just not sure about the rationale behind the While I am sure that you added it for a very good reason, maybe a short comment would be welcome for explaining its necessity? |
Mis-implemented double-checked locking patterns are pretty common - here's an article about it: https://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html. Arguably, could be fixed as part of it's own issue / PR, but I've just gone ahead and fixed it here. |
Thanks. Personally, I like to put a reference (under the form of a short comment, e.g. your reply in the former post, with the link) in the code itself (instead of a commit message) for this kind of clever implementation (not everyone is knowledgeable of these patterns). Of course, the link may become stale, but it is clear enough to be easy to find again (and to be updated) with a search engine. |
I've added an additional commit with inline comments; as well as improved the getScriptEngine call. |
Great! I think it's clear enough now. While looking at the I unearthed a commented piece of code:
Reenabling this snippet (as is, without change) does no good. Any chance that it be related with the issue on the
|
Can you link to the issue? I think the implementation of |
By linking to the issue, do you mean this ? |
Oh sorry, I thought you meant a different issue. The When running interactively via python, it looks like this:
|
Maybe Using Java from Scripts can help. |
Hi everyone, thumbs up for the great work.
I am wondering if JPy is currently JSR223 compliant.
The ScriptEngine and ScriptEngineFactory implementations seem to be there. But no JPy engine is detected by the ScriptEngineManager when one tries to load it (I know it, because I can detect many other script engines without problem).
When checking at the
jpy-0.10.0-SNAPSHOT.jar
content, there is no META-INF/services/javax.script.ScriptEngineFactory, required for detection by the ScriptEngineManager.Is it an oversight or on purpose?
The text was updated successfully, but these errors were encountered: