Skip to main content

JupyterLab extension that blocks copy-paste in code cells to prevent cheating during exams

Project description

jupyterlab-anticheat

A JupyterLab extension that blocks copy-paste in code cells to prevent cheating during university programming exams. Students are required to type code manually, reinforcing genuine learning.

Features

  • Blocks Ctrl+V / Cmd+V keyboard paste in code cells
  • Blocks drag-and-drop of code into cells
  • Blocks right-click → Paste from the context menu
  • Shows a clear red notification message to the student
  • Works in Anaconda JupyterLab and web-hosted JupyterLab (both run in a browser)
  • Instructor can enable/disable via Command Palette or Settings
  • Configurable block message via Settings

Installation

cd jupyterlab-anticheat
pip install -e .
jupyter labextension develop --overwrite .

See install.txt for full step-by-step instructions.

Instructor Controls

Open the Command Palette (Ctrl+Shift+C) and search for AntiCheat to:

  • Enable paste blocking (Exam Mode)
  • Disable paste blocking
  • Toggle paste blocking

Settings

Go to Settings → Advanced Settings Editor → AntiCheat Exam Extension to configure:

  • enabled — turn blocking on or off (default: true)
  • message — customize the message shown when paste is blocked

How It Works

The extension registers event listeners at the document level using capture phase (addEventListener(..., true)), which means it intercepts events before JupyterLab's editor (CodeMirror) can process them. It checks whether the target element is inside a code cell and, if so, cancels the event and displays a notification.

Limitations

  • A technically advanced student could open browser DevTools and disable the extension from the console. For high-stakes exams, combine with browser lockdown tools.
  • Does not block paste in Markdown cells (intentional — Markdown editing is not exam content).

License

MIT

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

jupyterlab_anticheat-1.0.1.tar.gz (145.7 kB view details)

Uploaded Source

Built Distribution

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

jupyterlab_anticheat-1.0.1-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file jupyterlab_anticheat-1.0.1.tar.gz.

File metadata

  • Download URL: jupyterlab_anticheat-1.0.1.tar.gz
  • Upload date:
  • Size: 145.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for jupyterlab_anticheat-1.0.1.tar.gz
Algorithm Hash digest
SHA256 65655530a1a2e002dcd78c924efb7ce57f83a370f821c3504f8c023615126339
MD5 8154640c52c2adf0017f71f6e6b8e566
BLAKE2b-256 fb00e169e03790f017cde7d3b20666ce9a3de54ce3d0e44ce30a2d879b29fd34

See more details on using hashes here.

File details

Details for the file jupyterlab_anticheat-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyterlab_anticheat-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7e31d4f99e1636d0185c6973f13e7a12a7d3432290fcc2507d2ffdc40eebcde6
MD5 381f0f534ca806d047d0907ffc0fe84b
BLAKE2b-256 fb967ccd0c0bf755ff2d63546ca4edf00f5d0af572e7ed20e6689e7bfaff7447

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