Skip to main content

typdiff-py

CI PyPI

Python bindings for typdiff, a diff tool for Typst documents, similar to latexdiff for LaTeX.

typdiff compares two Typst source files and generates a new Typst document that visually highlights the differences — added text in blue with underline and deleted text in red with strikethrough. This package wraps the typdiff Rust crate directly via pyo3 (no subprocess, no separate binary to install) and ships prebuilt wheels for Linux (x86_64/aarch64/armv7/s390x/ppc64le), macOS, and Windows.

This is an independent, standalone project — the typdiff maintainer preferred to keep Python bindings out of the main repository, so they live here instead.

Installation

pip install typdiff

Usage

import typdiff

diff = typdiff.diff(old_bytes, new_bytes)  # from bytes
diff = typdiff.diff_files("old.typ", "new.typ")  # from file paths (str or Path)

diff() takes and returns bytes, matching how typst's compile() treats bytes as inline source (a plain str argument is instead treated as a path to read) — so typdiff's output can be passed straight into compile(). diff_files() still takes file paths as str/Path, since those are paths rather than document content.

Producing a PDF

Combine typdiff with typst (Python bindings for the Typst compiler, pip install typst) to go straight from two Typst files to a diff PDF, without shelling out to either CLI:

import typdiff
import typst

diff = typdiff.diff_files("old.typ", "new.typ")
pdf_bytes = typst.compile(diff)

Example

Given an old document:

= Introduction

This is the old text.

- First item
- Second item

== Details

The quick brown fox jumps over the lazy dog.

And a new document:

= Background

This is the new text.

- First item
- Third item
- Fourth item

== Details

The quick red fox leaps over the lazy cat.

typdiff.diff_files("old.typ", "new.typ") produces:

= #diff-deleted[Introduction]

= #diff-added[Background]

This is the #diff-deleted[old]#diff-added[new] text.

- First item

- #diff-deleted[Second]#diff-added[Third] item

- #diff-added[Fourth item]

== Details

The quick #diff-deleted[brown]#diff-added[red] fox #diff-deleted[jumps]#diff-added[leaps] over the lazy #diff-deleted[dog]#diff-added[cat].

See also

  • typdiff — the underlying Rust CLI and library.
  • typst-py — Python bindings for Typst itself, used above to compile the diff output to a PDF.

License

Apache-2.0

Download files

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

Source Distribution

typdiff-0.1.2.tar.gz (15.1 kB view details)

Uploaded Source

Built Distributions

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

typdiff-0.1.2-cp38-abi3-win_amd64.whl (319.7 kB view details)

Uploaded CPython 3.8+Windows x86-64

typdiff-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (467.2 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

typdiff-0.1.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (495.3 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ s390x

typdiff-0.1.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (600.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ppc64le

typdiff-0.1.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (469.3 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARMv7l

typdiff-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (453.6 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

typdiff-0.1.2-cp38-abi3-macosx_11_0_arm64.whl (415.4 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

typdiff-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl (421.4 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file typdiff-0.1.2.tar.gz.

File metadata

  • Download URL: typdiff-0.1.2.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for typdiff-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ee1fd663546ad9a0a3a14b6257b6d49e3abb346acab5ac4d34cbeb6096339bbc
MD5 b3fa56ccdfd377730e6573e9d5e4734c
BLAKE2b-256 d2ebf0a11629a883f4bde90226a33f6f6f497baea2fc5a7b63a759a3f707b66d

See more details on using hashes here.

Provenance

The following attestation bundles were made for typdiff-0.1.2.tar.gz:

Publisher: release.yml on imphil/typdiff-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file typdiff-0.1.2-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: typdiff-0.1.2-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 319.7 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for typdiff-0.1.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5c2f412cc17c653fb76f6a0f934b2949aa47d77fcf07c3516a4a30c40676b7e5
MD5 e7ed0e6d7727444e6223dcf4a49d5fc3
BLAKE2b-256 542135d17e5f7e3c5d601a48fd158a92f647795207e77be39f3dae17745d80bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for typdiff-0.1.2-cp38-abi3-win_amd64.whl:

Publisher: release.yml on imphil/typdiff-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file typdiff-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for typdiff-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 86d7e0c3efda791770f1efd48c31c32b0e183909ae723a7210b3e67695a05f80
MD5 46fe0d5b9152f26efc3b1c144e5c8458
BLAKE2b-256 af6eebabd0067bcd28b2d12c5178dbe2a058ee48795d1eb262af1d852d1488da

See more details on using hashes here.

Provenance

The following attestation bundles were made for typdiff-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on imphil/typdiff-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file typdiff-0.1.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for typdiff-0.1.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 bca8d3f9c37e5440991dcf35981e78ef47a89b758928f488cd061dc517d47f1a
MD5 9bb353f7c584afc039d0403eaed7ebb6
BLAKE2b-256 5673031982a7c3c482fe003c1fb284d99f4c86a5d47cc7220ba2aad618eae9fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for typdiff-0.1.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl:

Publisher: release.yml on imphil/typdiff-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file typdiff-0.1.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for typdiff-0.1.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 40b435de0fae2bef84fc1e35ff9a8a425763b34c5d34d5d5951af581806ab0f4
MD5 ea9921ce63a27a8f2c3951f3fad6fd25
BLAKE2b-256 5f1f00d73620591d209d92ce50ae9d24349d14528608d009cec033f7dd605a09

See more details on using hashes here.

Provenance

The following attestation bundles were made for typdiff-0.1.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl:

Publisher: release.yml on imphil/typdiff-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file typdiff-0.1.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for typdiff-0.1.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 6298ea3f64a6226bf7b4a71ebc26065c752dd2f400154718a231fa54fecfd2ba
MD5 ac720572f6aa17cda3df96197583c904
BLAKE2b-256 60b4357a648b364c6f837dc4bd2723cd1efc4d891c1a9cd9d2cf7e56d3c3bee6

See more details on using hashes here.

Provenance

The following attestation bundles were made for typdiff-0.1.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl:

Publisher: release.yml on imphil/typdiff-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file typdiff-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for typdiff-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 76afc9a68e1c585ef2161f66738d8d7e8e9626f3dfb349697f06dfe73aee5a93
MD5 bf05d24a65e5fa9c20741f98b0605eee
BLAKE2b-256 6500e59f2682611b1b0771bc68f9c024bdca0ffc01d41d2f3adef9315e8172ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for typdiff-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on imphil/typdiff-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file typdiff-0.1.2-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for typdiff-0.1.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9c1eb9f3be7357269f96e192b741c2a952a7993abdd95e3eea90de78a0744f6b
MD5 76f970fdc4763fb1787cddc16e25efc0
BLAKE2b-256 6322d0992da87a106005d30e7f44fc2ce75f3882626660e3b844be0f8f7673a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for typdiff-0.1.2-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on imphil/typdiff-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file typdiff-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for typdiff-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8e1fa75c66d1f5544fc07f961faa6a95ecbebcc06f99d0fa64a52698458065b5
MD5 2decd25caa9c7d488646770074fdc980
BLAKE2b-256 2a61e282de0382d2ccce758264c7dfdba4075a6751edd591bbd4a219fec74c0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for typdiff-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on imphil/typdiff-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.2 This release

9 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page