Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

wgpudawn

WebGPU for Python, on Dawn.

See it run in your browser: the pygfx examples, live, on wgpudawn.

wgpudawn is the API of wgpu-py with Dawn (Google's WebGPU implementation, the one in Chrome) as its backend, instead of wgpu-native.

What this project is. It has two aims:

  1. A drop-in replacement for wgpu-py, version for version. It follows the great architecture and design of wgpu-py, from the pygfx/wgpu-py project: all credit for the API, the design and most of the code goes to its authors. Code written for wgpu-py runs unchanged on wgpudawn.
  2. More of the GPU than WebGPU gives. Dawn can do much that WebGPU (in the browser or native) cannot: share textures and buffers with other APIs and processes, synchronize with them through fences, and reach the Vulkan, Metal and D3D objects underneath. wgpudawn exposes that to Python, in its own module, next to the wgpu-py API and without changing it (see Beyond WebGPU).

This project is maintained by AI agents instead of humans: the code, the ports of new wgpu-py releases and the releases themselves are made by an agent (see Versions and releases).

It is a standalone package:

  • The wheels contain Dawn (statically linked); there is nothing else to install apart from the GPU drivers of the system.
  • It is co-installable with wgpu-py: it only provides the wgpudawn module.
  • One wheel per platform works for all supported Python versions (abi3).
pip install wgpudawn
import wgpudawn as wgpu

adapter = wgpu.gpu.request_adapter_sync(power_preference="high-performance")
device = adapter.request_device_sync()
print(adapter.summary)

The API is documented at https://wgpu-py.readthedocs.io; replace wgpu by wgpudawn. wgpudawn.wgpu_py_version is the version of wgpu-py that this version of wgpudawn mirrors.

In the browser

The gallery runs the examples of pygfx in your browser, on wgpudawn: Pyodide, the Pyodide wheel of wgpudawn (which uses the WebGPU of the browser through Dawn's Emdawnwebgpu) and pygfx (for now with a few fixes on top, see issue 2). It needs a browser with WebGPU and JSPI, such as a recent Chrome or Edge. Every example is run in headless Chrome when the site is built; the gallery shows what works and what does not.

Status

Early. The wgpu-py tests that do not depend on wgpu-native specifics pass, and so does the unit test suite of pygfx (see below).

Differences with wgpu-py:

  • Shaders are compiled by Tint, which follows the WGSL spec strictly; naga (wgpu-native) accepts some shaders that Tint rejects.
  • Of wgpu-native's extras (wgpu.backends.wgpu_native.extras), only what Dawn can do (see Beyond WebGPU): no GLSL shaders, pipeline statistics queries or API traces, and no wgpu-native specific features and limits. Dawn has its own non-standard features, e.g. unorm16-texture-formats.
  • Dawn's own extras: see Beyond WebGPU.
  • Devices always have the core-features-and-limits feature.
  • The backends are Vulkan (Linux, Windows), Metal (macOS), and D3D12/D3D11 (Windows). There is no OpenGL backend.
  • Validation errors are raised at the call that causes them, and push_error_scope() / pop_error_scope_async(), get_compilation_info_async() and the device-lost promise are implemented.

Libraries that import wgpu

Libraries such as pygfx and rendercanvas import wgpu by name, so by default they use wgpu-py, also when wgpudawn is installed. To run them on wgpudawn, opt in before anything imports wgpu:

import wgpudawn

wgpudawn.install_as_wgpu()

import pygfx  # `import wgpu` now gives wgpudawn, in this process

After that, wgpu and its submodules are wgpudawn's (the same module objects), and wgpu.__version__ is wgpudawn.wgpu_py_version. wgpudawn never installs a wgpu module on disk, so it stays co-installable with wgpu-py.

CI runs the unit tests of pygfx this way, using tests/wgpu_shim: a test-only package named wgpu that calls install_as_wgpu(), and that takes the place of wgpu-py so that pygfx's requirement on it is satisfied. It is not part of the wgpudawn package.

Beyond WebGPU: Dawn's extras

WebGPU is designed to be safe and portable, so it leaves out what only some platforms can do, and everything that touches memory or synchronization of another API. Dawn implements those parts anyway, for Chrome's own use: video frames from a decoder or a camera without a copy, textures shared with another process or another API (Vulkan, Metal, D3D, OpenGL/EGL), fences to synchronize with them, multi-planar video formats, and access to the native objects of the backend. wgpudawn exposes them to Python, so that a program can, for example, render into a buffer that a compositor or a video encoder reads, or display what a camera wrote, without a round trip through the CPU.

They are in wgpudawn.backends.dawn.extras (native builds only; the Pyodide build runs on the browser's WebGPU, which has none of it). The rules:

  • The wgpu-py API is not changed by them: a program that does not use the extras behaves exactly as on wgpu-py. They are functions and classes in their own module, in the style of wgpu-py (snake_case, dicts for descriptors, GPU* classes), like wgpu-py's own wgpu.backends.wgpu_native.extras.
  • wgpu-py's API is the reference. Where wgpu-py has the same capability (in its API, or in its wgpu.backends.wgpu_native.extras), wgpudawn uses its names and signatures. Where wgpudawn has it first and wgpu-py adds it later, wgpudawn moves to wgpu-py's version, keeping the old name for one release with a deprecation warning.
  • What a platform or adapter supports is in adapter.features, by Dawn's feature names in kebab case. They are not WebGPU features, so ask for them in the required_features of request_device_sync(), or in the preferred_features of preconfigure_default_device().
  • Each extra is tested with the other API on the other side (an IOSurface made with CoreFoundation, a dmabuf from GBM, ...), not only with Dawn.

What there is:

  • Shared texture memory and shared fences. import_shared_texture_memory() makes a GPUSharedTextureMemory from memory that another API or process owns (an IOSurface on macOS; a dmabuf, or Vulkan memory exported as an opaque fd by another Vulkan program or by CUDA, on Linux; a D3D11/D3D12 texture shared as an NT handle, an ID3D12Resource or an ID3D11Texture2D, on Windows). create_texture() on it gives a texture to render into between begin_access() and end_access(). The GPUSharedFence objects that end_access() returns export what to wait for (an MTLSharedEvent and its value, a sync fd, an opaque-fd semaphore, or a shared ID3D12Fence / ID3D11Fence handle); import_shared_fence() goes the other way. import_shared_buffer_memory() does the same for buffers on Windows (a D3D12 resource, a shared memory handle, or host memory). Features: shared-texture-memory-i-o-surface, shared-texture-memory-dma-buf, shared-fence-m-t-l-shared-event, shared-texture-memory-opaque-f-d, shared-fence-sync-f-d, shared-fence-vk-semaphore-opaque-f-d.

  • wgpu-py's extras that Dawn has, with wgpu-py's signatures: multi_draw_indirect(), multi_draw_indexed_indirect() and their _count variants, write_timestamp(), set_instance_extras() (the backends, validation layers and DXC; and Dawn's toggles) and request_device_sync() (with Dawn's device toggles; Dawn cannot write a trace). Dawn calls some of its features experimental (feature_info() says which, e.g. multi-draw-indirect): they need set_instance_extras(enable_toggles=["allow_unsafe_apis"]).

  • Toggles, memory and the native instance. all_toggles() lists Dawn's toggles (workarounds, debugging aids such as dump_shaders, skip_validation), get_toggles() says which an adapter or device has; get_memory_usage(), reduce_memory_usage(), perform_idle_tasks(); on Vulkan, get_vk_instance() and get_vk_instance_proc_addr() let another library make Vulkan calls on Dawn's instance; on Windows, get_d3d12_device(), get_d3d12_command_queue(), get_d3d11_device() and get_dxgi_adapter() give the native objects (e.g. to make a D3D11 device on Dawn's GPU); on macOS, wait_for_commands_to_be_scheduled() orders Dawn's work before Core Animation's or another Metal device's.

  • What the backend says about the GPU. get_adapter_properties(): the Vulkan driver version and device/driver UUIDs (the UUID by which CUDA, OpenGL or another Vulkan program finds the same GPU), the DRM primary and render nodes on Linux (where to allocate a dmabuf, e.g. with GBM), the D3D shader model and LUID on Windows, the memory heaps, the subgroup matrix configurations. get_format_capabilities(): the DRM format modifiers with which a format can be imported as a dmabuf.

  • Buffers on host memory, without a copy. create_buffer_from_host_memory() makes a GPUBuffer whose memory is a numpy array (or any writable buffer, aligned to get_host_memory_alignment(); allocate_host_memory() makes such memory): the GPU reads and writes it directly. Feature host-mapped-pointer (experimental; Vulkan except on AMD, Metal, D3D12).

  • Video frames: multi-planar formats and external textures. With the dawn-multi-planar-formats feature, textures can be NV12 (r8bg8-biplanar-420-unorm), P010 (r10x6bg10x6-biplanar-420-unorm) and the other 4:2:0, 4:2:2 and 4:4:4 formats, made by Dawn (multi-planar-format-extended-usages, experimental) or imported (e.g. a dmabuf from a camera or a video decoder); their planes are views and copies with aspect="plane0-only" / "plane1-only". create_external_texture() makes a texture that a shader samples as texture_external, converted to RGB on the fly (BT.601, BT.709, BT.2020, limited or full range, or any matrix; optionally color-managed with transfer functions and a gamut matrix), with crop, rotation and mirroring. It is bound with {"external_texture": {}} in the bind group layout.

What Dawn has that could come next (Dawn's dawn/webgpu.h and dawn/native/*Backend.h): shared texture memory from EGL images and Android hardware buffers (no Android or OpenGL build yet); the MTLDevice (declared for Objective-C only); pixel local storage, framebuffer fetch, resource tables. They are added one at a time, each with a test against the real other API (the dawn-extra skill).

Platforms

Wheels are built for:

x86-64 arm64
Linux (glibc >= 2.28) yes yes (includes Raspberry Pi 4/5 with a 64-bit OS)
macOS (>= 11) yes yes
Windows yes yes

There is also a wheel for Pyodide (Pyodide 314, i.e. Python 3.14): there, the same bindings run on the WebGPU of the browser, via Dawn's Emdawnwebgpu. The gallery above uses it; website/ builds it.

Building from source

Dawn is not downloaded or built by pip install; build it first:

python tools/build_dawn.py --prefix /path/to/dawn    # needs git, cmake, ninja, a C++20 compiler
DAWN_PREFIX=/path/to/dawn pip install -e ".[dev]"
pip install ./tests/wgpu_shim                        # optional: for the tests that use rendercanvas
pytest tests codegen

On Linux this needs the headers of X11, xcb and Wayland. tools/build_dawn_manylinux.sh does the same in the manylinux image that the wheels are built in. DAWN_PREFIX can also point to an extracted release archive of Dawn (of the release in build_cffi.py), or to a prefix with a shared libwebgpu_dawn.

How it works:

  • wgpudawn/_lib is a cffi (API mode) extension. Its cdef (webgpu_cdef.h) is generated from Dawn's webgpu.h by tools/gen_cdef.py: the part that the native header and Emdawnwebgpu's share, so one cdef serves both. Native builds add webgpu_native_extra_cdef.h (what of the native header the extras use, also generated) and a few C++ functions on Dawn's native API (dawn/native/, in build_cffi.py), e.g. to enumerate all adapters.
  • wgpudawn/backends/dawn implements the API with it. It started as wgpu-py's wgpu-native backend.
  • codegen/ is wgpu-py's code generator: it writes the enums, flags and structs from webgpu.idl, and checks the backend against the IDL and against Dawn's header. Run python codegen after changing either.

Versions and releases

A version has four numbers, X.Y.Z.N: X.Y.Z is the version of wgpu-py that it mirrors (same API), and N counts the releases of wgpudawn for that version, which mostly are updates of Dawn. So wgpudawn~=0.32.0 is "the API of wgpu-py 0.32.0, on the newest Dawn". (The first releases, 0.0.x, predate this scheme.)

The version comes from the git tag; there is no version number in the source. Pushing a tag builds and tests the wheels, and publishes them to PyPI. upstream.json records the versions of wgpu-py and Dawn that the code corresponds to.

Maintenance is done by AI agents, with Claude Code skills that are part of this repository:

claude "/update-dawn release"       # to the latest Dawn release, verify, release X.Y.Z.N+1
claude "/sync-upstream release"     # port a new wgpu-py release, verify, release X.Y.Z.0
claude "/update-website"            # newer pygfx on the website; check every example; deploy

Without release, they stop before tagging. See .claude/skills/.

License

BSD 2-clause, see LICENSE. wgpudawn is derived from wgpu-py (Copyright 2019-2023 Almar Klein, Korijn van Golen). The wheels include Dawn and the libraries that it is built with; see LICENSES/.

Metadata

Release files for wgpudawn 0.32.0.1rc1

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

Source distribution (sdist)

Source distribution for wgpudawn 0.32.0.1rc1
File Size Uploaded Provenance
wgpudawn-0.32.0.1rc1.tar.gz 267.8 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for wgpudawn 0.32.0.1rc1
File
wgpudawn-0.32.0.1rc1-cp314-cp314-pyemscripten_2026_0_wasm32.whl CPython 3.14 CPython 3.14 PyEmscripten 2026.0+ WebAssembly Details
wgpudawn-0.32.0.1rc1-cp311-abi3-win_arm64.whl CPython 3.11 abi3 Windows ARM64 Details
wgpudawn-0.32.0.1rc1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
wgpudawn-0.32.0.1rc1-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
wgpudawn-0.32.0.1rc1-cp311-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.27+ ARM64, Linux glibc 2.28+ ARM64 Details
wgpudawn-0.32.0.1rc1-cp311-abi3-macosx_11_0_x86_64.whl CPython 3.11 abi3 macOS 11.0+ x86-64 Details
wgpudawn-0.32.0.1rc1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details

Total release size: 27.9 MB

Release files / wgpudawn-0.32.0.1rc1.tar.gz

Download URL wgpudawn-0.32.0.1rc1.tar.gz
Size 267.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ea16169098389e4dc74432cd7a704de67766c5bb01c6b6446485d2223b303d0b
BLAKE2b-256 checksum
How to use checksums
73410eee8d2ff855e3d422fccec5e3096849926ff29ff691f69cfbacc49c0575
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 24, 2026.

Transparency log

Release files / wgpudawn-0.32.0.1rc1-cp314-cp314-pyemscripten_2026_0_wasm32.whl

Download URL wgpudawn-0.32.0.1rc1-cp314-cp314-pyemscripten_2026_0_wasm32.whl
Size 286.4 kB
Tags CPython 3.14 PyEmscripten 2026.0+ WebAssembly
SHA-256 checksum
How to use checksums
f398e88e834b9bae1eeb0ef0e64dc3fa06d6b9bfb09f3b5fe57a6b2a478b8c67
BLAKE2b-256 checksum
How to use checksums
ab38ba28449b3608575e4596f62945a274c5eae7fb35986071d26ab5768fcb9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 24, 2026.

Transparency log

Release files / wgpudawn-0.32.0.1rc1-cp311-abi3-win_arm64.whl

Download URL wgpudawn-0.32.0.1rc1-cp311-abi3-win_arm64.whl
Size 4.8 MB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
21a88fd9b5dc8c6a980b572fbe3e1697edff5cfcf988263a693179507b073245
BLAKE2b-256 checksum
How to use checksums
38083fcbcc0790f50cf048625e37f79c7561a968a58a1cacccd41f04dc8799e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 24, 2026.

Transparency log

Release files / wgpudawn-0.32.0.1rc1-cp311-abi3-win_amd64.whl

Download URL wgpudawn-0.32.0.1rc1-cp311-abi3-win_amd64.whl
Size 4.6 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
2f0149a0efdb470aac0535e11eaaab46a4d4858e1a8ff3d049124859795778b9
BLAKE2b-256 checksum
How to use checksums
ce5b25785a50f83d261a0a51cfaf661b1b4d4dedcfb1ad0d8495256db51574bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 24, 2026.

Transparency log

Release files / wgpudawn-0.32.0.1rc1-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL wgpudawn-0.32.0.1rc1-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.5 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
3cab5b7e2256defd27f9bed053accace9be69a6b24dd7be28ef07248338bd6ca
BLAKE2b-256 checksum
How to use checksums
a2b071672fabe67d446b5487122fc7c3271781564d9495d9dcaff13412872f9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 24, 2026.

Transparency log

Release files / wgpudawn-0.32.0.1rc1-cp311-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL wgpudawn-0.32.0.1rc1-cp311-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 5.3 MB
Tags CPython 3.11 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
9d783a0a73fc42b3fea59d4851eb40a46593826a8aa496e8630f9588a4dee36f
BLAKE2b-256 checksum
How to use checksums
8671e5dfc85dda2f497824e9b1d1d0340efc382fb8be4cd911168acd0fe1525d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 24, 2026.

Transparency log

Release files / wgpudawn-0.32.0.1rc1-cp311-abi3-macosx_11_0_x86_64.whl

Download URL wgpudawn-0.32.0.1rc1-cp311-abi3-macosx_11_0_x86_64.whl
Size 3.8 MB
Tags CPython 3.11 abi3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
8806c2bc938cd6aa4745d9b1b95b1136343bf5203cf17333510634fc2cbb6167
BLAKE2b-256 checksum
How to use checksums
0256c6ba91f85ebc0c05f942505a61be181bb05dae51f1b09c8b400b1e4ce008
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 24, 2026.

Transparency log

Release files / wgpudawn-0.32.0.1rc1-cp311-abi3-macosx_11_0_arm64.whl

Download URL wgpudawn-0.32.0.1rc1-cp311-abi3-macosx_11_0_arm64.whl
Size 3.3 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
30298e277b3c398f62388dc6fabcb76a186a4dc944cb0f35c4f08c989d12a7fe
BLAKE2b-256 checksum
How to use checksums
454eaca43fb059ff0c965f5997976f72d2d19cea646e5b5127f7e941a41069eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 24, 2026.

Transparency log

Security for wgpudawn 0.32.0.1rc1

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 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for wgpudawn-0.32.0.1rc1.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 Oct 24, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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