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 Provenance Actions
dawn_python-0.3.0.tar.gz 19.1 MB Without provenance Details for dawn_python-0.3.0.tar.gz

Built distribution (wheel)

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

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

Security for dawn-python 0.3.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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