pressbooks / ideas

Ideas for Pressbooks.
GNU General Public License v3.0
11 stars 4 forks source link

embed Jupyter Notebooks in Pressbooks? #184

Open hughmcguire opened 5 years ago

hughmcguire commented 5 years ago

Feature Description

"The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more." https://jupyter.org/

Feature Use Case

Some faculty want to include Jupyter notebooks in their open textbooks. PB should support?

Other Notes

There is plugin that maybe works: https://www.andrewchallis.co.uk/portfolio/php-nbconvert-a-wordpress-plugin-for-jupyter-notebooks/

See an example: https://eng.aurelienpierre.com/2018/05/05/make-jupyter-notebooks-easy-to-blog-in-wordpress/

SteelWagstaff commented 5 years ago

Thanks Hugh. Additional reading, for reference: http://ipython.org/ipython-doc/stable/interactive/reference.html#embedding-ipython + https://ipywidgets.readthedocs.io/en/stable/embedding.html + https://jupyter.readthedocs.io/en/latest/projects/content-projects.html

Jero2760 commented 4 years ago

Thanks Hugh and Steel. I am using nbconvert plugin from Andrew Challis and it is very useful and much more convenient than the other solution mentioned by Hugh.

So, I recommend using nbconvert – A wordpress plugin for Jupyter notebooks.

It is a neat little shortcode plugin for WordPress that uses Jupyter Nbviewer to create your ipynb and add it to your textbook in Pressbooks.

Pros:

Cons:

How to use it: see https://www.eg.bucknell.edu/~brk009/notebook-on-wp/ and https://github.com/ghandic/nbconvert

SteelWagstaff commented 4 years ago

Thanks for the tip @Jero2760 -- looks very promising. Hope to investigate soon!

Jero2760 commented 4 years ago

Please see this example of a Pressbooks book using Jupyter Notebook. Lectures and assignments are provided as interactive Jupyter notebooks. Readers can learn through a lecture notebook and then go to the assignment notebook and access it through GitHub to open and run the Jupyter notebook (Jupyter nbviewer, Google Colab notebooks, etc.)

This example book also includes the plugin installation instructions to make Jupyter notebook work inside Pressbooks, reader annotations (Hypothesis), and more interactive content (H5P):

Example book (https://www.publiconsulting.com/wordpress/pythonfords/)

SteelWagstaff commented 4 years ago

@Jero2760 thanks for the helpful example. Can you provide examples of what the epub and PDF exports look like for this book? I think supporting Jupyter notebooks in our webbooks will be the "easy" part, but thinking about how this will affect various export formats and ensuring graceful fallback across all formats will be the part we still need to think about internally.

Jero2760 commented 4 years ago

@SteelWagstaff Export formats in pdf and epub work smoothly. Just a touch of CSS as usual! Of course this solution requires some fine tuning, but it delivers more interactivity to open textbooks for computer science, machine learning, software engineering, and the like

Enkerli commented 1 year ago

Reviving this old idea, maybe Quarto could help?