Skip to main content

Grade Jupyter notebooks with Python scripts

Project description

Jupygrader

Hatch project

PyPI - Version PyPI - Python Version


Table of Contents

Summary

Jupygrader is a Python package for automated grading of Jupyter notebooks. It provides a framework to:

  1. Execute and grade Jupyter notebooks containing student work and test cases
  2. Generate comprehensive reports in multiple formats (JSON, HTML, TXT)
  3. Extract student code from notebooks into separate Python files
  4. Verify notebook integrity by computing hashes of test cases and submissions

Key Features

  • Executes notebooks in a controlled, temporary environment
  • Preserves the original notebook while creating graded versions
  • Adds grader scripts to notebooks to evaluate test cases
  • Generates detailed grading results including:
    • Individual test case scores
    • Overall scores and summaries
    • Success/failure status of each test
  • Produces multiple output formats for instructors to review:
    • Graded notebook (.ipynb)
    • HTML report
    • JSON result data
    • Plaintext summary
    • Extracted Python code
  • Includes metadata like Python version, platform, and file hashes for verification

Jupygrader is designed for educational settings where instructors need to grade student work in Jupyter notebooks, providing automated feedback while maintaining records of submissions and grading results.

Installation

pip install jupygrader

Update Jupygrader

pip install --upgrade jupygrader

Usage

import jupygrader

notebook_file_path = 'path/to/notebook.ipynb'
jupygrader.grade_notebook(notebook_file_path)

Specifying the output directory

import jupygrader

notebook_file_path = 'path/to/notebook.ipynb'
output_dir_path = 'path/to/output'

jupygrader.grade_notebook(
    notebook_path=notebook_file_path,
    output_path=output_dir_path
)

Test

hatch uses pytest as the test runner.

hatch test

Build and Publish

Build artifact

hatch build

Publish to PyPI

hatch publish

# username: __token__
# password: [your-token-value]

Alternatively, you can create a ~/.pypirc file with the token credentials.

~/.pypirc

[pypi]
username = __token__
password = [your-token-value]

License

jupygrader is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupygrader-0.1.2.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jupygrader-0.1.2-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file jupygrader-0.1.2.tar.gz.

File metadata

  • Download URL: jupygrader-0.1.2.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for jupygrader-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fa2873e3b691a95f234d2f545b9643bd03b23852a9f603e192abff8f6a0da58f
MD5 f60babb1324ccc1c67275bd202fbb494
BLAKE2b-256 0f9c2f742bbbdb83d5d309278f8adc8e5e586898ea580fc743a09438aeb1b7a9

See more details on using hashes here.

File details

Details for the file jupygrader-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: jupygrader-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for jupygrader-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5eee7cca0d16882e1c4462e64af6855e1c72a16f527e9019eade0830a8a9b9db
MD5 b36360f5d83940985d8e11edb24e63ce
BLAKE2b-256 1825ab49128f3905af576fbe11f6d7ee1a57516708735ac33e39e8618aadecfe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page