{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Sharing notebooks with your students\n", "\n", "Notebooks are simple text files, so they can easily be shared by usual means e.g. **uploaded on Moodle**, sent by email, etc. like you would do with any other type of document (pdf, doc, etc.). \n", "To execute a notebook, students can then simply **upload it to  ![noto](../Images/noto_inline_transparent.png)** by **drag-and-dropping the file onto their workspace** (of course, they can also execute a notebook in their own Jupyter environment if they have installed one on their laptop). \n", "But these methods have a few drawbacks:\n", "* Students cannot easily see the content of a notebook unless they execute it\n", "* If the notebook reads data from other files, then you also have to share these other files with the notebook\n", "\n", "In the following, we present a much more powerful way of **sharing your notebooks using simple shareable links** using a mechanism called `nbgitpuller`.
\n", "A **requirement** for using this method is to host the notebooks you want to share in a `git` repository. \n", "In exchange, this method will allow you to **generate shareable links** for any of the notebooks from this repository, that you can then **publish on your Moodle page**. Students clicking on it will get instant access to the notebook and will be able to execute it directly on  ![noto](../Images/noto_inline_transparent.png).\n", "\n", "## Putting your notebooks in a `git` repository\n", "\n", "See [this notebook for more information](../HowTos/SharingYourNotebooks/SharingYourNotebooks.ipynb).\n", "\n", "## Who can get access to notebooks this way?\n", "\n", "To be able to generate `nbgitpuller` links, you must allow **public reading access** to the `git` repository hosting your notebooks. \n", "\n", "The `nbgitpuller` links allow you to share your notebooks using  ![noto](../Images/noto_inline_transparent.png). This means that this method of sharing notebooks works with anyone being able to log on  ![noto](../Images/noto_inline_transparent.png), i.e. all EPFL members and all members of [universities with Switch-AAI authentication](https://www.switch.ch/aai/participants/homeorgs/). \n", "\n", "\n", "## Preparing and testing the `nbgitpuller` link\n", "\n", "In order to build the `nbgitpuller` link, you need to go to: [https://jupyterhub.github.io/nbgitpuller](https://jupyterhub.github.io/nbgitpuller/link?hub=https://noto.epfl.ch). Then you need to fill out the form. In the following we provide an example allowing to create a link to this notebook. You have to **adapt the parameters for *your* repository!**\n", "\n", "1. JupyterHub URL: https://noto.epfl.ch\n", "1. Git Repository URL: https://c4science.ch/source/noto-poc-notebooks (<= without the '.git' extension !)\n", "1. Branch: (none) (<= leave blank or set this up as needed)\n", "1. File to open: TeachingHowTos/SharingNotebooksWithStudents.ipynb (<= this is the path to your notebook inside your repository)\n", "1. Application to Open: JupyterLab\n", "\n", "The result, displayed *at the top of the page*, is a link similar to:\n", "`https://noto.epfl.ch/hub/user-redirect/git-pull?repo=https%3A%2F%2Fc4science.ch%2Fsource%2Fnoto-poc-notebooks&urlpath=lab%2Ftree%2Fnoto-poc-notebooks%2FTeachingHowTos%2FSharingNotebooksWithStudents.ipynb`\n", "\n", "## Testing the link\n", "By pasting the link in your web browser, you should get sent to the desired notebook.\n", "**Note that if you already have an opened Noto session in your browser, jupyterlab will create a new session automatically.**\n", "\n", "## Choosing the `depth` of cloning\n", "\n", "By default, the entire history of the git repository is pulled in the user's workspace. This might be slow if your git repository is large or if a large number of students are going to pull at the same time. You can set this to 1 to pull only the latest commit on initial pull, like so:\n", "\n", "`https://noto.epfl.ch/hub/user-redirect/git-pull?repo=https%3A%2F%2Fc4science.ch%2Fsource%2Fnoto-poc-notebooks&urlpath=lab%2Ftree%2Fnoto-poc-notebooks%2FTeachingHowTos%2FSharingNotebooksWithStudents.ipynb&depth=1`\n", "\n", "(just by adding `&depth=1`)\n", "\n", "\n", "## Sharing the link\n", "\n", "Once you are happy and ready to share your link, it is time to make it pretty!
\n", "For that, you can use a URL shortening service such as [go.epfl.ch](https://go.epfl.ch). For instance, [`go.epfl.ch/noto-share`](https://go.epfl.ch/noto-share) is a pretty link to this notebook based on the URL we have generated in the previous section.\n", "\n", "\n", "Using `go.epfl.ch`, you can create there short and nice looking links that you will be able to distribute by email, your Moodle page, etc. \n", "It is also worth noting that you will get (basic but useful) statistics on your URLs, which is nice!" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.9" } }, "nbformat": 4, "nbformat_minor": 4 }