Skip to main content

libasslite

libasslite is a small PyO3 wrapper around the public libass rendering API. It owns the native library, renderer, and track handles and returns copied immutable image layers; no native pointer escapes into Python.

The wheel contains only the wrapper. It loads the parity-tested libass 0.17.1–0.17.5 range from the host at runtime, so applications can use the same system library as mpv. Set LIBASSLITE_LIBRARY or pass library_path= when automatic discovery cannot find it. The separately licensed libasslite-bundle package supplies a self-contained 0.17.5 runtime when installed; an explicit path still wins, and LIBASSLITE_BUNDLE=0 returns to system discovery.

from pathlib import Path

import libasslite

renderer = libasslite.AssRenderer(
    ass_bytes,
    fonts=[("subtitle-font.ttf", font_bytes)],
    library_path=Path("/opt/homebrew/lib/libass.dylib"),
    fonts_dir="/home/me/.config/mpv/fonts",
    extract_fonts=True,
    default_family="sans-serif",
    font_provider=libasslite.FontProvider.AUTODETECT,
    features=[(libasslite.Feature.WRAP_UNICODE, True)],
)
result = renderer.render(
    timestamp_ms=1_500,
    frame_size=(3024, 1898),
    storage_size=(1920, 1080),
    margins=(98, 99, 0, 0),  # top, bottom, left, right
    use_margins=False,
    max_bitmap_bytes=16 * 1024 * 1024,
    style=libasslite.RenderStyle(font_scale=1.0, line_position=0.0),
)
renderer.close()

Four font sources are available, matching what a player can offer libass: the system providers, a fonts_dir scanned for extra faces, fonts= bytes (ass_add_font, how a container's attachments arrive), and an [Fonts] section inside the document when extract_fonts=True. Set font_provider=libasslite.FontProvider.NONE to confine lookup to the first three.

RenderStyle carries the renderer state libass keeps between frames — font scale, line spacing and position, hinting, shaper, and selective style override. It is passed per render because every member of it is a function of the display geometry; omitting it restores libass's defaults, so one render's result never depends on the render before it. unsupported_features() reports the track features this libass build could not apply.

AssRenderResult.layers preserves libass list order. Each layer contains a tightly packed bytes bitmap (width * height), placement, 0xRRGGBBAA color, and public image type. Rendering releases Python and is serialized per renderer, making one renderer safe to use from background workers. max_bitmap_bytes stops traversal before copying a layer that would exceed the aggregate bitmap budget; omit it only when the caller owns an equivalent bound.

Installing libass

  • macOS: brew install libass
  • Debian/Ubuntu: install the runtime package providing libass.so.9 (currently libass9)
  • Windows: vcpkg install libass:x64-windows, then point LIBASSLITE_LIBRARY at the produced DLL

An existing mpv installation may already contain a usable library. Pass its exact DLL path rather than copying it elsewhere; adjacent runtime dependencies must remain discoverable by the operating system.

Scope

The package deliberately exposes only in-memory ASS loading, the four font sources, font lookup defaults, track features, frame/storage geometry, frame margins and margin policy, the between-frame renderer state, rendering, change detection, and copied image layers. It does not parse token spans, control mpv, schedule work, cache geometry, or bundle fonts/libass.

Licensing

libasslite is MIT. Its wheels do not distribute libass, FriBidi, HarfBuzz, FreeType, or a font provider; the dynamically loaded system installation keeps its own license and deployment obligations. See NOTICE.

Metadata

Release files for libasslite 0.2.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 libasslite 0.2.0
File Size Uploaded
libasslite-0.2.0.tar.gz 26.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for libasslite 0.2.0
File
libasslite-0.2.0-cp315-abi3.abi3t-win_amd64.whl CPython 3.15 abi3t, abi3 Windows x86-64 Details
libasslite-0.2.0-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl CPython 3.15 abi3t, abi3 Linux glibc 2.28+ x86-64 Details
libasslite-0.2.0-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl CPython 3.15 abi3t, abi3 Linux glibc 2.28+ ARM64 Details
libasslite-0.2.0-cp315-abi3.abi3t-macosx_11_0_arm64.whl CPython 3.15 abi3, abi3t macOS 11.0+ ARM64 Details
libasslite-0.2.0-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
libasslite-0.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64 Details
libasslite-0.2.0-cp314-cp314t-manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ ARM64 Details
libasslite-0.2.0-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details
libasslite-0.2.0-cp313-abi3-win_amd64.whl CPython 3.13 abi3 Windows x86-64 Details
libasslite-0.2.0-cp313-abi3-manylinux_2_28_x86_64.whl CPython 3.13 abi3 Linux glibc 2.28+ x86-64 Details
libasslite-0.2.0-cp313-abi3-manylinux_2_28_aarch64.whl CPython 3.13 abi3 Linux glibc 2.28+ ARM64 Details
libasslite-0.2.0-cp313-abi3-macosx_11_0_arm64.whl CPython 3.13 abi3 macOS 11.0+ ARM64 Details

Total release size: 3.0 MB

Release files / libasslite-0.2.0.tar.gz

Download URL libasslite-0.2.0.tar.gz
Size 26.1 kB
Tags Source
SHA-256 checksum
How to use checksums
01b7a5c83f6ffd4fc0ba812dc0a96ef1241515a9f5ae1d3c52450dae807d90c9
BLAKE2b-256 checksum
How to use checksums
2e33770c7c58985999736d63675ccda1608f64bf1235797b6356d5375e9e5236
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 24, 2026.

Transparency log

Release files / libasslite-0.2.0-cp315-abi3.abi3t-win_amd64.whl

Download URL libasslite-0.2.0-cp315-abi3.abi3t-win_amd64.whl
Size 189.6 kB
Tags CPython 3.15 Windows x86-64 abi3 abi3t
SHA-256 checksum
How to use checksums
2bf42ff2f5e8561109332c96a042fe132bf83df0a224a9b71f49d5c9e4e666c6
BLAKE2b-256 checksum
How to use checksums
baee665892f8ab950aa101c39f943ffd2d3ecf58f59adcd4801d1eb43c6793a8
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 24, 2026.

Transparency log

Release files / libasslite-0.2.0-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl

Download URL libasslite-0.2.0-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl
Size 291.0 kB
Tags CPython 3.15 Linux glibc 2.28+ x86-64 abi3 abi3t
SHA-256 checksum
How to use checksums
209328d181e56486324fd38ad57581b9d12a96a1dfb15c5096d4569d21ecbff6
BLAKE2b-256 checksum
How to use checksums
ae10bc605968ae9c4b576ce950fab102a1c8f8ef29332a0024d8e6691d78eefb
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 24, 2026.

Transparency log

Release files / libasslite-0.2.0-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl

Download URL libasslite-0.2.0-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl
Size 274.6 kB
Tags CPython 3.15 Linux glibc 2.28+ ARM64 abi3 abi3t
SHA-256 checksum
How to use checksums
8664b30f5c3843a64b6b97c8c32384354edb4945f68d62c4c569935a5f13f324
BLAKE2b-256 checksum
How to use checksums
b6a4c9331eb732a1e8b971a2f9e56e36d4afe88c9443d40e2d467bf5dd05d1d8
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 24, 2026.

Transparency log

Release files / libasslite-0.2.0-cp315-abi3.abi3t-macosx_11_0_arm64.whl

Download URL libasslite-0.2.0-cp315-abi3.abi3t-macosx_11_0_arm64.whl
Size 259.3 kB
Tags CPython 3.15 abi3 abi3t macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
00ca1baf6441ad91e1f9aa77dabf693196f0d3d18aa9e26237a7b3b19f97b959
BLAKE2b-256 checksum
How to use checksums
768f3cd13bffbd6b6f124d0155ccd9a3e5d8a7c59701905a286611212f46f184
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 24, 2026.

Transparency log

Release files / libasslite-0.2.0-cp314-cp314t-win_amd64.whl

Download URL libasslite-0.2.0-cp314-cp314t-win_amd64.whl
Size 176.6 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
ac4778b49dfd724adac42f8f9e6e1a46f67326df5a3cc0ca2ac6c2ee2dcb4587
BLAKE2b-256 checksum
How to use checksums
22680f6d5fefc855eacffbc443d6ad4beb192adf43f13a812d5a09cc615fb629
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 24, 2026.

Transparency log

Release files / libasslite-0.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl

Download URL libasslite-0.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl
Size 278.8 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
de6519b9854e5a8ec3e52005c65880f447fd863a00c71c121ccfe0e47725b581
BLAKE2b-256 checksum
How to use checksums
ad0a69acb3746e54dbd6be22322b6c18b5c35378a3eb0586154168d9ba9f4166
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 24, 2026.

Transparency log

Release files / libasslite-0.2.0-cp314-cp314t-manylinux_2_28_aarch64.whl

Download URL libasslite-0.2.0-cp314-cp314t-manylinux_2_28_aarch64.whl
Size 267.7 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
280855462cd13dfff4ee1f8e5d49e83c670b4e9cfa9efd6edad1114894bcf69d
BLAKE2b-256 checksum
How to use checksums
9278bc796cd41e86a7624a3585e830535be12934011d712ca1aa4403625286c9
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 24, 2026.

Transparency log

Release files / libasslite-0.2.0-cp314-cp314t-macosx_11_0_arm64.whl

Download URL libasslite-0.2.0-cp314-cp314t-macosx_11_0_arm64.whl
Size 250.1 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e8408ef075dbcdde221aae6f3e1a4061f07ad39c1b61a1c9396d1b4fd0700326
BLAKE2b-256 checksum
How to use checksums
57affcfa65a264b23ac68eac0ff9759de392b1bc23fd4afad8baff4e8b1bcccc
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 24, 2026.

Transparency log

Release files / libasslite-0.2.0-cp313-abi3-win_amd64.whl

Download URL libasslite-0.2.0-cp313-abi3-win_amd64.whl
Size 176.7 kB
Tags CPython 3.13 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e6159f8cb8a1bd3cba45455ff06dc1ccb5295b490bf68f51e2509209b8e5f990
BLAKE2b-256 checksum
How to use checksums
b082c7eeb2b47b53bcf038ef20628c27128bc71c0c5cf71c991d5a192a64a594
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 24, 2026.

Transparency log

Release files / libasslite-0.2.0-cp313-abi3-manylinux_2_28_x86_64.whl

Download URL libasslite-0.2.0-cp313-abi3-manylinux_2_28_x86_64.whl
Size 279.3 kB
Tags CPython 3.13 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
8d8be4d8623189996e99002c713e2b636040a55755c738547580cf36f873d9d3
BLAKE2b-256 checksum
How to use checksums
50a549abc6f5dd61586ca8afbf7419b41daa4bf37ba9e8c21f364243e6e80101
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 24, 2026.

Transparency log

Release files / libasslite-0.2.0-cp313-abi3-manylinux_2_28_aarch64.whl

Download URL libasslite-0.2.0-cp313-abi3-manylinux_2_28_aarch64.whl
Size 267.4 kB
Tags CPython 3.13 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
e055fc5bebcc5c0f23f4949a836e38e25c9a29fbeb4042b05a30cdbae08d49ef
BLAKE2b-256 checksum
How to use checksums
44a3448af02b9e7e24d31c20e3601ff6f9db33aae967532c19a7b3e774dfe609
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 24, 2026.

Transparency log

Release files / libasslite-0.2.0-cp313-abi3-macosx_11_0_arm64.whl

Download URL libasslite-0.2.0-cp313-abi3-macosx_11_0_arm64.whl
Size 249.8 kB
Tags CPython 3.13 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f00a6ad1adbf7f06aa010f4c9c056c9f542736ce03f73cbb4830180e260a0011
BLAKE2b-256 checksum
How to use checksums
6c91cb2f7b1f0b2ce711b5c70d6a0c6709ed880b128c975937548e791789cfa7
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 24, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.1

13 release files

This release

0.2.0 This release

13 release files

0.1.2

13 release files

0.1.0

13 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