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

Metadata

Release files for typdiff 0.1.2

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

Source distribution (sdist)

Source distribution for typdiff 0.1.2
File Size Uploaded Provenance
typdiff-0.1.2.tar.gz 15.1 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for typdiff 0.1.2
File
typdiff-0.1.2-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
typdiff-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details
typdiff-0.1.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl CPython 3.8 abi3 Linux glibc 2.17+ IBM System/390x Details
typdiff-0.1.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl CPython 3.8 abi3 Linux glibc 2.17+ PowerPC 64-le Details
typdiff-0.1.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.8 abi3 Linux glibc 2.17+ ARMv7l Details
typdiff-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details
typdiff-0.1.2-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
typdiff-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details

Total release size: 3.7 MB

Release files / typdiff-0.1.2.tar.gz

Download URL typdiff-0.1.2.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ee1fd663546ad9a0a3a14b6257b6d49e3abb346acab5ac4d34cbeb6096339bbc
BLAKE2b-256 checksum
How to use checksums
d2ebf0a11629a883f4bde90226a33f6f6f497baea2fc5a7b63a759a3f707b66d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release files / typdiff-0.1.2-cp38-abi3-win_amd64.whl

Download URL typdiff-0.1.2-cp38-abi3-win_amd64.whl
Size 319.7 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
5c2f412cc17c653fb76f6a0f934b2949aa47d77fcf07c3516a4a30c40676b7e5
BLAKE2b-256 checksum
How to use checksums
542135d17e5f7e3c5d601a48fd158a92f647795207e77be39f3dae17745d80bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release files / typdiff-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL typdiff-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 467.2 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
86d7e0c3efda791770f1efd48c31c32b0e183909ae723a7210b3e67695a05f80
BLAKE2b-256 checksum
How to use checksums
af6eebabd0067bcd28b2d12c5178dbe2a058ee48795d1eb262af1d852d1488da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release files / typdiff-0.1.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL typdiff-0.1.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Size 495.3 kB
Tags CPython 3.8 Linux glibc 2.17+ IBM System/390x abi3
SHA-256 checksum
How to use checksums
bca8d3f9c37e5440991dcf35981e78ef47a89b758928f488cd061dc517d47f1a
BLAKE2b-256 checksum
How to use checksums
5673031982a7c3c482fe003c1fb284d99f4c86a5d47cc7220ba2aad618eae9fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release files / typdiff-0.1.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL typdiff-0.1.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Size 600.5 kB
Tags CPython 3.8 Linux glibc 2.17+ PowerPC 64-le abi3
SHA-256 checksum
How to use checksums
40b435de0fae2bef84fc1e35ff9a8a425763b34c5d34d5d5951af581806ab0f4
BLAKE2b-256 checksum
How to use checksums
5f1f00d73620591d209d92ce50ae9d24349d14528608d009cec033f7dd605a09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release files / typdiff-0.1.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL typdiff-0.1.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 469.3 kB
Tags CPython 3.8 Linux glibc 2.17+ ARMv7l abi3
SHA-256 checksum
How to use checksums
6298ea3f64a6226bf7b4a71ebc26065c752dd2f400154718a231fa54fecfd2ba
BLAKE2b-256 checksum
How to use checksums
60b4357a648b364c6f837dc4bd2723cd1efc4d891c1a9cd9d2cf7e56d3c3bee6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release files / typdiff-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL typdiff-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 453.6 kB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
76afc9a68e1c585ef2161f66738d8d7e8e9626f3dfb349697f06dfe73aee5a93
BLAKE2b-256 checksum
How to use checksums
6500e59f2682611b1b0771bc68f9c024bdca0ffc01d41d2f3adef9315e8172ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release files / typdiff-0.1.2-cp38-abi3-macosx_11_0_arm64.whl

Download URL typdiff-0.1.2-cp38-abi3-macosx_11_0_arm64.whl
Size 415.4 kB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9c1eb9f3be7357269f96e192b741c2a952a7993abdd95e3eea90de78a0744f6b
BLAKE2b-256 checksum
How to use checksums
6322d0992da87a106005d30e7f44fc2ce75f3882626660e3b844be0f8f7673a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release files / typdiff-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl

Download URL typdiff-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl
Size 421.4 kB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8e1fa75c66d1f5544fc07f961faa6a95ecbebcc06f99d0fa64a52698458065b5
BLAKE2b-256 checksum
How to use checksums
2a61e282de0382d2ccce758264c7dfdba4075a6751edd591bbd4a219fec74c0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Security for typdiff 0.1.2

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.

Full provenance

All 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for typdiff-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.2 This release

9 release files Full 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