Skip to content

Commit a849c99

Browse files
Build the Binder image from this repository, and make the samples run (#2107)
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 #1689. Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 218acb6 commit a849c99

4 files changed

Lines changed: 37 additions & 12 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<br>
2222
<br>
2323
<a href="https://dotnetfiddle.net/u901sI"><img src="https://img.shields.io/static/v1?label=Fiddle&message=Try%21&color=purple&style=flat&logo=.NET&labelColor=646"></a>
24-
<a href="https://mybinder.org/v2/gh/asc-community/AngouriMathLab/try"><img src="https://img.shields.io/static/v1?label=Jupyter&message=Try%21&color=purple&style=flat&logo=Jupyter&labelColor=646"></a>
24+
<a href="https://mybinder.org/v2/gh/asc-community/AngouriMath/master?labpath=Interactive.Sample.ipynb"><img src="https://img.shields.io/static/v1?label=Jupyter&message=Try%21&color=purple&style=flat&logo=Jupyter&labelColor=646"></a>
2525
<a href="https://discord.gg/YWJEX7a"><img alt="Join our Discord" src="https://img.shields.io/discord/642350046213439489?label=chat%20with%20us&logo=discord&style=flat&labelColor=474&logoColor=white&color=252"></a>
2626
<a href="https://github.com/quozd/awesome-dotnet"><img src="https://awesome.re/mentioned-badge.svg"></a>
2727

‎Sources/Samples/CSharp.Interactive.Sample.ipynb‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@
137137
}
138138
],
139139
"source": [
140-
"#r \"nuget:AngouriMath.Interactive, *-*\" // installing the Interactive package\n",
141-
"Interactive.magic() // run this code to register all interacting stuff"
140+
"#r \"nuget:AngouriMath, *-*\""
142141
]
143142
},
144143
{
@@ -180,7 +179,7 @@
180179
"metadata": {},
181180
"outputs": [],
182181
"source": [
183-
"MathS.Matrices.Matrix(new Entity[,]{\n",
182+
"MathS.Matrix(new Entity[,]{\n",
184183
"{ \"x / 2\", \"beta - 2^3\", \"e / sqrt(pi)\" },\n",
185184
"{ \"epsilon\", \"integral(sin(k), k)\", \"e - pi\" },\n",
186185
"})"

‎Sources/Samples/Interactive.Sample.ipynb‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"metadata": {},
77
"outputs": [],
88
"source": [
9-
"#r \"nuget:AngouriMath.Interactive, *-*\" // installing the Interactive package\n",
10-
"Interactive.magic() // run this code to register all interacting stuff"
9+
"#r \"nuget:AngouriMath.Interactive, *-*\""
1110
]
1211
},
1312
{
@@ -16,9 +15,8 @@
1615
"metadata": {},
1716
"outputs": [],
1817
"source": [
19-
"open Functions\n",
20-
"open Core\n",
21-
"open Operators"
18+
"open AngouriMath.FSharp.Core\n",
19+
"open AngouriMath.FSharp.Functions"
2220
]
2321
},
2422
{
@@ -42,7 +40,7 @@
4240
}
4341
],
4442
"source": [
45-
"parse \"x2 + sin(sqrt(x + 1/2)) + integral(sqrt(x + derivative(sin(y), y)), x)\""
43+
"parsed \"x2 + sin(sqrt(x + 1/2)) + integral(sqrt(x + derivative(sin(y), y)), x)\""
4644
]
4745
},
4846
{
@@ -66,7 +64,7 @@
6664
}
6765
],
6866
"source": [
69-
"differentiate \"x\" \"sqrt(sin(x) + 1 / (x + epsilon)) + e^(3x2)\""
67+
"derivative \"x\" \"sqrt(sin(x) + 1 / (x + epsilon)) + e^(3x2)\""
7068
]
7169
},
7270
{
@@ -90,7 +88,7 @@
9088
}
9189
],
9290
"source": [
93-
"solve \"x\" \"x > 0 and x ^ 2 = 9\""
91+
"solutions \"x\" \"x > 0 and x ^ 2 = 9\""
9492
]
9593
}
9694
],

‎binder/Dockerfile‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# The image mybinder.org builds for the README's "Try" button: Jupyter with the .NET Interactive
2+
# kernels, and the sample notebooks from Sources/Samples. The notebooks install AngouriMath.Interactive
3+
# from NuGet themselves. https://github.com/asc-community/AngouriMath/issues/1689
4+
FROM quay.io/jupyter/base-notebook:2026-10-05
5+
6+
USER root
7+
RUN apt-get update \
8+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl libicu-dev \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
# The .NET 10 SDK, which the dotnet-interactive tool targets.
12+
ENV DOTNET_ROOT=/usr/share/dotnet \
13+
DOTNET_CLI_TELEMETRY_OPTOUT=1 \
14+
DOTNET_NOLOGO=1 \
15+
NUGET_XMLDOC_MODE=skip
16+
RUN curl -sSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh \
17+
&& bash /tmp/dotnet-install.sh --channel 10.0 --install-dir ${DOTNET_ROOT} \
18+
&& ln -s ${DOTNET_ROOT}/dotnet /usr/bin/dotnet \
19+
&& rm /tmp/dotnet-install.sh
20+
21+
COPY Sources/Samples/Interactive.Sample.ipynb Sources/Samples/CSharp.Interactive.Sample.ipynb ${HOME}/
22+
RUN chown -R ${NB_UID}:${NB_GID} ${HOME}
23+
24+
USER ${NB_USER}
25+
ENV PATH="${PATH}:${HOME}/.dotnet/tools"
26+
RUN dotnet tool install -g Microsoft.dotnet-interactive \
27+
&& dotnet interactive jupyter install
28+
WORKDIR ${HOME}

0 commit comments

Comments
 (0)