-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add a bundle for Jython #4801
Comments
I think it matches the category "extensionservice". It might even make sense to implement exactly that: An extensionservice (eclipse marketplace is such one) for additional JSR223 providers. Another one or the same could be used to provide additional JSR223 libraries for users.
It doesn't need to restart if we include the target directories to the classpath, does it? If you for example download into the addons directory, you do not need a restart for example. |
Thank you for replying! I've been working on #519, but have spent most of the day trying to get a working IDE to debug it. I plan to work in this next. The OP was just thoughts/notes, mainly to show the intent and see if anyone would want to be involved.
Category... is that the official term I've been looking for!? 😄 For now, I'm only planning on the Jython and Groovy jars. Helper libraries make sense as separate bundles, to leave the option available for someone to use their own, and so that more than one set could be made available. Although, my plan is to move much of this functionality into an API that can be used by any JSR223 language. I'll take a look at the Marketplace bundle to see if it could be used as a temple.
Currently, we are using EXTRA_JAVA_OPTS to add Jython to the classpath, which requires a restart. Is /addoins/ in the classpath? That may get Jython into the classpath, but home and path will also need to be set so that Jython knows where to find the libraries. IDK if that can be done on the fly, but hopefully a helpful Java dev can help with that, before I start digging into it. |
... w/ core and custom helper libraries! Requires openhab#1251. Fixes https://github.com/openhab/openhab2-addons/issues/4801. This dramatically simplifies the installation of Jython and the Jython core and community helper libraries. Questions: * Should this project go into OHC or openhab2-addons? My preference is to keep all automation in OHC and eventually split it out into another repo. * Is the copyOnWriteArray needed in ScriptModuleTyeProvider? I don't think so. * I've unrolled the Jython jar. Is there and issue with the NOTICE file? I first used Jython 2.7.2b2, but it no longer works with recent builds of OH (works with S1749 though). See openhab#1252. I have another PR that makes a custom NashornScriptEngineFactory, but I'll wait for that one until the decisions have been made for this one. If custom ScriptEngineFactories or to go into openhab2-addons, then NashornScriptEngineFqactory should be moved there too, which will be difficult to have it load by default. Signed-off-by: Scott Rushworth <openhab@5iver.com>
... w/ core and custom helper libraries! Requires openhab#1251. Fixes https://github.com/openhab/openhab2-addons/issues/4801. This dramatically simplifies the installation of Jython and the Jython core and community helper libraries. Questions: * Should this project go into OHC or openhab2-addons? My preference is to keep all automation in OHC and eventually split it out into another repo. * Is the copyOnWriteArray needed in ScriptModuleTyeProvider? I don't think so. * I've unrolled the Jython jar. Is there and issue with the NOTICE file? I first used Jython 2.7.2b2, but it no longer works with recent builds of OH (works with S1749 though). See openhab#1252. I was seeing the same error with 2.7.1, so this bundle uses 2.7.0. I have another PR that makes a custom NashornScriptEngineFactory, but I'll wait for that one until the decisions have been made for this one. If custom ScriptEngineFactories or to go into openhab2-addons, then NashornScriptEngineFqactory should be moved there too, which will be difficult to have it load by default. Signed-off-by: Scott Rushworth <openhab@5iver.com>
... w/ core and custom helper libraries! Requires openhab#1251. Fixes https://github.com/openhab/openhab2-addons/issues/4801. This dramatically simplifies the installation of Jython and the Jython core and community helper libraries. Questions: * Should this project go into OHC or openhab2-addons? My preference is to keep all automation in OHC and eventually split it out into another repo. * Is the copyOnWriteArray needed in ScriptModuleTyeProvider? I don't think so. * I've unrolled the Jython jar. Is there and issue with the NOTICE file? I first used Jython 2.7.2b2, but it no longer works with recent builds of OH (works with S1749 though). See openhab#1252. I was seeing the same error with 2.7.1, so this bundle uses 2.7.0. I have another PR that makes a custom NashornScriptEngineFactory, but I'll wait for that one until the decisions have been made for this one. If custom ScriptEngineFactories or to go into openhab2-addons, then NashornScriptEngineFqactory should be moved there too, which will be difficult to have it load by default. Signed-off-by: Scott Rushworth <openhab@5iver.com>
Me too, but even better, let's get them into 2.5.x by merging #7208 and #7210 for inclusion in 2.5.11. It would then be very easy to add them into OH3. As I have communicated several times in the forum, I will be providing add-ons for Jython. These are currently available in the Eclipse IoT Marketplace for 2.5.x. I plan to finalize them and add some posts in the forum, hopefully this weekend. In hindsight, I should have added them to the marketplace a year ago, before submitting my PRs, but I had faith that they would be merged into OH. People could have been using them for over a year now. After all of the effort I have put into automation, I've been burned and I have learned my lesson. I have also communicated several times that once the 2.5.x add-ons are complete, I will provide OH3 versions the the Jython, Jython helper libraries, and Jython TransformationService. The ports themselves did not take much effort at all. As you are probably aware, there are already at least a couple OH3 Jython add-ons already floating around. However, the automation code is very fragile. With all of the recent PRs, the update to jdk11, and the lack of a maintainer to provide oversight, I have doubts that everything will work as it did in OH2. The additional testing alone will take quite a bit of effort, especially since I would be the one supporting it on the front lines. Also in the works, I have created add-ons for jRuby, Groovy, Kotlin, Scala, and the JavaScript helper libraries (which have been updated to be more aligned with the Jython HLs). |
Both those PRs are not in a mergeable state (and even closed), so I very much hope you didn't wait until now for them to be merged. Your work seems to focus around writing rules in those languages (and thus also require helper libraries). @wborn Since you did the Groovy add-on, would you also be able to provide a Jython script engine add-on that we could still squeeze into 3.0? Once the "full scripted rule support" work of @5iver is created, tested and stable, this can then be targeted for 3.1. |
closed, as related PR was merged |
In order to be used with JSR223, a user needs to install Jython, add it to the classpath, and tell Java where to find the libraries. This is documented here. We should add a bundle that will install Jython for the user. Most people that had issues with the install had trouble configuring the EXTRA_JAVA_OPTS.
Questions:
OPENHAB_CONF/automation/jython/jython-standalone-2.7.0.jar
home=OPENHAB_CONF/automation/jython
path=OPENHAB_CONF/automation/lib/python.
This will work with the current helper libraries, but if we want to change these, now would be the time.
The text was updated successfully, but these errors were encountered: