io.deephaven.server.console.python.PythonGlobalScopeModule Maven / Gradle / Ivy
The newest version!
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
package io.deephaven.server.console.python;
import dagger.Module;
import dagger.Provides;
import io.deephaven.engine.util.PythonEvaluatorJpy;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
@Module
public interface PythonGlobalScopeModule {
@Provides
static PythonEvaluatorJpy providePythonEvaluatorJpy() {
try {
PythonEvaluatorJpy jpy = PythonEvaluatorJpy.withGlobals();
PythonImportInitializer.init();
return jpy;
} catch (IOException | InterruptedException | TimeoutException e) {
throw new IllegalStateException("Unable to start a python session: ", e);
}
}
}