-
Notifications
You must be signed in to change notification settings - Fork 42
ST6RI-823 Support extending Jupyter integration with additional magic commands #649
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
Conversation
This commit adds a service registration based mechanism that can be used to register additional magic commands to the system. Furthermore, to allow these commands to add new items to the built-in help system, and appropriate extension method was added to SysMLInteractiveHelp
- Added error handling for the command registrator interface - Added Javadoc to the registrator to clarify the expected contract of implementors
org.omg.sysml.interactive/src/org/omg/sysml/interactive/SysMLInteractiveHelp.java
Outdated
Show resolved
Hide resolved
I have never seen the word "Registrator" used before, but I looked it up, and it turns out it's a real thing. However, wouldn't "Registry" be the more common term to use in an Eclipse context? |
I think the Registry name would be misleading, as the role of the Registry (one who stores the separate entries) is handled by (1) the class The alternative I was thinking about was a |
OK, I see. The name "Registrator" does seem to make sense, as odd as it sounds! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The org.omg.sysml.jupyter.kernel/installKernel.sh
script no longer works. It ends with
--- Step 4: Installing kernel ---
python: can't open file '/Users/seidewitz/Documents/Work/git/SysML-v2-Pilot-Implementation/org.omg.sysml.jupyter.kernel/./target/kernel/install.py': [Errno 2] No such file or directory
The templating-maven-plugin, used to copy the resources into the target directory `kernel`, was causing the kernel zips recursively containing earlier builds as well, causing its size to balloon (mostly because maven considered a target folder as a source folder). However, simply removing broke clean builds, as the installer and other metadata were missing from the output folder. This commit uses the maven-resources-plugin to copy the required files to the installer, thus avoiding the original issue.
Thanks for pointing out this error; it was caused by me not running a clean build on my computer, so the output files were out as expected. I have pushed a fix. |
This PR introduces an alternative way to register new magic commands to the Jupyter kernel: one based on the Java ServiceLoader mechanism. This extension allows external users to define and register additional commands that can reuse the state of the Jupyter kernel without needing to recompile the existing codebase. New commands are to implement the
IMagicCommandRegistrator
interface and register the implementation to theServiceLoader
. After that, the JAR file(s) containing the extension(s) are to put next to the kernel binary in the installation.To handle these additional JAR files, the kernel descriptor file is updated not to rely on a specific JAR file but load all JAR files from the folder. This resulted in a simplification of the Jupyter kernel POM file, as it is no longer required to add the final JAR file name in the kernel descriptor.