Skip to content
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

OSGI-ify GraalPython dependencies #58

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ccutrer
Copy link
Contributor

@ccutrer ccutrer commented Feb 6, 2025

I intend to use GraalPython for direct usage of Python's implementation of jinja for the jinja transform and the MQTT Home Assistant binding, since Jinjava has significant compatibility issues. BUT... no need to load multiple versions of GraalPython between those two addons, and especially the upcoming pythonscripting addon based on Graal.

Note that GraalPython requires Java 21, so I had to update the build to use Java 21.

I intend to use GraalPython for direct usage of Python's implementation
of jinja for the jinja transform and the MQTT Home Assistant binding,
since Jinjava has significant compatibility issues. BUT... no need to
load multiple versions of GraalPython between those two addons, and
especially the upcoming pythonscripting addon based on Graal.

Signed-off-by: Cody Cutrer <[email protected]>
@ccutrer ccutrer force-pushed the osgiify-graalpython branch from afa28b7 to db35b63 Compare February 6, 2025 17:08
@ccutrer
Copy link
Contributor Author

ccutrer commented Feb 6, 2025

@florian-h05: I'll admit I don't really know what I'm doing with the osgi.bnd files. I tried to add specific imports on other bundles that are compile time dependencies, and are OSGi-ified. But the naming seems odd to me (org.graalvm.truffle-api for example, instead of org.graalvm.truffle.truffle-api which is the artifact id), and for some of them it spat out a warning that the import was unused (in particular, the dependencies of org.graalvm.python.python-language) so I didn't list them. I'm also a little unsure if I need to do anything for org.graalvm.polyglot.python-community, which is a POM not a JAR - so I just included the downstream JARs of that (org.graalvm.python.python-community, which is also a POM, and thus org.graalvm.python.python-language and org.graalvm.python.python-resources).

I don't have time today, but I'll try to set up an actual add-on relying on these and installing it into my openHAB instance when I have some more time.

@HolgerHees
Copy link

HolgerHees commented Feb 6, 2025

Note that GraalPython requires Java 21, so I had to update the build to use Java 21.

Hi, my current graalpython bundle runs also fine with openhab 4.3.2 with java 17, except the problem related to the non OSGi-ified polyglot and truffle stuff.. openhab/openhab-addons#18054 (comment)

I'm using it currently in my own production environment running openhab 4.3.2, but with all other automation bundles disabled.

@florian-h05
Copy link
Contributor

@ccutrer See my answer in the other thread.

You can use the OSGi-ified GraalVM SDK and Truffle Runtime and Truffle Compiler as well as ICU4J dependencies by requiring their bundles im an *.bnd file (like done for my JS Scripting PR).
Make sure those are no part of your JAR, i.e. if you use Maven Shade Plugin exclude through its config, and if you don’t use Maven Shade, but instead normal dependencies without POM format, exclude the dependencies that are available through OSGi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants