Using jupygrader as a CLI Tool
The CLI tool is work-in-progress.
jupy grade
Grade one or more notebooks or patterns.
Usage
NOTEBOOK_PATH(required): One or more paths to notebooks, directories, or glob patterns.- If a file is given and ends with
.ipynb, it is added directly. - If a directory is given, all top-level
.ipynbfiles inside are included. - Otherwise, the argument is treated as a glob pattern and expanded recursively.
Examples
Example 1: Grade a single notebook
Example 2: Grade multiple specific notebooks
Example 3: Grade all notebooks in a directory
Example 4: Grade notebooks using a glob pattern and save results to a specific folder
Example 5: Regrade all notebooks, even if already graded, without creating a CSV:
Options
-
--verbose
Enable verbose output. Defaults tofalse. -
--export-csv / --no-export-csv
Export results to CSV. Enabled by default. -
--csv-output-path PATH
Directory to write CSV output into (does not need to exist yet).
Must be a directory if provided. -
--regrade-existing
Regrade even if results already exist. Defaults tofalse.
Behavior
- Prints the resolved list of notebooks to grade.
- Displays the effective option values.
- Calls the
grade_notebooksfunction to run grading logic.
jupy strip
Strip solution code and optionally outputs from a Jupyter Notebook.
Usage
NOTEBOOK_PATH(required): Path to a single Jupyter Notebook (.ipynbfile).
Must exist and be readable.OUTPUT_PATH(optional): Path to save the stripped notebook.
Defaults to[input]-stripped.ipynb.
Examples
Example 1: Strip a notebook and a new default output file
This will create assignment-1-stripped.ipynb.
Example 2: Strip a notebook and specify the exact output file path:
Behavior
- Validates that both input and output files are
.ipynb. - Determines an output path (default or user-specified).
- Reads the notebook, removes solution code, and clears outputs.
- Writes the processed notebook to the output path.
- Displays success or error messages.