Kotlin / kotlin-jupyter

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

Create specialized kernels w/ JDK, JVM args, and environment variables #287

Closed rnett closed 3 years ago

rnett commented 3 years ago

Fixes #284. Fixes #72.

I'd like to note this somewhere in the readme (and that it can be set per-kernel with env in the kernelspec), any preference on where?

I also thought about a few possible further features:

  1. Creating kernels for each detected JDK version on install (presumably in install_user, although I can't find where it gets called on initial install).
  2. Adding a fix-kernelspec-location-like task to create a kernel for a specific JDK.
  3. Adding a kotlin-jupyter specific environment variable that overrides JAVA_HOME, i.e. KOTLIN_JUPYTER_JAVA, incase you want jupyter on a different JDK than say gradle (although that's doable via the kernelspec).

Thoughts on any of them?

ileasile commented 3 years ago

Hi! To satisfy CI you may rebase on the latest master You may mention this feature in Usage section in README

Regarding your questions:

  1. Good idea, it may be done in setup script, I suppose
  2. It's also worth adding
  3. Agree, and it may be even done in this PR.
rnett commented 3 years ago

Autodetection is on hold for now since it's non-trivial, I'd probably do it in another PR.

The rest is done, although I did use subprocess.check_output which is from Python 3.1. As far as I can tell you're targeting 3, should I use subprocess.PIPE or is it a non-issue?

rnett commented 3 years ago

Also, is there a reason install_user isn't called from the setup script?

rnett commented 3 years ago

Making this a draft for now, since I was working on #72 and think it's better done as a create_kernel command that can set any of the JDK, JVM args, or environment variables.

rnett commented 3 years ago

Went faster than I expected, this fixes #72 too now.

ileasile commented 3 years ago

The rest is done, although I did use subprocess.check_output which is from Python 3.1. As far as I can tell you're targeting 3, should I use subprocess.PIPE or is it a non-issue?

It's ok. I think, 3.4 is the minimal version we should support

ileasile commented 3 years ago

@rnett Could you please install and try the kernel built from this PR? If everything is fine, I'll merge it pip install -i https://test.pypi.org/simple/ kotlin-jupyter-kernel==0.10.0.83.dev1 or conda install -c jetbrains-dev kotlin-jupyter-kernel==0.10.0.83.dev1

rnett commented 3 years ago

These was a typo in the readme, but other than that everything worked. Tested environment variables and kernel creation on Windows and WSL.

ileasile commented 3 years ago

Thank you, Ryan!