Skip to main content

dawn-python

PyPI version

ctypeslib based python bindings to the Dawn WebGPU engine with a focus on the compute pipeline. Besides the autogenerated bindings, a small utils interface (similar to wgpu-py) is provided to make it easier to run compute.

Chromium version used in pydawn: 133.0.6940.0

How to use

  1. Install from PyPI

pip install dawn-python

  1. Import utils, and webgpu
from pydawn import utils, webgpu

if __name__ == "__main__":
    # Creating an adapter
    adapter = utils.request_adapter_sync(power_preference=webgpu.WGPUPowerPreference_HighPerformance)

    # Creating a device with a list of required features
    dev = utils.request_device_sync(adapter, [webgpu.WGPUFeatureName_ShaderF16, webgpu.WGPUFeatureName_TimestampQuery])

For more details see examples/query_set.py

Generating bindings

  1. Build dawn or use the pre-built lib in the repo
  2. pip install ctypeslib2
  3. clang2py -l libwebgpu_dawn.dylib webgpu.h --nm nm_patch.py -o webgpu.py

Examples

python3 examples/simple_compute.py

Supported platforms

  • MacOS (arch: x86_64, arm64, optimal backend: Metal)
  • Ubuntu (arch: x86_64, optimal backend: Vulkan)
  • Windows (arch: x86_64, optimal backend: DirectX)

License

BSD 3-Clause, please see LICENSE

Metadata

Release files for dawn-python 0.3.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 dawn-python 0.3.0
File Size Uploaded
dawn_python-0.3.0.tar.gz 19.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for dawn-python 0.3.0
File Interpreter ABI Platform
dawn_python-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.3 MB

Release files / dawn_python-0.3.0.tar.gz

Download URL dawn_python-0.3.0.tar.gz
Size 19.1 MB
Tags Source
SHA-256 checksum
How to use checksums
9950e6902d47513732981f92a98ff235d2269b3cb7bd6da8dbeb3e21b104c5e4
BLAKE2b-256 checksum
How to use checksums
0e4a1d9f130149dadcd95900911d6b457680cde265244ac73420e9262aa8ac04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / dawn_python-0.3.0-py3-none-any.whl

Download URL dawn_python-0.3.0-py3-none-any.whl
Size 19.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
27b2878d60dc7c461f86283ec86981e781efec9f464b688c33aebd842e0854cc
BLAKE2b-256 checksum
How to use checksums
716079521bc4b9154d5c8521f462b67c0edc5a45e3387b3b8efa4e1666426296
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

1 release file

0.1.5

1 release file

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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