You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make PythonScriptRunner logic less tightly coupled
Now, if there is any java.util.function.Function named
PythonScriptRunner in the ObjectService, we try to use its apply
function, rather than requiring the runner to be of a special type.
In this way, the scyjava library can gain a new function
enable_python_scripting(context) that injects such a function
(implemented on the Python side via @JImplements, of course, in the same
way that the PythonScriptRunner was with the previous design iteration),
without needing to guard against the possibility that scripting-python
is unavailable at runtime when the @JImplements decorator executes;
the only class needed (Function) is part of the Java standard library.
Python scripts wanting to launch a Java capable of making use of
this PythonScriptEngine should now perform the following steps:
1. Put scripting-python on the classpath, either via the
org.scijava:scripting-python Maven coordinate string in an endpoint,
or locally via scyjava.config.add_classpath;
2. Construct a SciJava context; and
3. Invoke the scyjava.enable_scijava_scripting(context) function.
After which point, using the context's ScriptService to execute Python
scripts should start working! \^_^/
0 commit comments