Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents

  1. Purpose
  2. Instructor container
    1. Customization
      1. instructor-container/nbgrader_config.py
      2. instructor-container/notebook.py
      3. instructor-container/remove_test_from_feedback.py
      4. instructor-container/Dockerfile
    2. Creating the container image
    3. Running the container
  3. Student container
    1. student-container/Dockerfile
    2. Creating the container image
  4. Sample notebook

Purpose

This project contains all the files requiered to build:

  • a container image for the instructor with Jupyter notebooks, a Java Kernel and NBGrader to create assignments
  • a container image for the students with Jupyter notebooks and a Java Kernel to do the assignments.

Students can run the container installing docker in their computers, inside a small virtual machine (with Alpine Linux and docker) or remotely via JupyterHub. For deployment options you can check (in Spanish):

@Conference{Gutierrez-2023-jupyter-java-nbgrader-jupyterhub-openstack,
  author       = "Juan Gutiérrez-Aguado and Ignacio García-Fernandez and Manolo Pérez-Aixendri",
  title        = "Uso de Jupyter notebooks y nbgrader para ofrecer retroalimentación en una asignatura de programación",
  year         = "2023",
  pages        = "1-8",
  month        = "July",
  address      = "Granada (Spain)",
  organization = "AENUI",
}

Instructor container

Customization

File instructor-container/nbgrader_config.py

This file contains the following configuration:

  • That all the notebooks will be created under a folder named Tareas and will be located under /home/jovyan.
  • The folder where the assignments will be deployed by nbgrader is /srv/nbgrader/exchange.
  • The instructor will use //BSOL and //ESOL to write the solution. All the code that is between those comments will be removed when nbgrader generates the student version of the assigments.
  • Test that are between //BTEST and //ETEST will not be included in the student version.

You can adapt all these values to your needs before creating the container image. If you change the CourseDirectory values you will have to adapt that accordingly in the Dockerfile and in the python file remove_test_from_feedback.py.

File instructor-container/notebook.py

Configuration for the indentation (3 spaces).

File instructor-container/remove_test_from_feedback.py

This file a hook is used to remove the solution from the feedback (according to the delimiters defined in container/nbgrader_config.py:

File instructor-container/Dockerfile

From a base image with Jupyter all the dependencies are installed and the configurations files are copied to the image.

Finally nbgrader is configured to use the folder Tareas (you can change that folder, but remember to be consistent across all provided files).

Creating the container image

cd instructor-container
# This instruction assumes that you have docker in your machine
docker build . -t jupyter-java-nbgrader:1.0

Running the container

# This is the folder where the assigments and student versions will be in
# your file system. Adapt to your needs
courseDir=/home/instructor/course/

# Directory with the assignments
dirTareas=$courseDir/Tareas
mkdir -p $dirTareas

# Directory where nbgrader will export the student version of the assignments
dirExchange=$courseDir/exchange
mkdir -p $dirExchange

# Running the container the first time
docker run --name jnb -v $dirExchange:/srv/nbgrader/exchange -v $dirTareas:/home/jovyan/Tareas -p 8888:8888 jupyter-java-nbgrader:1.0
# Check the URL with the token and open your browser

# Stopping the container
docker stop jnb

# Restating the container
docker start jnb

# Check the logs to see the URL and the token
docker logs jnb

Student container

student-container/Dockerfile

This image does not contain the nbgrader extension, and can be uploaded to dockerhub, encapsulated in a VM to be distributed to the studens, or can be used in a JupyterHub deployment.

Creating the container image

cd student-container
# This instruction assumes that you have docker in your machine
docker build . -t jupyter-java:1.0

Sample notebook

There is a folder with an example of the student version (generated by nbgrader) of an assignment about Java Interfaces (this sample notebook is in Spanish). This notebook includes some test, so students can check whether their solutions are correct.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages