Skip to content

Commit 10cdef9

Browse files
committed
Thebe: demonstrate Thebe to run code inline
- Don't merge: this is a demo. - This includes the Pandas pull request, but is unrelated. Diff will look better once that is merged. - A "Launch" button appears at the top - Then, it launches a kernel on mybinder.org in the default jupyter data sci repo (todo: does this have everything this course needs?). - Then, you can click "run" on any cell and see the output (just like Jupyter would look), also edit the code and re-run. - Formatting is a bit off (line spacing is too much, probably since this uses sphinx_rtd_theme). - I don't think we should use this for 2023 (not unless there is more testing and maybe an own mybinder instance...), but hopefully it's a good demo.
1 parent 6945c91 commit 10cdef9

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

content/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,16 @@
4040
'sphinx.ext.mathjax',
4141
'sphinx_aaltoscicomp_branding',
4242
'sphinxext.opengraph',
43+
'sphinx_thebe',
4344
]
4445
myst_enable_extensions = ['colon_fence']
4546

47+
thebe_config = {
48+
"selector": "div.highlight"
49+
}
50+
51+
nb_execution_mode = "off"
52+
4653
ogp_site_name = "Python for Scientific Computing"
4754
ogp_site_url = 'https://aaltoscicomp.github.io/python-for-scicomp/'
4855
import datetime

content/pandas.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ material, including:
3333
A quick Pandas preview
3434
----------------------
3535

36+
.. thebe-button::
37+
3638
Let's get a flavor of what we can do with pandas (you won't be able to follow everything yet). We will be working with an example dataset containing the passenger list from the Titanic, which is often used in Kaggle competitions and data science tutorials. First step is to load pandas::
3739

3840
import pandas as pd

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ sphinx-lesson
66
https://github.com/aaltoscicomp/sphinx-aaltoscicomp-branding/archive/master.zip
77
sphinx_rtd_theme_ext_color_contrast
88
sphinxext-opengraph
9+
sphinx-thebe
910

1011
# for web-apis execution
1112
jsonlines

0 commit comments

Comments
 (0)