Skip to main content

CI Documentation Status PyPI version Zenodo badge

wgpu-py

A Python implementation of WebGPU - the next generation GPU API. 🚀

Introduction

The purpose of wgpu-py is to provide Python with a powerful and reliable GPU API.

It serves as a basis to build a broad range of applications and libraries related to visualization and GPU compute. We use it in pygfx to create a modern Pythonic render engine.

To get an idea of what this API looks like have a look at triangle.py and the other examples.

Status

  • Until WebGPU settles as a standard, its specification may change, and with that our API will probably too. Check the changelog when you upgrade!
  • Coverage of the WebGPU spec is complete enough to build e.g. pygfx.
  • Test coverage of the API is close to 100%.
  • Support for Windows, Linux (x86 and aarch64), and MacOS (Intel and M1).

What is WebGPU / wgpu?

WGPU is the future for GPU graphics; the successor to OpenGL.

WebGPU is a JavaScript API with a well-defined spec, the successor to WebGL. The somewhat broader term "wgpu" is used to refer to "desktop" implementations of WebGPU in various languages.

OpenGL is old and showing its cracks. New API's like Vulkan, Metal and DX12 provide a modern way to control the GPU, but these are too low-level for general use. WebGPU follows the same concepts, but with a simpler (higher level) API. With wgpu-py we bring WebGPU to Python.

Technically speaking, wgpu-py is a wrapper for wgpu-native, exposing its functionality with a Pythonic API closely resembling the WebGPU spec.

Installation

# Just wgpu
pip install wgpu

# If you want to render to screen
pip install wgpu rendercanvas glfw

Linux users should make sure that pip >= 20.3. That should do the trick on most systems. See getting started for details.

Usage

Also see the online documentation and the examples.

The full API is accessible via the main namespace:

import wgpu

To render to the screen you can use a variety of GUI toolkits:

# The rendercanvas auto backend selects either the glfw, qt, wx, or jupyter backend
from rendercanvas.auto import RenderCanvas, loop

# Visualizations can be embedded as a widget in a Qt application.
# Import PySide6, PyQt6, PySide2 or PyQt5 before running the line below.
# The code will detect and use the library that is imported.
from rendercanvas.qt import RenderCanvas

Some functions in the original wgpu-native API are async. In the Python API, the default functions are all sync (blocking), making things easy for general use. Async versions of these functions are available, so wgpu can also work well with Asyncio or Trio.

License

This code is distributed under the 2-clause BSD license.

Projects using wgpu-py

  • pygfx - A python render engine running on wgpu.
  • shadertoy - Shadertoy implementation using wgpu-py.
  • tinygrad - deep learning framework
  • fastplotlib - A fast plotting library
  • xdsl - A Python Compiler Design Toolkit (optional wgpu interpreter)

Contributing

See the contribution guide.

Development install

  • Clone the repo.
  • Install devtools using pip install -e .[dev].
  • Using pip install -e . will also download the upstream wgpu-native binaries.
    • You can use python tools/download_wgpu_native.py when needed. And run python codegen once to obtain the combined headerfile.
    • Or point the WGPU_LIB_PATH environment variable to a custom build of wgpu-native.

Quick tips

  • Use ruff format to apply autoformatting.
  • Use ruff check to check for linting errors.
  • Use pytest -v tests runs the unit tests.
  • Use pytest -v examples tests the examples.

Code of Conduct

This repository follows the PyGfx Code of Conduct

Metadata

Release files for wgpu 0.33.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 wgpu 0.33.0
File Size Uploaded Provenance Actions
wgpu-0.33.0.tar.gz 197.3 kB With provenance Details for wgpu-0.33.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for wgpu 0.33.0
File Actions
wgpu-0.33.0-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details for wgpu-0.33.0-py3-none-win_arm64.whl
wgpu-0.33.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for wgpu-0.33.0-py3-none-win_amd64.whl
wgpu-0.33.0-py3-none-win32.whl Python 3 none Windows x86-32 Details for wgpu-0.33.0-py3-none-win32.whl
wgpu-0.33.0-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for wgpu-0.33.0-py3-none-manylinux_2_28_x86_64.whl
wgpu-0.33.0-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details for wgpu-0.33.0-py3-none-manylinux_2_28_aarch64.whl
wgpu-0.33.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for wgpu-0.33.0-py3-none-macosx_11_0_arm64.whl
wgpu-0.33.0-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details for wgpu-0.33.0-py3-none-macosx_10_9_x86_64.whl

Total release size: 23.0 MB

Release files / wgpu-0.33.0.tar.gz

Download URL wgpu-0.33.0.tar.gz
Size 197.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7b41b3e5f3c96e166c13b3036c3a98023c2200e84ff0f1ab27adc580fa70308c
BLAKE2b-256 checksum
How to use checksums
0e870da68cc9b0d7d06d28f1067016ebade039a6e54e53eb78996a249df95b62
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 Nov 6, 2026.

Transparency log

Release files / wgpu-0.33.0-py3-none-win_arm64.whl

Download URL wgpu-0.33.0-py3-none-win_arm64.whl
Size 3.3 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
a55c3747c5463ad99826debeb3f719608cc1414ee56df266609ee1a205b4299f
BLAKE2b-256 checksum
How to use checksums
7154247867e00c3b8fe4798c9fd4e14a12a8ea6394133499b23a4614cecd8aea
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 Nov 6, 2026.

Transparency log

Release files / wgpu-0.33.0-py3-none-win_amd64.whl

Download URL wgpu-0.33.0-py3-none-win_amd64.whl
Size 3.5 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
8f17bd24115d74657234eacd5410d7cc1e6b6366ef9ff515e99d7463e17e8895
BLAKE2b-256 checksum
How to use checksums
c8b092c91610b14158f53b2b4cb213ace4fd017fd87822c96c2ec46936709617
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 Nov 6, 2026.

Transparency log

Release files / wgpu-0.33.0-py3-none-win32.whl

Download URL wgpu-0.33.0-py3-none-win32.whl
Size 3.3 MB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
6c6f0085ce61dbd5321339fa5f3271248978086726f5f880a59aed84cd245084
BLAKE2b-256 checksum
How to use checksums
1b22c3610115e3fce85eb6ae0bec7ce5c23f63834aa29e1fabc86c1e51b7eaa5
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 Nov 6, 2026.

Transparency log

Release files / wgpu-0.33.0-py3-none-manylinux_2_28_x86_64.whl

Download URL wgpu-0.33.0-py3-none-manylinux_2_28_x86_64.whl
Size 3.5 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
5e13ce9f94350f7c70de9edb0fd2843dd38f474fac5aaaca01611ef6dc011c96
BLAKE2b-256 checksum
How to use checksums
2bc667fcf94c78fd6006529887b43ca99e6ecbdbfb6df100cd4d85b4627402ac
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 Nov 6, 2026.

Transparency log

Release files / wgpu-0.33.0-py3-none-manylinux_2_28_aarch64.whl

Download URL wgpu-0.33.0-py3-none-manylinux_2_28_aarch64.whl
Size 3.5 MB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
2283de06150cb8a76d60e5dcbf4646fddc4d8b13dc38de3369fb04b8009ce787
BLAKE2b-256 checksum
How to use checksums
a68ad1d157f9d7a850c7490c70e7f750214f8725a171f766dc34470f7a616a22
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 Nov 6, 2026.

Transparency log

Release files / wgpu-0.33.0-py3-none-macosx_11_0_arm64.whl

Download URL wgpu-0.33.0-py3-none-macosx_11_0_arm64.whl
Size 2.8 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ab0e1da941ca6b7a06f3ff28863045d4ca2122d0b176eb81b0ed4503f2b7a4c1
BLAKE2b-256 checksum
How to use checksums
9436b5652fa7e44e33ac476b2a74a2236bbe69fd6d712056dc717db4ff28120a
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 Nov 6, 2026.

Transparency log

Release files / wgpu-0.33.0-py3-none-macosx_10_9_x86_64.whl

Download URL wgpu-0.33.0-py3-none-macosx_10_9_x86_64.whl
Size 2.9 MB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
486896116cc2256b95614808b18052c81ab997f98dff5558446068a37f2404ea
BLAKE2b-256 checksum
How to use checksums
974987ca16b45e79491803e19490566be4a56dd8667c389ee675ffe5a8de1273
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 Nov 6, 2026.

Transparency log

Security for wgpu 0.33.0

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 wgpu-0.33.0.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 Nov 6, 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.

Release history Release notifications | RSS feed

This release

0.33.0 This release

8 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