Metadata-Version: 2.4
Name: jupyterlab-anticheat
Version: 1.0.6
Summary: JupyterLab extension that blocks copy-paste in code cells to prevent cheating during exams
Author-email: Your Name <your@email.com>
License: MIT License
        
        Copyright (c) 2024
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: anti-cheat,education,exam,jupyter,jupyterlab,jupyterlab-extension
Classifier: Framework :: Jupyter
Classifier: Framework :: Jupyter :: JupyterLab
Classifier: Framework :: Jupyter :: JupyterLab :: 4
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# 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

```bash
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
