Skip to main content

WebGPU API for Python for local and Pyodide development

This library provides a Python wrapper around the WebGPU API that runs in the browser via Pyodide or connects to a local Python instance. It is intended for interactive visualization and compute in environments such as Jupyter notebooks and plain HTML pages.

The package bundles a small rendering framework (scenes, cameras, labels, colormaps) and utilities to work with WGSL shaders from Python. It is used in higher level frameworks like ngsolve_webgpu for GPU-accelerated finite element visualizations in the browser.


Features

  • Browser-based GPU access via WebGPU from local Python and Pyodide.
  • Python-first API for creating renderers, scenes and simple GUI controls.
  • Jupyter integration through a webgpu.jupyter helper module.
  • WGSL tooling:
    • simple #import mechanism for shader code
    • conditional compilation using #ifdef/#else/#endif
  • Ready-to-use building blocks:
    • Renderer, Scene, Camera, Labels, Colormap, Clipping, Font
    • utilities for GPU buffers and bindings

Requirements

  • Python 3.8 or newer
  • A browser with WebGPU support (for example a recent Chrome or Edge)
  • For notebook use: JupyterLab or Jupyter Notebook

To check WebGPU support in your browser, you can use common WebGPU capability pages (for example WebGPU report pages linked from the project website).


Installation

From PyPI

pip install webgpu

From source

git clone https://github.com/CERBSim/webgpu
cd webgpu
pip install -e .

Documentation

The full project documentation, including API reference, tutorials and user guide, is published at:

Examples

The repository contains several examples:

  • examples/first_shader.ipynb – minimal example drawing a triangle with custom WGSL shader code.
  • examples/websocket.ipynb – example using the websocket link.
  • docs/introduction.ipynb – overview and introductory material.

Additional, more advanced examples in docs/*.ipynb (compute, instanced shapes, selection).

Browser support

This library relies on the browser’s WebGPU implementation. In practice this means:

  • A recent Chromium-based browser (Chrome, Edge) or Firefox is recommended.
  • Some platforms may require enabling experimental WebGPU flags.
  • Mobile and non-Chromium browsers may have partial or no support.

If WebGPU is not available, initialization will fail. See project documentation and browser-specific WebGPU status pages for details and troubleshooting.

License

This project is licensed under the terms of the LGPL-2.1-or-later. See the LICENSE file for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

webgpu-1.5.4-py3-none-any.whl (299.4 kB view details)

Uploaded Python 3

File details

Details for the file webgpu-1.5.4-py3-none-any.whl.

File metadata

  • Download URL: webgpu-1.5.4-py3-none-any.whl
  • Upload date:
  • Size: 299.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for webgpu-1.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b684076565558fa3c07ddb66e2a4ee6306352c4cb6a132d4e15350214259d619
MD5 a37e34cb693df9f21a2f04957e46ad4a
BLAKE2b-256 51ea0398b7cad8ce3cf519414205559b8578c63aeefa480a80b8fe8db6f2bf0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for webgpu-1.5.4-py3-none-any.whl:

Publisher: deploy.yml on CERBSim/webgpu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.5.6

1 file

1.5.5

1 file

This release

1.5.4 This release

1 file

1.5.3

1 file

1.5.2

1 file

1.5.1

1 file

1.5

1 file

1.4.1

1 file

1.4.0

1 file

1.3.0

1 file

1.2.8

1 file

1.2.7

1 file

1.2.5

1 file

1.2.4

1 file

1.1.6

1 file

1.1.5

1 file

1.1.4

1 file

1.1.3

1 file

1.1.2

1 file

1.1.1

1 file

1.1.0

1 file

1.0.20

1 file

1.0.19

1 file

1.0.18

1 file

1.0.17

1 file

0.1.16

1 file

0.1.15

1 file

0.1.14

1 file

0.1.13

1 file

0.1.12

1 file

0.1.11

1 file

0.1.10

1 file

0.1.9

1 file

0.1.8

1 file

0.1.7

1 file

0.1.6

1 file

0.1.5

1 file

0.1.4

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

0.0.13

1 file

0.0.12

1 file

0.0.11

1 file

0.0.10

2 files

0.0.9

2 files

0.0.8

1 file

0.0.7

1 file

0.0.6

1 file

0.0.4

1 file

0.0.3

1 file

0.0.2

1 file

0.0.1

1 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