Skip to main content

File Diff Viewer

A simple file diff viewer built with PySide2 to do one job: compare the contents of two text files side by side.

image

What It Does

  • Load two files and view them side by side with sync scrolling.
  • Highlights differences to make changes easy to spot.

Install

You can install it using pip install diffview (requires Python 3.10) or by copying diffview/diffview.py into your source code, which is compatible with Python versions 3.7 and above.

How to Use

import os
from diffview import DiffViewer

# Create the diff viewer widget
diff_viewer = DiffViewer()

# Load some files into the sidebar for the user to select
diff_viewer.load_files(os.listdir())

# Show the widget
diff_viewer.show()

Or you can load buffers directly

diff_viewer.load_a_view(title='File A', content='abc')
diff_viewer.load_b_view(title='File B', content='abcd')

Note: You can also load files through the UI with the built-in file selection buttons.

Notes

  • This works with text files only.
  • The diffing logic is basic—line-level differences only. If you need something fancier, you should definitely look elsewhere.

Roadmap

  • Multi view scroll
  • File selector with last folder selected memory
  • Persisten settings: font options, colors, recent files
  • Shortcuts: font size (wheelScroll + ctrl)
  • Line wrap option
  • Tests
  • Line number?
  • Auto-Reload files?
  • Status for file changes?

Metadata

Release files for diffview 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for diffview 0.1.0
File Size Uploaded
diffview-0.1.0.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for diffview 0.1.0
File Interpreter ABI Platform
diffview-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.5 kB

Release files / diffview-0.1.0.tar.gz

Download URL diffview-0.1.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
28cf19a66a78fb563d5ade2f2b602186f40c802d1486bf99551c3719d32299ad
BLAKE2b-256 checksum
How to use checksums
07b9012c48f1f656d038895f12b2300bf13e7d92d27d5a044b5e269cf30534a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.13.0 Darwin/22.6.0

Release files / diffview-0.1.0-py3-none-any.whl

Download URL diffview-0.1.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fedfc3b822f8eb0515a550e86d76b702dd2ffa673ca8f4bde994c5059f86d16e
BLAKE2b-256 checksum
How to use checksums
0687a18af78b6f129f1e8b0ed7da259756c5625b5e1c4b0c5aea3b9bfec67de4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.13.0 Darwin/22.6.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page