jupyter / nbgrader

A system for assigning and grading notebooks
https://nbgrader.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.3k stars 317 forks source link

Header not Compatible with Kernel Language #1820

Closed swissarthurfreeman closed 1 year ago

swissarthurfreeman commented 1 year ago

Operating system

Ubuntu 22.04 LTS on Docker

nbgrader --version

Python version 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
nbgrader version 0.8.4

jupyterhub --version (if used with JupyterHub)

4.0.2

jupyter lab --version

3.6.5

Expected behavior

When an instructor generates the student version of an assignement, the generated version should not have an additional useless cell with python syntax based variable definitions,

NAME = ""
COLLABORATORS = ""

Actual behavior

When instructor generates student version via formgrader, even without having such a cell, nbgrader's pipeline adds that cell at some point.

Steps to reproduce the behavior

Create example scala notebook using the deployment at this link : Accessing grader shared notebook server to create assignement, Example Scala Notebook

Output of Generation

When the user fetches it, the cell is there, User Fetched Notebook It of course does not compile as it is not valid scala code.

When user submits it and instructor autogrades, we get a compilation error. Same when student validates his notebook. Screenshot from 2023-08-28 12-58-48

How can we modify / remove the appending of that header cell for it to work with Scala ? Note that I would also like to keep this behavior for Python kernels.

Many thanks,

Gordon

brichet commented 1 year ago

The header shouldn't be include automatically. Did you generate the example from the nbgrader quickstart command ?

This command includes the following line in nbgrader_config.py: c.IncludeHeaderFooter.header = "source/header.ipynb" It also adds source/header.ipynb file, containing the cells you mentioned.

You can either comment/remove the config line in nbgrader_config.py file, or change the header notebook to something working with Scala.

swissarthurfreeman commented 1 year ago

Dear @brichet,

Thank you for your swift reply, it was indeed my mistake, I hadn't realised that nbrader quickstart was generating it's own config file which was overriding the one I had provided. The issue is now solved.

Many thanks !