Paste two versions of Python code, or drop .py and .pyi files, to see every change highlighted. Use it to compare two versions of a script, review a notebook export, or check what changed between releases of a module. Diffspot highlights Python syntax, marks changed words inside each line and recognizes moved blocks. Press Try an example to see it on a real Python change.
How to compare Python files
- Paste or drop the original Python code on the left.
- Paste or drop the changed version on the right. The diff updates as you type.
- Jump between changes with F7 and Shift+F7, or switch to Unified view to read it like a pull request.
- Copy or export a unified diff, a .patch file or an HTML report.
Python comparison tips
- Comparing PythonIndentation is part of Python's syntax, so leave whitespace comparison on (the default). Ignore changes in whitespace could hide a line that moved in or out of a block.
- Cut the noiseMoved a function to the bottom of the file? Diffspot marks it as moved rather than deleted and re-added.
- Your code stays privateThe comparison runs on your device in WebAssembly. Proprietary code is never uploaded or stored.
- Fast on large filesFiles with hundreds of thousands of lines compare in about a second.
Frequently asked questions
Is Python detected automatically?
Yes. Diffspot recognizes Python from the file name (.py and .pyi) or from the code itself. You can also choose it in the Syntax menu.
Is my code uploaded?
No. The page loads the diff engine once; after that your code stays in the browser tab. How Diffspot works explains how you can check this yourself.
Can I get a patch file?
Yes. Export → Download .patch creates a standard unified diff that git apply or patch can apply.