Kotlin / kotlin-jupyter

Kotlin kernel for Jupyter/IPython
Apache License 2.0
1.09k stars 106 forks source link

dont fail on additional json payload like user_variables #440

Closed maxandersen closed 7 months ago

maxandersen commented 7 months ago

older kernels like the ones used in google colab sends "user_variables" element.

This makes kotlin kernel fail to run.

Here is log from google colab:


at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:24)
--
Nov 24, 2023, 12:33:33 AM | WARNING | Current input: {"allow_stdin":false,"code":"","silent":true,"store_history":false,"user_expressions":{},"user_variables":[]}

could we make the json parsing more lenient and ignore what it does not know?

maxandersen commented 7 months ago

basically have Json { ignoreUnknownKeys = true } whereever it is messages are read.

ileasile commented 7 months ago

Hi! Thanks for pointing this out! Maybe just adding a missing field to the scheme is a better solution? Idea was to keep protocol strict. Will it be possible for you to verify the fix in Google Colab if I prepare a new kernel version?

maxandersen commented 7 months ago

Yes, that would be great! happy to try it out as long as I can get some Maven coordinates to test :)

ileasile commented 7 months ago

@maxandersen you can take version 0.12.0-93 to test (or 0.12.0.93 if you're using python dev packages)

maxandersen commented 7 months ago

it works!

open this gist with google colab and it works.

note: %kotlin-statistics does not work in that notebook but seems to be a jitpack/kotlin kernel issue rather than colab afaics.

maxandersen commented 7 months ago

note: I've updated the install-kernel script to have the proxy no longer use "ipc" in name, but more that the core kernel will have "-tcp" added in the end. makes the experience on colab consistent with how it works on all the others.

maxandersen commented 7 months ago

Thanks for fixing that!