[IPython-dev] Best practice of deployment for university courses

Doug Blank doug.blank at gmail.com
Mon May 18 07:12:10 EDT 2015


On Mon, May 18, 2015 at 5:11 AM, Ozan Çağlayan <ozancag at gmail.com> wrote:

> Hi,
>
> I installed jupyterhub on a server in my university. Here is my plan:
> 1. Create ~/notebooks folder in each home folder
> 2. Configure jupyterhub so that the logged-in users only see the
> ~/notebooks folder. The authentication will be through classical UNIX
> credentials.
>

I considered doing something like that, but wanted to stay away from having
to do system-level configuration requiring root.

So, I just let the accounts be normal accounts, but created some special
javascript buttons, and a special jupyterhub static nbviewer-like url
handler. The buttons allow things like "Submit" (for homework) and
"Publish" (for putting into their Public directory, for the nbviewer-like
display).

In the nbviewer-like url handler, it can list files (with a copy action for
logged in users), example shown here:

http://jupyter.cs.brynmawr.edu/hub/dblank/public/CS110%20Intro%20to%20Computing/2015/Lectures

or it renders the notebook, with a download options, example shown here:

http://jupyter.cs.brynmawr.edu/hub/dblank/public/CS110%20Intro%20to%20Computing/2015/Lectures/Robot%20Control.ipynb



>
> Now I want that each student has access to some course materials
> through their ~/notebooks folder, e.g.:
>
> ~/notebooks/courses/MATH101
>   - Lecture1.ipynb
>   - Homework1.ipynb
> ~/notebooks/courses/PYTHON101
>   - Lecture1.ipynb
>   - Homework1.ipynb
>
> etc. To be able to manage this, I thought that maybe I should create a
> system-wide ipynb folder like /opt/notebooks, put the very same
> hierarchy above inside it and make ~/notebooks/courses a symbolic link
> to that folder. The problem is that the /opt/notebooks will only have
> read permissions to regular users. Is there a mechanism to
> fork/clone/save_as a notebook inside ~/notebooks once a student opens
> a notebook from the read-only ~/notebooks/courses?
>

I would use a link rather than copies (if you go this route). But you could
just link to something like /home/youraccount/Public/MATH101

That way, all you do is have to save your Public version, and it is
instantly updated. (I found myself having to fix little typos the first
time around).

The code for for the publish and submit buttons is here:

https://bitbucket.org/ipre/calico/raw/master/notebooks/nbextensions/

The code to inject the buttons into the template is here:

https://github.com/dsblank/jupyter.brynmawr/blob/master/notebook/templates/notebook.html#L316

And the code for the new jupyterhub publichandler static view and browser
is here (but has errors; will be updated later this summer):

https://github.com/dsblank/jupyter.brynmawr/tree/master/jupyterhub

Good luck!

-Doug


>
> Thanks.
>
> --
> Ozan Çağlayan
> Research Assistant
> Galatasaray University - Computer Engineering Dept.
> http://www.ozancaglayan.com
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150518/2be16b81/attachment.html>


More information about the IPython-dev mailing list