almond-sh / almond

A Scala kernel for Jupyter
https://almond.sh
BSD 3-Clause "New" or "Revised" License
1.58k stars 241 forks source link

Scala 3 compatibility ? #718

Open rubenfiszel opened 3 years ago

rubenfiszel commented 3 years ago

Would the kernel work with scala3 dependencies ? If not, would it be a matter of just adding a new target for almond or are there major blockers ?

This would be important for the company I work for and we would probably be willing to spend some dev hours to make it work if there was a feasible path.

alexarchambault commented 3 years ago

I don't think it works yet… Once the next release is out with Scala 2.13.4 support, you may be able to add Scala 3 dependencies, using an explicit suffix, like

import $ivy.`org.typelevel:cats-effect_3.0.0-M1:3.0.0-M4`

Almond heavily relies on Ammonite. For a proper Scala 3 support, we'll need Scala 3 support in Ammonite first. Work on this is well underway (see https://github.com/lihaoyi/Ammonite/pull/1135 or this contributors thread), I'm confident we'll have preliminary Scala 3 support in an Ammonite release later this month.

I'll probably try to use that in Almond right after. Scala 3 support in Ammonite should happen either via 2.13 / 3 compatibility mode (both Scala 2.13 and 3 artifacts in the same class path), or via heavier isolation between the internals of Ammonite and user space (relying on class loader isolation, allowing to expose a Scala version to users while using another one internally). Almond should use the same mechanism that Ammonite ends up using.

So hopefully, I should have the time to add preliminary Scala 3 support myself, based on what I'm doing in Ammonite. But I'd really welcome some testing / feedback of it, once it's there.

Quafadas commented 3 years ago

I strongly suspect I lack the skill to contribute to making it happen, but I'd be happy to invest some time on testing it. Thanks for your efforts.

YourPsychiatrist commented 2 years ago

I am with @Quafadas. I think almond is a super nice project and i would love to help move it to Scala 3.

Would be nice if maintainers (@alexarchambault ?) could give us (or me, if Quafadas is not interested anymore) a thumbs up or down to let us know whether this would be a welcomed feature of if this is already being worked on.

lucag commented 2 years ago

Hi there — any updates on this? I'm very interested as well.

YourPsychiatrist commented 2 years ago

@lucag I think we have to take matters into our own hands hehe

NicolasRouquette commented 2 years ago

@lucag @YourPsychiatrist FYI: the current source code shows that there is support for building a scala3 version of almond.

Unfortunately, it looks like the CI is no longer building/publishing docker images; the last tags are for 0.10.9 but there are newer tags since then without any published artifacts/docker images.

Building from source is possible and allows one to build a local docker image w/ scala3 support.

lucag commented 2 years ago

Well @NicolasRouquette, I tried the mill build (some time ago, but the repo hasn't changed); it didn't seem to produce anything useable. Am I missing something obvious?

NicolasRouquette commented 2 years ago

Here is what I did in Ubuntu 20.04 (actually, in WSL2)

# jupyterlab
sudo apt install nodejs python3 python3-pip
pip install --user jupyterlab pandas matplotlib
# almond per se.
git clone git@github.com:almond-sh/almond.git
cd almond
git submodule init
git submodule update
./mill -i jupyter 3.0.1

After a while, there will be messages like this:

...
[I 2021-10-12 21:16:00.022 ServerApp] jupyterlab | extension was successfully linked.
[I 2021-10-12 21:16:00.036 LabApp] JupyterLab extension loaded from /home/rouquette/.local/lib/python3.8/site-packages/jupyterlab
[I 2021-10-12 21:16:00.037 LabApp] JupyterLab application directory is /home/rouquette/.local/share/jupyter/lab
[I 2021-10-12 21:16:00.039 ServerApp] jupyterlab | extension was successfully loaded.
[I 2021-10-12 21:16:00.039 ServerApp] Serving notebooks from local directory: /opt/local/almond.sh/almond/notebooks
[I 2021-10-12 21:16:00.039 ServerApp] Jupyter Server 1.11.1 is running at:
[I 2021-10-12 21:16:00.039 ServerApp] http://localhost:8888/lab?token=38ca7528c18ce2d78faf5b9afe7a04adba8f1ef5313ce948
[I 2021-10-12 21:16:00.039 ServerApp]  or http://127.0.0.1:8888/lab?token=38ca7528c18ce2d78faf5b9afe7a04adba8f1ef5313ce948
[I 2021-10-12 21:16:00.039 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2021-10-12 21:16:00.147 ServerApp]

    To access the server, open this file in a browser:
        file:///home/rouquette/.local/share/jupyter/runtime/jpserver-5740-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=38ca7528c18ce2d78faf5b9afe7a04adba8f1ef5313ce948
     or http://127.0.0.1:8888/lab?token=38ca7528c18ce2d78faf5b9afe7a04adba8f1ef5313ce948

I realize that it would be better to build/publish docker images; this should at least help confirm that scala3 support is available.

coreyoconnor commented 2 months ago

Almond supports Scala 3 fine as far as I can tell. Is this issue specific to the current docker image?