Skip to main content

larzdiff

Human-readable diffs of two values — see exactly what changed.

When a test fails or two things should match but don't, you need to see the difference at a glance, not squint at two big blobs. larzdiff compares two values — strings, lists, dicts, or scalars — and describes exactly what changed: which keys, which lines, which items. Perfect for test failure messages and debugging. Zero third-party dependencies.

Install

pip install larzdiff

Use

from larzdiff import diff

print(diff({"a": 1, "b": 2}, {"a": 1, "b": 3}))   # ~ 'b': 2 -> 3
print(diff([1, 2, 3], [1, 9, 3]))                 # ~ [1] 2 -> 9
print(diff("line one\nline two", "line one\nline 2"))

Learn to code with Larz

Part of the learn-to-code toolkit in the Larz stack — see the Learn to Code platform. Pairs with larztest.

Tests

python -m unittest discover -s tests -v   # 7 tests

License

MIT (c) larz-scripter

Download files

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

Source Distribution

larzdiff-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

larzdiff-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file larzdiff-0.1.0.tar.gz.

File metadata

  • Download URL: larzdiff-0.1.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for larzdiff-0.1.0.tar.gz
Algorithm Hash digest
SHA256 26c3b574ae419cbfe979ab89417067fef68b6697400bc53412672f1ae2422e17
MD5 aba87640f3c9e706c79654caeb9198fd
BLAKE2b-256 cb6e0374d9446c93064e80ea9ed40032a6d04967c5c83e37d1ca0465bb0ba273

See more details on using hashes here.

File details

Details for the file larzdiff-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: larzdiff-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for larzdiff-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fcc0cff384dac8ae2b30d25309bceceaa0c61d340b66a64d187d2299d27acdfe
MD5 5179ce00003ebadeb3cdfd2c6bb68ae0
BLAKE2b-256 adddd8fe175ad97a083ad830afd14a60b738875cbb9b0cc00dc8badc58b70ce2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 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