Skip to main content

ocdiff

Fast and simple side-by-side diff library for Python - wraps similar, inspired by icdiff.

Usage

pip install ocdiff
ocdiff.html_diff(
    a: str,
    b: str,
    context_lines: int | None = None,
    max_total_width: int | None = None,
) -> str
ocdiff.console_diff(
    a: str,
    b: str,
    context_lines: int | None = None,
    max_total_width: int | None = None,
) -> str

Example Output

Screenshot

CLI usage

ocdiff a.txt b.txt

pytest plugin

A pytest plugin is provided, it relies on the presence of rich, usage is:

pytest ... -vv --ocdiff

On the assumption that you are following the convention assert actual == expected, there is also:

pytest ... --copy-left

For snapshot testing on the cheap.

To customize the repr for both of the above, override the global ocdiff.pytest_plugin.PRETTY_REPR_CLS with a subclass of ocdiff.repr_helpers.PrettyRepr:




Install/Develop

uv pip install -e '.[dev]'
maturin develop

Make release

  • Add pypi token and user = __token__ to settings (do this once).
  • Upversion pyproject.toml.
export VERSION=$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])'); git tag -a v$VERSION head -m v$VERSION && git push origin v$VERSION

Metadata

Release files for ocdiff 0.0.51

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

Built distributions (wheels)

Table of built distributions (wheels) for ocdiff 0.0.51
File
ocdiff-0.0.51-cp314-cp314-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64 Details
ocdiff-0.0.51-cp314-cp314-manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ ARM64 Details
ocdiff-0.0.51-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
ocdiff-0.0.51-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
ocdiff-0.0.51-cp313-cp313-manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ ARM64 Details
ocdiff-0.0.51-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
ocdiff-0.0.51-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
ocdiff-0.0.51-cp312-cp312-manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64 Details
ocdiff-0.0.51-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details

Total release size: 2.4 MB

Release files / ocdiff-0.0.51-cp314-cp314-manylinux_2_28_x86_64.whl

Download URL ocdiff-0.0.51-cp314-cp314-manylinux_2_28_x86_64.whl
Size 282.5 kB
Tags CPython 3.14 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
5194f3ba27c457a06c949220f27f0b11c7868a0b3ebbb3ed6a371be1608d495b
BLAKE2b-256 checksum
How to use checksums
77e9c3be0a212cc5fde4a9dcf915d8825438bf570da1070fb560be430087c2e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / ocdiff-0.0.51-cp314-cp314-manylinux_2_28_aarch64.whl

Download URL ocdiff-0.0.51-cp314-cp314-manylinux_2_28_aarch64.whl
Size 261.8 kB
Tags CPython 3.14 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
61bdda2adf832f1c8b50e511aea39210de38e100ab366a7ceed44778e9a9d1d9
BLAKE2b-256 checksum
How to use checksums
157ea7851730cdb7401b8018c976f00b6ea865db9041c7275a3c043821877566
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / ocdiff-0.0.51-cp314-cp314-macosx_11_0_arm64.whl

Download URL ocdiff-0.0.51-cp314-cp314-macosx_11_0_arm64.whl
Size 243.0 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fc47714f7ea6e1f1c87aeb52942b00bcc2913375f24c476f506ca3c45d231536
BLAKE2b-256 checksum
How to use checksums
1a0d7131c7b9e8dac22385dc9fafb75246522b93c629f511660b902e10ada09c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / ocdiff-0.0.51-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL ocdiff-0.0.51-cp313-cp313-manylinux_2_28_x86_64.whl
Size 282.6 kB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
0d30fec63cf8dbd945352d1bfd967539e589382a4a4a67152c8fb9bd6ef2fe09
BLAKE2b-256 checksum
How to use checksums
4a3a17a572668743525aa02a137cb85b9dc70367da2df47ca09df537b46f5590
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / ocdiff-0.0.51-cp313-cp313-manylinux_2_28_aarch64.whl

Download URL ocdiff-0.0.51-cp313-cp313-manylinux_2_28_aarch64.whl
Size 262.2 kB
Tags CPython 3.13 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
4d80dab20219d3046862ff5f1795561655e56fe2a5555521563fc8cb849ec7c6
BLAKE2b-256 checksum
How to use checksums
8abc36649a6096daa224fc3f8f89db36ca884e5d07b0dc7b969468972811df4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / ocdiff-0.0.51-cp313-cp313-macosx_11_0_arm64.whl

Download URL ocdiff-0.0.51-cp313-cp313-macosx_11_0_arm64.whl
Size 243.1 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5af2eca54fcc00d3e3dfe41c84115bd49e37cf2d381cae69e44d94cffdd5be12
BLAKE2b-256 checksum
How to use checksums
32bd15a8be631d1987d27747d31be084a737b2caa677f892e1b066ce04fbd012
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ocdiff-0.0.51-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL ocdiff-0.0.51-cp312-cp312-manylinux_2_28_x86_64.whl
Size 282.5 kB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
90f594a95a27b9e4afbd85135b542e625558a2050d60997ed3a1745b6b010390
BLAKE2b-256 checksum
How to use checksums
f67712511636f30e78ff106fdf269c06cb56cd36e2fa1d4853f8e1fb0e088f7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / ocdiff-0.0.51-cp312-cp312-manylinux_2_28_aarch64.whl

Download URL ocdiff-0.0.51-cp312-cp312-manylinux_2_28_aarch64.whl
Size 262.3 kB
Tags CPython 3.12 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
50553336d22c584ea2819bd59038e56f85573a92ca681cb6f7f3472e7d799613
BLAKE2b-256 checksum
How to use checksums
7b86baa64fc91546d4e8d5e2f843ac55157b3fb7f83fd255dcb236aa0d7f3253
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / ocdiff-0.0.51-cp312-cp312-macosx_11_0_arm64.whl

Download URL ocdiff-0.0.51-cp312-cp312-macosx_11_0_arm64.whl
Size 243.0 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9bc23d004ef6622d982ded133f93f0e3c84053a915c2ed53414bf21376ea0532
BLAKE2b-256 checksum
How to use checksums
dd60c9fb44bf0f4a8e77ed7a28c7659c45db2d99efe1feaf8ddccbb86b2c2fad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for ocdiff 0.0.51

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.51 This release

9 release files No provenance

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