Skip to main content

cairometal

A pycairo-compatible 2D vector-graphics backend that renders on the Apple GPU via Metal.

Independent project — not affiliated with the cairo graphics library or the official pycairo binding. It reimplements a compatible surface/context API on top of Metal.

Requirements

  • macOS (Apple Silicon). Metal is an Apple framework; there are no Linux/Windows builds.
  • Python 3.10+.

Install

pip install cairometal

Wheels are published per-CPython-version for macOS arm64. There is no on-the-fly compilation at install time — you get a prebuilt binary.

Usage

The API mirrors pycairo, so existing pycairo code largely works by changing the import:

import cairometal as cairo

surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 256, 256)
ctx = cairo.Context(surface)

ctx.set_source_rgb(0.13, 0.42, 0.96)
ctx.rectangle(32, 32, 192, 192)
ctx.fill()

ctx.set_source_rgb(1, 1, 1)
ctx.move_to(60, 140)
ctx.set_font_size(40)
ctx.show_text("Metal")

surface.write_to_png("out.png")   # rasterized on the GPU

What it is

cairometal implements cairo's drawing model — paths, fills, strokes, clips, groups, gradients, text, image surfaces, PNG output — with the rasterization running on the GPU through Metal. It's useful where you have GPU-bound 2D vector work; for light/typical cairo workloads the CPU pycairo is perfectly fine.

License

MIT — see LICENSE.

Metadata

Release files for cairometal 0.1.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 cairometal 0.1.0
File Size Uploaded
cairometal-0.1.0.tar.gz 324.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cairometal 0.1.0
File Interpreter ABI Platform
cairometal-0.1.0-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details

Total release size: 495.8 kB

Release files / cairometal-0.1.0.tar.gz

Download URL cairometal-0.1.0.tar.gz
Size 324.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c339ff7d8dcf3eb06458bb57e77e81bf0dd3458707bebe838797fb38f3522438
BLAKE2b-256 checksum
How to use checksums
53a8318aa6388bb91db9e08f9977ea64e37e59b783ed8f8bbce87139c8af5296
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / cairometal-0.1.0-cp314-cp314-macosx_11_0_arm64.whl

Download URL cairometal-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
Size 171.6 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fd16cfb531c31d278b96ea67b0a7abc78e363ba83a7484657d4c122d7887e247
BLAKE2b-256 checksum
How to use checksums
e565c679d4ea9de4c0a2b37ca4bf40af20ca6b60701d0e15187d8c2367f1f92e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 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