Integrating Jupyter books and "global functions" #1227
Replies: 1 comment
-
You could use Binder as an alternative. It has the benefit that it clones the whole repository when launching and you can configure an environment. The notebooks then 'know' where to find the source code that you ship with the repo. The disadvantage is that Binder is not as stable and fast as Google Colab.
It sounds like this is something you have to do anyway, whether using Binder on Google Colab. You don't necessarily have to publish the package through PyPI, but you can install the package through Git. For running the notebooks on Colab, you would have to add an 'install cell' before the
We did something similar here (source | pages), but that repository does not provide it's own source code with shared functions.
The repo with the source code and the notebooks has to be public when using Bind and/or Colab. |
Beta Was this translation helpful? Give feedback.
-
I'm writing a text intended for students. At the moment my plan is for it to be on github pages. It will have executable python content which can be downloaded in .ipynb format or perhaps opened on google colab/similar.
The text will be made up of many, many ipynb files. There are some custom functions that I will want all of the notebooks to be able to access. Is there a simple way to set this up? I have to assume that the students are not particularly technically adept.
Currently the only solutions I can think of require a standalone package that contains these functions.
Then if students run on google colab, I believe I can automate it so that google colab installs the package and the students just need to click on the link to open the notebooks and they will run. However, I may have restrictions that prevent me from being able to put it on a public source where google colab could get the package.
So right now the best option I see is to create a python package which the student will need to install manually. Then it should be possible for the notebooks to import that package when running on the student's personal machine. However, this may require troubleshooting for different setups which I won't have capacity for.
Is there an alternative way that I could have a small package of functions that come along for the ride whenever a student downloads one of the .ipynb files?
Beta Was this translation helpful? Give feedback.
All reactions