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

Release files for wgpu 0.32.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.32.0
File Size Uploaded
wgpu-0.32.0.tar.gz 197.2 kB Details

Built distributions (wheels)

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

Total release size: 23.0 MB

Release files / wgpu-0.32.0.tar.gz

Download URL wgpu-0.32.0.tar.gz
Size 197.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cb23b2f225594258ccc8ba97458381e46c18e561c5d2d6fc25213e68a6d89985
BLAKE2b-256 checksum
How to use checksums
6052b7d5ef9c29bbb9f4e40bff9a5027482857fb225f962acec9c5bb6a2d4e44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 19, 2026.

Transparency log

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

Download URL wgpu-0.32.0-py3-none-win_arm64.whl
Size 3.3 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
cb0414107825bd94538220cf3f329c83697b99b8e39c6e16e4e6726e427de75c
BLAKE2b-256 checksum
How to use checksums
6b164b097baac7c8d6e013e67f1483d100847b9ea350eb393c301a28a95c4bd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 19, 2026.

Transparency log

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

Download URL wgpu-0.32.0-py3-none-win_amd64.whl
Size 3.5 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
493c8a0425c7d3cc728a2489bce40d1a016d800306e59763ff1b21e176e66323
BLAKE2b-256 checksum
How to use checksums
dc5a92d8ebd91d2e6e772a4d90656231472a8dad6ab050174336510fa9dff978
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 19, 2026.

Transparency log

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

Download URL wgpu-0.32.0-py3-none-win32.whl
Size 3.3 MB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
d51a17dbbeb37ef20d1c900d7c51bc71abba145792ad428763666a1bb91cf986
BLAKE2b-256 checksum
How to use checksums
8fa8fca88e53ef7439bbb01d58c33e722508af19d762b9f8bf8810e208882af6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 19, 2026.

Transparency log

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

Download URL wgpu-0.32.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
6499a31b5a29a10b4f1089fea4a0806411f42605fa86b6c0b543a07ca0de8568
BLAKE2b-256 checksum
How to use checksums
99a98b00e9d0cbd1ec0766e5b3c8063e61f0335262afe07cef82c307899bcf01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 19, 2026.

Transparency log

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

Download URL wgpu-0.32.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
00454ba1bc794d38c8365f4ad29f381b88ce0a7f115133bfaa6f1dfad7eb2764
BLAKE2b-256 checksum
How to use checksums
405236819230b805b07fc4c3e92242aba7b73a0ce25e03b124992af79a6b1d4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 19, 2026.

Transparency log

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

Download URL wgpu-0.32.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
6c3f654ea01ab2de8a2903354ced02a3c6ef161d0fba1aa4fea60aa86d021908
BLAKE2b-256 checksum
How to use checksums
d73ba21ac5d2c5fcc13c2709123f497f5e008726221c56dc83ba0850fc2d230d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 19, 2026.

Transparency log

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

Download URL wgpu-0.32.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
cfd3967616a3c42e2b7a234407df38668c697f5aa505d56e0814d647b6746302
BLAKE2b-256 checksum
How to use checksums
1b4b173e7685a22edf2d33ed330a038c8859d2c62bff900eb637a702661333ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.32.0 This release

8 release files

0.31.1

8 release files

0.30.0

8 release files

0.29.0

8 release files

0.28.1

8 release files

0.28.0

8 release files

0.26.0

8 release files

0.25.0

8 release files

0.24.0

8 release files

0.23.0

8 release files

0.22.2

8 release files

0.22.1

8 release files

0.22.0

8 release files

0.21.1

8 release files

0.21.0

8 release files

0.20.1

8 release files

0.20.0

8 release files

0.19.3

8 release files

0.19.2

8 release files

0.19.1

8 release files

0.18.1

7 release files

0.18.0

7 release files

0.17.3

7 release files

0.16.0

7 release files

0.15.3

7 release files

0.15.2

7 release files

0.15.1

7 release files

0.14.1

7 release files

0.14.0

7 release files

0.13.2

7 release files

0.13.0

6 release files

0.12.0

6 release files

0.11.0

6 release files

0.9.5

7 release files

0.9.4

7 release files

0.9.3

7 release files

0.9.2

7 release files

0.9.1

7 release files

0.9.0

7 release files

0.8.4

7 release files

0.8.3

7 release files

0.8.2

7 release files

0.8.1

7 release files

0.8.0

7 release files

0.7.7

7 release files

0.7.6

7 release files

0.7.5

7 release files

0.7.4

7 release files

0.7.3

7 release files

0.7.2

7 release files

0.7.1

7 release files

0.7.0

7 release files

0.6.0

7 release files

0.5.9

7 release files

0.5.8

7 release files

0.5.7

5 release files

0.5.6

5 release files

0.5.5

5 release files

0.5.4

5 release files

0.5.3

5 release files

0.5.2

5 release files

0.5.1

5 release files

0.4.0

5 release files

0.3.0

6 release files

0.2.0

6 release files

0.1.6

6 release files

0.1.5

6 release files

0.1.4

6 release files

0.1.3

6 release files

0.1.2

3 release files

0.1.1

2 release files

0.0.1

1 release file

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