diff --git a/Integrations/src/main/java/io/deephaven/integrations/python/PythonDeephavenSession.java b/Integrations/src/main/java/io/deephaven/integrations/python/PythonDeephavenSession.java index f14f3459504..f8b69e9d0ae 100644 --- a/Integrations/src/main/java/io/deephaven/integrations/python/PythonDeephavenSession.java +++ b/Integrations/src/main/java/io/deephaven/integrations/python/PythonDeephavenSession.java @@ -57,8 +57,25 @@ public class PythonDeephavenSession extends AbstractScriptSession scope; private final PythonScriptSessionModule module; @@ -67,6 +84,10 @@ public class PythonDeephavenSession extends AbstractScriptSession + * Sets the configuration property {@value PYTHON_VERSION_PROPERTY} to the value returned from the python code + * {@code platform.python_version()}. + * * @param updateGraph the default update graph to install for the repl * @param operationInitializer the default operation initializer to install for the repl * @param objectTypeLookup the object type lookup @@ -96,16 +117,19 @@ public PythonDeephavenSession( registerJavaExecutor(threadInitializationFactory); publishInitial(); + + final Configuration configuration = Configuration.getInstance(); /* * And now the user-defined initialization scripts, if any. */ if (runInitScripts) { - String[] scripts = Configuration.getInstance().getProperty("PythonDeephavenSession.initScripts").split(","); + String[] scripts = configuration.getProperty("PythonDeephavenSession.initScripts").split(","); for (String script : scripts) { runScript(script); } } + setPythonVersion(configuration); } /** diff --git a/java-client/session-examples/build.gradle b/java-client/session-examples/build.gradle index db9d4d859bf..f6467f1bdaf 100644 --- a/java-client/session-examples/build.gradle +++ b/java-client/session-examples/build.gradle @@ -49,6 +49,7 @@ application.applicationDistribution.into('bin') { from(createApplication('message-stream-send-receive', 'io.deephaven.client.examples.MessageStreamSendReceive')) from(createApplication('filter-table', 'io.deephaven.client.examples.FilterTable')) from(createApplication('create-shared-id', 'io.deephaven.client.examples.CreateSharedId')) + from(createApplication('print-configuration-constants', 'io.deephaven.client.examples.PrintConfigurationConstants')) fileMode = 0755 } diff --git a/java-client/session-examples/src/main/java/io/deephaven/client/examples/PrintConfigurationConstants.java b/java-client/session-examples/src/main/java/io/deephaven/client/examples/PrintConfigurationConstants.java new file mode 100644 index 00000000000..8a2bf16ccc4 --- /dev/null +++ b/java-client/session-examples/src/main/java/io/deephaven/client/examples/PrintConfigurationConstants.java @@ -0,0 +1,28 @@ +// +// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending +// +package io.deephaven.client.examples; + +import io.deephaven.client.impl.Session; +import io.deephaven.proto.backplane.grpc.ConfigValue; +import picocli.CommandLine; +import picocli.CommandLine.Command; + +import java.util.Map.Entry; + +@Command(name = "print-configuration-constants", mixinStandardHelpOptions = true, + description = "Print configuration constants", version = "0.1.0") +class PrintConfigurationConstants extends SingleSessionExampleBase { + + @Override + protected void execute(Session session) throws Exception { + for (Entry entry : session.getConfigurationConstants().get().entrySet()) { + System.out.println(entry.getKey() + "=" + entry.getValue().getStringValue()); + } + } + + public static void main(String[] args) { + int execute = new CommandLine(new PrintConfigurationConstants()).execute(args); + System.exit(execute); + } +} diff --git a/props/configs/src/main/resources/dh-defaults.prop b/props/configs/src/main/resources/dh-defaults.prop index 94e1a947bf3..877a9f8d056 100644 --- a/props/configs/src/main/resources/dh-defaults.prop +++ b/props/configs/src/main/resources/dh-defaults.prop @@ -62,9 +62,9 @@ web.webgl.editable=true authentication.client.configuration.list=AuthHandlers # List of configuration properties to provide to authenticated clients, so they can interact with the server. -client.configuration.list=java.version,deephaven.version,barrage.version,http.session.durationMs,file.separator,web.storage.layout.directory,web.storage.notebook.directory,web.webgl,web.webgl.editable +client.configuration.list=java.version,deephaven.version,barrage.version,groovy.version,python.version,http.session.durationMs,file.separator,web.storage.layout.directory,web.storage.notebook.directory,web.webgl,web.webgl.editable # Version list to add to the configuration property list. Each `=`-delimited pair denotes a short name for a versioned # jar, and a class that is found in that jar. Any such keys will be made available to the client.configuration.list # as .version. -client.version.list=deephaven=io.deephaven.engine.table.Table,barrage=io.deephaven.barrage.flatbuf.BarrageMessageWrapper +client.version.list=deephaven=io.deephaven.engine.table.Table,barrage=io.deephaven.barrage.flatbuf.BarrageMessageWrapper,groovy=groovy.lang.GroovyShell