[ANN] PlutoStaticHTML.jl

Sometimes, a project idea sounds nice, but the outcome just doesn’t work. Sometimes, a project sounds nice and the outcome works reasonably well. And sometimes, a project sounds nice and the outcome works better than expected! Hereby, I like to announce PlutoStaticHTML.jl which worked out tremendously well.

This package is a combination of three things:

  1. Super quick development via Pluto.jl.
  2. Super quick website build because we can re-use Pluto.jl’s parallelization.
  3. Super quick websites because the site is static and plain HTML.

Credits to the Pluto developers for 1 and 2! Multithreading is hard.

When is this package useful?

I’m personally using it for my blog. Tutorials and documentation should work too. In my case, I want to have a few dozen blog posts where most of them contain tables, plots and statistical models. These take 2-15 minutes per post to run. For example, there are posts with a Turing model and Random forests.

Thanks to PlutoStaticHTML, it is possible to:

  1. Build the posts in parallel (see the Build time section below).
  2. Develop quickly; no need to manually choose where to store outputs such as plots. Also, it is very helpful to have reactive notebooks.
  3. Have notebooks with embedded Manifest.toml files. This way, it is easy to re-run each notebook every time, but at the same time it is not necessary to update the dependencies of all notebooks at the same time. No need to update the dependencies of a post if almost no one reads it anyway.

Build time

For my blog, the build time is as follows:

System Build time
GitHub Actions without parallelization 1 hour and 10 minutes
GitHub Actions with parallelization (2 cores) 50 minutes
Self-hosted runner with parallelization (4 cores) 21 minutes

How is this different from the Pluto.jl export to HTML button?

Contrary to the built-in Pluto to “HTML” export, web pages generated with this package work without Javascript. Therefore, the pages load faster and are easier to style. If you want, you can style the output with your own CSS.

Threats to this project

The package relies on Pluto internals to work. I’ve asked Fons what he thinks about PlutoStaticHTML (Raw HTML export · Discussion #1607 · fonsp/Pluto.jl · GitHub) and he seems very open to it. (Thanks @fonsp!)

So, the project might need a few rewrites in the future due to Pluto changing internals, but the code is so simple that it should be doable.

Future plans

I really hope that this project can be incorporated into Books.jl at some point. I already think that Books.jl is better than the R and Python alternatives in quite a few ways, but when combined with Pluto.jl, Books.jl could be 10 times better than the competition.

EDIT: I’ve rebuilt the blog a dozen times now and the build is rock solid. Full CPU load visible via htop:

25 Likes

Would love to see the source for your Turing model example (the link at the bottom didn’t work).

1 Like

Does it work with Neptune?

I confess that as long as that I’m forced to use begin end blocks to encapsulate multiple commands I will not use Pluto.

1 Like

I wish bigger forces would drive Neptune.jl forward.
This variation of Pluto.jl is highly useful for many cases.

1 Like

Thanks! All notebook links are fixed now below the posts. That specific notebook is at https://huijzer.xyz/posts/notebooks/collinear-bayes.jl and also at posts/notebooks · main · Rik / blog · GitLab.

You can try. It’s not a priority for me. I’m very happy with Pluto.jl.

1 Like

Nice package. And the output appears after the input, right? That is very much appreciated.

1 Like

Yes. That’s right

1 Like

Nice work. Also, it found interesting your blog (in particular your examples with MLJ).

1 Like