jupyter_sphinx was recently updated and now includes a directive which lets the user run a piece of code and even modify it before running.
n = 1 for i in range(1, 10): n *= i print('i!=%d' % n)
i!=1 i!=2 i!=6 i!=24 i!=120 i!=720 i!=5040 i!=40320 i!=362880
This kind of complex possibility still surprises me. There must be a machine somewhere set up to run something, similar to binder.
.. jupyter-execute:: n = 1 for i in range(1, 10): n *= i print('i!=%d' % n)
Apparently, a button must be added to the page…
.. thebe-button:: Optional title
Let’s see if this page works. I don’t see a free website running python for ever… Anyway, it seems to work very slowly on my first try or not to work. The page was waiting for the kernel for ever.