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. set_document() preserves the renderer's font cache but requires the initial feature sequence; a change raises RendererRecreationRequired before libass is called.

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.1

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.1
File Size Uploaded
libasslite-0.2.1.tar.gz 26.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for libasslite 0.2.1
File
libasslite-0.2.1-cp315-abi3.abi3t-win_amd64.whl CPython 3.15 abi3, abi3t Windows x86-64 Details
libasslite-0.2.1-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl CPython 3.15 abi3t, abi3 Linux glibc 2.28+ x86-64 Details
libasslite-0.2.1-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl CPython 3.15 abi3t, abi3 Linux glibc 2.28+ ARM64 Details
libasslite-0.2.1-cp315-abi3.abi3t-macosx_11_0_arm64.whl CPython 3.15 abi3, abi3t macOS 11.0+ ARM64 Details
libasslite-0.2.1-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
libasslite-0.2.1-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.1-cp314-cp314t-manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ ARM64 Details
libasslite-0.2.1-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details
libasslite-0.2.1-cp313-abi3-win_amd64.whl CPython 3.13 abi3 Windows x86-64 Details
libasslite-0.2.1-cp313-abi3-manylinux_2_28_x86_64.whl CPython 3.13 abi3 Linux glibc 2.28+ x86-64 Details
libasslite-0.2.1-cp313-abi3-manylinux_2_28_aarch64.whl CPython 3.13 abi3 Linux glibc 2.28+ ARM64 Details
libasslite-0.2.1-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.1.tar.gz

Download URL libasslite-0.2.1.tar.gz
Size 26.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e2218e188b69729c7e22dfca6aa66d7e26643fbbdd8814458f513493440708bc
BLAKE2b-256 checksum
How to use checksums
2e019bbf4c8f7b7959b8c16f87eec7f57f20c0eb9cc9d19ed46ed9b83e35f66e
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 Oct 11, 2026.

Transparency log

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

Download URL libasslite-0.2.1-cp315-abi3.abi3t-win_amd64.whl
Size 193.6 kB
Tags CPython 3.15 Windows x86-64 abi3 abi3t
SHA-256 checksum
How to use checksums
50554878aea4e78e3a85fddba9e0c048e7305266d1d4fead26a14d48288a6523
BLAKE2b-256 checksum
How to use checksums
2158ecc7de4ec356fd7342e2e726eee47bb14a95637dc6c5468a5ee528221fd2
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 Oct 11, 2026.

Transparency log

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

Download URL libasslite-0.2.1-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl
Size 288.0 kB
Tags CPython 3.15 Linux glibc 2.28+ x86-64 abi3 abi3t
SHA-256 checksum
How to use checksums
83d2746a17809e857c80841d70ec85c0e750f2668ce086779f37dcb41c2fbb6e
BLAKE2b-256 checksum
How to use checksums
51c83b14bb6a6397e11d2b45897980c0eed1c7c71aa21b286afb5c379de5c9d3
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 Oct 11, 2026.

Transparency log

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

Download URL libasslite-0.2.1-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl
Size 273.2 kB
Tags CPython 3.15 Linux glibc 2.28+ ARM64 abi3 abi3t
SHA-256 checksum
How to use checksums
f66889ba138d2d43af15f0d4d8827709d4ac2ad019fba7b282fb09e46d7bcfeb
BLAKE2b-256 checksum
How to use checksums
f83691917b5d817047db88294e06684042df8daf24f19606377490a0e03cc00c
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 Oct 11, 2026.

Transparency log

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

Download URL libasslite-0.2.1-cp315-abi3.abi3t-macosx_11_0_arm64.whl
Size 258.3 kB
Tags CPython 3.15 abi3 abi3t macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bc4e0f56d49b1a78ebc5eb4cc6a6ceca109c6b116ddccd70065c2220adc97cb7
BLAKE2b-256 checksum
How to use checksums
37d9c2d46afcad79bdfc1b9cf2e840ea1ac327c2229895d6ecbebfcfa1c7a5a6
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 Oct 11, 2026.

Transparency log

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

Download URL libasslite-0.2.1-cp314-cp314t-win_amd64.whl
Size 179.7 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
b5099bce12d0fdaf9632911e4c0afbf804c39df92a9a9feffdee02f071d76db7
BLAKE2b-256 checksum
How to use checksums
1de0b7b45c05fc430ac6dd101eed200e0e9edbc6a6e5e76010a2ed42436a036a
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 Oct 11, 2026.

Transparency log

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

Download URL libasslite-0.2.1-cp314-cp314t-manylinux_2_28_x86_64.whl
Size 277.9 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
acfec139cfbd5b934f72714c658360f69b0c0fa08f1df42cc569e6a9355c48d5
BLAKE2b-256 checksum
How to use checksums
52a4f9ab8e4b73c4f0f3ecd62ebd0157c037b30b123c7855b5c455302f73365f
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 Oct 11, 2026.

Transparency log

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

Download URL libasslite-0.2.1-cp314-cp314t-manylinux_2_28_aarch64.whl
Size 267.0 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
69f2102fcba3fb22f34fca44a8fc6287da5b391a1dfc0700e07ef3a0b0ed4e2b
BLAKE2b-256 checksum
How to use checksums
ca2d37e8a356058f8369ae4fb55780cf81085cb85225b36648d44787e59d2157
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 Oct 11, 2026.

Transparency log

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

Download URL libasslite-0.2.1-cp314-cp314t-macosx_11_0_arm64.whl
Size 248.9 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
20c03d9d8ab1d2608b148464b1206742d127ad8288dd851f67fd5e2d0d9f99ab
BLAKE2b-256 checksum
How to use checksums
4dd04b9e61f0c83312c94fd5b02900eab4aa9c2822557d57661892e194e5452c
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 Oct 11, 2026.

Transparency log

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

Download URL libasslite-0.2.1-cp313-abi3-win_amd64.whl
Size 179.8 kB
Tags CPython 3.13 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
101e3d2a661000ad7b96c075feca2516fb7c9e4d7636863b2fa75f91d113abb5
BLAKE2b-256 checksum
How to use checksums
c187346fa79a30482fc4a41d47411ba0b7da0622404e9afdde888945f51679bb
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 Oct 11, 2026.

Transparency log

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

Download URL libasslite-0.2.1-cp313-abi3-manylinux_2_28_x86_64.whl
Size 278.8 kB
Tags CPython 3.13 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
6964ba7fb47325f7406e5281a33fdbc7d6cbd1918f028954ad83f322f3223038
BLAKE2b-256 checksum
How to use checksums
c1617a7f79706be7b7f2610430ec5bf7c08a029ba906c993d721e9046164f143
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 Oct 11, 2026.

Transparency log

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

Download URL libasslite-0.2.1-cp313-abi3-manylinux_2_28_aarch64.whl
Size 266.5 kB
Tags CPython 3.13 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
99d7c43d9f059d34c6ab4d00a625b6c18f0831f97d57c9cc50d09bdd4b08af31
BLAKE2b-256 checksum
How to use checksums
40bf0bccc717a4461d5ed814d89a23ad7d07979fd3baaa83ae26b0326a2ef10b
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 Oct 11, 2026.

Transparency log

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

Download URL libasslite-0.2.1-cp313-abi3-macosx_11_0_arm64.whl
Size 250.0 kB
Tags CPython 3.13 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7fb4f55fcdd2ab2212f0f98c7f6147606359da8dc391329a3c09eb12efa87d66
BLAKE2b-256 checksum
How to use checksums
d96a94dd6cfa9e62f8d499c243a828e5100f6513a9a9c27bcbdcab6fdee7d22a
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 Oct 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

13 release files

0.2.0

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