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:
- Super quick development via Pluto.jl.
- Super quick website build because we can re-use Pluto.jl’s parallelization.
- Super quick websites because the site is static and plain HTML.
Credits to the Pluto developers for 1 and 2! Multithreading is hard.
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:
- Build the posts in parallel (see the Build time section below).
- Develop quickly; no need to manually choose where to store outputs such as plots. Also, it is very helpful to have reactive notebooks.
- Have notebooks with embedded
Manifest.tomlfiles. 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.
For my blog, the build time is as follows:
|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|
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.
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: