Jupyter notebooks

28 views
Skip to first unread message

Rob Beezer

unread,
Jul 12, 2026, 6:24:55 PMJul 12
to prete...@googlegroups.com
Mostly for Sean, but perhaps of interest to others, maybe KDC. I've had my
assistant overhaul the conversion to Jupyter. @Sean - maybe pack the kids off
to overnight camp and explore? Definitely experimental, but also definitely a
huge leap forward, ansd maintainable, I think.

Need to use the pretext/pretext script, and your Python environment needs the
"nbformat" package. "-c jupyter", also an option for making a zip file of teh
collection. Please report any procedural issues.

https://github.com/PreTeXtBook/pretext/pull/3034

Principally we are trying to solve the "#sage in the middle of a block" problem
in a general way. It is stressing my assistant.

#interactive are in their static forms. This includes #video and #audio, but
maybe we can get that sorted soon. #sage become code cells using the "sagemath"
kernel. The publisher file will let you specify a "python3" kernel. Have not
thought too carefully beyond the Sage case.

Jupyter notebooks are very paranoid. We have placed CSS in an initial hidden
cell. You must execute it, or trust the notebook, or open it for a second time,
etc. We have no access to the MathJax configuration. I doubt #interactive will
run, though maybe if we just point to a server instance, those kinds will
behave? Or pointing to our standalone pages is enough?

I think a lot of necessary CSS is missing. I took some time to identify
#sidebyside and #tabular, plus a few other bits, as needing some additional CSS
rules to be functional. Likely more, on discovery and suggestion.

I had my assistant also provide a build for the Jupyter Book machinery. But now
I fail to see the point. Jupyter Book builds a pile of notebooks into a book
(duh) which is a static HTML site where the Sage code is also static (easily
copyable, but not executable). In other words, back to a (much inferior)
version of our base HTML conversion. With lots of compromises along the way.
And a "version 2 Myst rewrite" sounds hostile to our markdown-cells-as-HTML
approach. I have everything on this front saved, which I could bring back if
somebody can convince me why that would be a good idea.

@Sean - can you review and look for big glaring inconsistencies that we need to
fix so we can stop calling this experimental? I'm not ready yet for
APEX-specific things like asides. ;-) Clear and concise descriptions will
allow me to feed them to my assistant. Stuffing a YouTube video into a notebook
might be an interesting experiment that would benefit APEX (and everybody else).

Rob

PS Just learned that my assistant will continue to work for the same low wages
for another week before asking for a raise. Back to a serious upgrade of the
braille conversion, in-progress. ;-)

Sean Fitzpatrick

unread,
Jul 12, 2026, 6:50:00 PMJul 12
to PreTeXt development
I'm on the road right now: vacation travel to visit family. In Manitoba for a week, then Nova Scotia for awhile. 

No time for the next few days, but I'll try to free up a couple of hours. Give me a nudge if you don't hear back in a week.

Decided to travel with only one computer, which unfortunately is Windows -- I need it to get some fall course prep done.

Re: Jupyter book. I think a useful conversion would convert sections without Sage cells into markdown files. A Jupyter book can have both. If a Jupyter was specified in the publisher file, you'd get a launch button to open the notebooks in interactive mode. 

Re: interactives. With a %%html cell magic you should be able to run JavaScript and friends. I've done GeoGebra before. We used to have a plug-in but GeoGebra changed their API.

--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/MTAwMDAycFE0R0JKREE.1783895093%40pnsh.

Rob Beezer

unread,
Jul 12, 2026, 10:38:19 PMJul 12
to prete...@googlegroups.com
Dear Sean,

You will need a nudge? I thought you would be more excited than that. Well,
OK, family vacation trumps everything, I guess. ;-)

Jupyter Book: I don't see a launch button to make things interactive. But then
I'm not in a place with a compute server or anything. Just in a web browser,
opening static pages. I can download as a notebook, but we are already making
that. You are not selling it. Yet.

I forgot all about "magic"! Likely for good reason. The Sage notebook has
similar devices, drove me crazy back in the old pre-PreTeXt days. But maybe
worth a shot for #interactive. I presume you have to trust the notebook, or its
origin (local filesystem?), or something.

Thanks for the reply. Enjoy your trip!

Rob

On 7/12/26 15:49, Sean Fitzpatrick wrote:
> I'm on the road right now: vacation travel to visit family. In Manitoba for a
> week, then Nova Scotia for awhile.
>
> No time for the next few days, but I'll try to free up a couple of hours. Give
> me a nudge if you don't hear back in a week.
>
> Decided to travel with only one computer, which unfortunately is Windows -- I
> need it to get some fall course prep done.
>
> Re: Jupyter book. I think a useful conversion would convert sections without
> Sage cells into markdown files. A Jupyter book can have both. If a Jupyter was
> specified in the publisher file, you'd get a launch button to open the notebooks
> in interactive mode.
>
> Re: interactives. With a %%html cell magic you should be able to run JavaScript
> and friends. I've done GeoGebra before. We used to have a plug-in but GeoGebra
> changed their API.
>
> On Sun, Jul 12, 2026, 4:24 p.m. 'Rob Beezer' via PreTeXt development <pretext-
> d...@googlegroups.com <mailto:prete...@googlegroups.com>> wrote:
>
> Mostly for Sean, but perhaps of interest to others, maybe KDC.  I've had my
> assistant overhaul the conversion to Jupyter.  @Sean - maybe pack the kids off
> to overnight camp and explore?  Definitely experimental, but also definitely a
> huge leap forward, ansd maintainable, I think.
>
> Need to use the  pretext/pretext  script, and your Python environment needs the
> "nbformat" package.  "-c jupyter", also an option for making a zip file of teh
> collection.  Please report any procedural issues.
>
> https://github.com/PreTeXtBook/pretext/pull/3034 <https://github.com/
> PreTeXtBook/pretext/pull/3034>
> email to pretext-dev...@googlegroups.com <mailto:pretext-
> dev%2Bunsu...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/
> MTAwMDAycFE0R0JKREE.1783895093%40pnsh <https://groups.google.com/d/msgid/
> pretext-dev/MTAwMDAycFE0R0JKREE.1783895093%40pnsh>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com <mailto:pretext-
> dev+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/
> CAH%2BNcPYsU7izhOyCGv0is%3DR%3D%2BXDgqJwZbD6cr%2BxL3qJS8ZRt1w%40mail.gmail.com
> <https://groups.google.com/d/msgid/pretext-dev/
> CAH%2BNcPYsU7izhOyCGv0is%3DR%3D%2BXDgqJwZbD6cr%2BxL3qJS8ZRt1w%40mail.gmail.com?
> utm_medium=email&utm_source=footer>.

Sean Fitzpatrick

unread,
Jul 12, 2026, 11:06:38 PMJul 12
to PreTeXt development
I've made one Jupyter book. It was a project with an applied study student to consolidate some Jupyter notebooks we made for calculus, and to add some documentation: 


Unfortunately the launch button won't do much for you since it's set to use the University of Lethbridge hub. 

The first notebook on limits uses a simple
%%html
<iframe ........../>
to load a GeoGebra applet.

To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/MTAwMDA0dy5YLUNTckE.1783910296%40pnsh.

Rob Beezer

unread,
Jul 13, 2026, 10:19:51 AMJul 13
to prete...@googlegroups.com
Thanks, Sean. That example helps. I'll experiment with magic.

That book is nice. I guess one advantage is that if a student signs in to the
JupyterHub they can submit work easily? Easy for them and easy for you?

I'll have to admit, the sheer variety of the Jupyter ecosystem confuses me
sometimes. viewers, servers, kernels, JupyterHub, JupyterLab, JupyterLite,
Binder, Jupyter Book, nbconvert...

Rob

On 7/12/26 20:06, Sean Fitzpatrick wrote:
> I've made one Jupyter book. It was a project with an applied study student to
> consolidate some Jupyter notebooks we made for calculus, and to add some
> documentation:
>
> https://sean-fitzpatrick.github.io/CalcLabs/intro.html <https://sean-
> fitzpatrick.github.io/CalcLabs/intro.html>
>
> Unfortunately the launch button won't do much for you since it's set to use the
> University of Lethbridge hub.
>
> The first notebook on limits uses a simple
> %%html
> <iframe ........../>
> to load a GeoGebra applet.
>
> On Sun, Jul 12, 2026, 8:38 p.m. 'Rob Beezer' via PreTeXt development <pretext-
> > d...@googlegroups.com <mailto:d...@googlegroups.com> <mailto:pretext-
> d...@googlegroups.com <mailto:prete...@googlegroups.com>>> wrote:
> >
> >     Mostly for Sean, but perhaps of interest to others, maybe KDC.  I've
> had my
> >     assistant overhaul the conversion to Jupyter.  @Sean - maybe pack the
> kids off
> >     to overnight camp and explore?  Definitely experimental, but also
> definitely a
> >     huge leap forward, ansd maintainable, I think.
> >
> >     Need to use the  pretext/pretext  script, and your Python environment
> needs the
> >     "nbformat" package.  "-c jupyter", also an option for making a zip
> file of teh
> >     collection.  Please report any procedural issues.
> >
> > https://github.com/PreTeXtBook/pretext/pull/3034 <https://github.com/
> PreTeXtBook/pretext/pull/3034> <https://github.com/ <https://github.com/>
> dev%2Bunsu...@googlegroups.com> <mailto:pretext- <mailto:pretext->
> > dev%2Bunsu...@googlegroups.com
> <mailto:dev%252Buns...@googlegroups.com>>.
> >     To view this discussion visit https://groups.google.com/d/msgid/
> pretext-dev/ <https://groups.google.com/d/msgid/pretext-dev/>
> >     MTAwMDAycFE0R0JKREE.1783895093%40pnsh <https://groups.google.com/d/
> msgid/ <https://groups.google.com/d/msgid/>
> >     pretext-dev/MTAwMDAycFE0R0JKREE.1783895093%40pnsh>.
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "PreTeXt development" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> email
> > to pretext-dev...@googlegroups.com <mailto:pretext-
> dev%2Bunsu...@googlegroups.com> <mailto:pretext- <mailto:pretext->
> > dev+uns...@googlegroups.com
> <mailto:dev%2Bunsu...@googlegroups.com>>.
> > To view this discussion visit https://groups.google.com/d/msgid/pretext-
> dev/ <https://groups.google.com/d/msgid/pretext-dev/>
> >
> CAH%2BNcPYsU7izhOyCGv0is%3DR%3D%2BXDgqJwZbD6cr%2BxL3qJS8ZRt1w%40mail.gmail.com <http://40mail.gmail.com>
> > <https://groups.google.com/d/msgid/pretext-dev/ <https://
> groups.google.com/d/msgid/pretext-dev/>
> >
> CAH%2BNcPYsU7izhOyCGv0is%3DR%3D%2BXDgqJwZbD6cr%2BxL3qJS8ZRt1w%40mail.gmail.com <http://40mail.gmail.com>?
> > utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> MTAwMDA0dy5YLUNTckE.1783910296%40pnsh <https://groups.google.com/d/msgid/
> pretext-dev/MTAwMDA0dy5YLUNTckE.1783910296%40pnsh>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com <mailto:pretext-
> dev+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/
> CAH%2BNcPZHeYUqvbjwuY2HxRyXpVjSfoxq4ru4QPrR4%3DBBucqp4Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/pretext-dev/
> CAH%2BNcPZHeYUqvbjwuY2HxRyXpVjSfoxq4ru4QPrR4%3DBBucqp4Q%40mail.gmail.com?
> utm_medium=email&utm_source=footer>.

Sean Fitzpatrick

unread,
Jul 13, 2026, 11:05:16 AMJul 13
to PreTeXt development
The main advantage of the Jupyter hub is that everyone gets access to the same computing environment with nothing they need to install. 

Submission is an issue I've never solved. Each student gets their own instance, and it's not set up to allow students to collaborate across accounts, or for them to share their work with me. 

I've always had students export the completed notebook to PDF and submit that. 
Patrick Walls (UBC) does some sophisticated stuff. The notebooks he assigns have built-in tests to see if students are doing the work correctly. Some of these tests are hidden. 
Students submit their notebook files to the LMS, and he has a Python script using the API for the LMS that downloads all the notebooks, grades them (using nbgrader), and then pushes scores back to the LMS. 

To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/MTAwMDAxdkJJYzRUc2I.1783952386%40pnsh.

Sean Fitzpatrick

unread,
Jul 19, 2026, 12:36:37 PM (12 days ago) Jul 19
to PreTeXt development
I made a first try at building Jupyter. It looks like the PR is merged, so I did a git pull against pretext.
I ran the command:
python ~/Documents/github/pretext/pretext/pretext -c doc -f jupyter -p ~/Documents/github/Math3410/publication/publication.ptx ~/Documents/github/Math3410/ptx/3410text.ptx
and I got the following error:

NotImplementedError: cannot make entire document in "jupyter" format

Maybe my book as a whole is not compatible with Jupyter conversion (this is true, but in the past, I would delete most of the files and just keep the ones I wanted).

Sean Fitzpatrick

unread,
Jul 22, 2026, 12:08:44 PM (9 days ago) Jul 22
to PreTeXt development
Oh, I'm just dumb. I was running the pretext script from my fork, and did a git pull instead of fetching upstream.

Sean Fitzpatrick

unread,
Jul 22, 2026, 12:53:16 PM (9 days ago) Jul 22
to PreTeXt development
A quick check of 3 or 4 notebooks from my linear algebra book suggests no invalid JSON, and the notebooks look good.

I've got one LaTeX macro that doesn't work (I can work around this), and I noticed one quirk in the conversion: in math mode (e.g. when building a matrix), if one uses & amp ; instead of \amp, the & gets used as an alignment character, and the amp; remains as text.

Rob Beezer

unread,
Jul 22, 2026, 1:34:06 PM (9 days ago) Jul 22
to prete...@googlegroups.com
On 7/22/26 09:53, Sean Fitzpatrick wrote:
> A quick check of 3 or 4 notebooks from my linear algebra book suggests no
> invalid JSON, and the notebooks look good.

Yep, I think teh "nbconvert" module makes it harder to make invalid JSON now.

> I've got one LaTeX macro that doesn't work (I can work around this), and I
> noticed one quirk in the conversion: in math mode (e.g. when building a matrix),
> if one uses & amp ; instead of \amp, the & gets used as an alignment character,
> and the amp; remains as text.

I thought I had addressed that?! I'll double-check. Thanks for the testing.
There is more to do, so hopefully it is just improvements from here on out.

Rob
Reply all
Reply to author
Forward
0 new messages