From d9d6da9ea7a8f71433e5d933bc4e858e7c49d14d Mon Sep 17 00:00:00 2001 From: Rafael Vuijk Date: Sat, 24 Oct 2026 03:58:32 +0000 Subject: [PATCH] Build the Binder image from this repository, and make the samples run The README's Try button built AngouriMathLab's try branch, which is archived and installs the .NET 6 SDK with Ubuntu 20.04 packages that its base image no longer has. binder/Dockerfile here is Jupyter's maintained base-notebook, the .NET 10 SDK the dotnet-interactive tool targets, and the two samples from Sources/Samples, and the button opens the F# one. Neither sample ran in it. Both first cells hung the kernel: a comment after a #r directive does, and there was one on each. The F# one then called Interactive.magic(), which is gone since the package registers itself on load, and opened Functions and called parse, differentiate and solve, which are AngouriMath.FSharp.Functions and parsed, derivative and solutions now. The C# one referenced AngouriMath.Interactive, which the C# kernel hangs loading; AngouriMath, with its LaTeX extension, is what it needs. And MathS.Matrices.Matrix took an Entity[,] once; MathS.Matrix does. Executed with nbconvert in the image, both now run to the end, in 14 and 5 seconds. Part of https://github.com/asc-community/AngouriMath/issues/1689. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura --- README.md | 2 +- .../Samples/CSharp.Interactive.Sample.ipynb | 5 ++-- Sources/Samples/Interactive.Sample.ipynb | 14 ++++------ binder/Dockerfile | 28 +++++++++++++++++++ 4 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 binder/Dockerfile diff --git a/README.md b/README.md index 2adf0cd09..3792bf558 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@

- + Join our Discord diff --git a/Sources/Samples/CSharp.Interactive.Sample.ipynb b/Sources/Samples/CSharp.Interactive.Sample.ipynb index 2ef6d6937..d16f85576 100644 --- a/Sources/Samples/CSharp.Interactive.Sample.ipynb +++ b/Sources/Samples/CSharp.Interactive.Sample.ipynb @@ -137,8 +137,7 @@ } ], "source": [ - "#r \"nuget:AngouriMath.Interactive, *-*\" // installing the Interactive package\n", - "Interactive.magic() // run this code to register all interacting stuff" + "#r \"nuget:AngouriMath, *-*\"" ] }, { @@ -180,7 +179,7 @@ "metadata": {}, "outputs": [], "source": [ - "MathS.Matrices.Matrix(new Entity[,]{\n", + "MathS.Matrix(new Entity[,]{\n", "{ \"x / 2\", \"beta - 2^3\", \"e / sqrt(pi)\" },\n", "{ \"epsilon\", \"integral(sin(k), k)\", \"e - pi\" },\n", "})" diff --git a/Sources/Samples/Interactive.Sample.ipynb b/Sources/Samples/Interactive.Sample.ipynb index dc3e99a04..e3984622d 100644 --- a/Sources/Samples/Interactive.Sample.ipynb +++ b/Sources/Samples/Interactive.Sample.ipynb @@ -6,8 +6,7 @@ "metadata": {}, "outputs": [], "source": [ - "#r \"nuget:AngouriMath.Interactive, *-*\" // installing the Interactive package\n", - "Interactive.magic() // run this code to register all interacting stuff" + "#r \"nuget:AngouriMath.Interactive, *-*\"" ] }, { @@ -16,9 +15,8 @@ "metadata": {}, "outputs": [], "source": [ - "open Functions\n", - "open Core\n", - "open Operators" + "open AngouriMath.FSharp.Core\n", + "open AngouriMath.FSharp.Functions" ] }, { @@ -42,7 +40,7 @@ } ], "source": [ - "parse \"x2 + sin(sqrt(x + 1/2)) + integral(sqrt(x + derivative(sin(y), y)), x)\"" + "parsed \"x2 + sin(sqrt(x + 1/2)) + integral(sqrt(x + derivative(sin(y), y)), x)\"" ] }, { @@ -66,7 +64,7 @@ } ], "source": [ - "differentiate \"x\" \"sqrt(sin(x) + 1 / (x + epsilon)) + e^(3x2)\"" + "derivative \"x\" \"sqrt(sin(x) + 1 / (x + epsilon)) + e^(3x2)\"" ] }, { @@ -90,7 +88,7 @@ } ], "source": [ - "solve \"x\" \"x > 0 and x ^ 2 = 9\"" + "solutions \"x\" \"x > 0 and x ^ 2 = 9\"" ] } ], diff --git a/binder/Dockerfile b/binder/Dockerfile new file mode 100644 index 000000000..034536f01 --- /dev/null +++ b/binder/Dockerfile @@ -0,0 +1,28 @@ +# The image mybinder.org builds for the README's "Try" button: Jupyter with the .NET Interactive +# kernels, and the sample notebooks from Sources/Samples. The notebooks install AngouriMath.Interactive +# from NuGet themselves. https://github.com/asc-community/AngouriMath/issues/1689 +FROM quay.io/jupyter/base-notebook:2026-10-05 + +USER root +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl libicu-dev \ + && rm -rf /var/lib/apt/lists/* + +# The .NET 10 SDK, which the dotnet-interactive tool targets. +ENV DOTNET_ROOT=/usr/share/dotnet \ + DOTNET_CLI_TELEMETRY_OPTOUT=1 \ + DOTNET_NOLOGO=1 \ + NUGET_XMLDOC_MODE=skip +RUN curl -sSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh \ + && bash /tmp/dotnet-install.sh --channel 10.0 --install-dir ${DOTNET_ROOT} \ + && ln -s ${DOTNET_ROOT}/dotnet /usr/bin/dotnet \ + && rm /tmp/dotnet-install.sh + +COPY Sources/Samples/Interactive.Sample.ipynb Sources/Samples/CSharp.Interactive.Sample.ipynb ${HOME}/ +RUN chown -R ${NB_UID}:${NB_GID} ${HOME} + +USER ${NB_USER} +ENV PATH="${PATH}:${HOME}/.dotnet/tools" +RUN dotnet tool install -g Microsoft.dotnet-interactive \ + && dotnet interactive jupyter install +WORKDIR ${HOME}