# WebGPU Plugin EP — Python Packaging This directory contains the packaging source for the `onnxruntime-ep-webgpu` Python package. ## Prerequisites - Python 3.11+ - Pre-built WebGPU plugin EP binaries (from CI or a local build) Install build dependencies: ```bash pip install -r requirements-build-wheel.txt ``` ## Building the wheel Wheels are built via `build_wheel.py`. Running `pip install` or `pip wheel` directly against this directory is not supported — the source tree contains `pyproject.toml.in` (a template), not a real `pyproject.toml`. The wheel is platform-specific. Each platform's wheel is built from binaries produced on that platform — `build_wheel.py` does not cross-build. See the [bundled wheel readme](onnxruntime_ep_webgpu/README.md#supported-platforms) for the list of supported platforms. ```bash python build_wheel.py --binary_dir --version --output_dir ``` Example: ```bash python build_wheel.py --binary_dir ./build/Release --version 0.1.0.devYYYYMMDD --output_dir ./dist ``` The script combines the pre-built plugin EP binaries with the package source to produce a platform-specific wheel. ## Testing Install the wheel and dependencies in a clean environment, then run the smoke test: ```bash python -m venv test_venv source test_venv/bin/activate # or test_venv\Scripts\Activate.ps1 on Windows pip install onnx numpy onnxruntime pip install dist/onnxruntime_ep_webgpu-*.whl python test/test_webgpu_plugin_ep.py ``` `onnx` and `numpy` are required only by the smoke test, not by the `onnxruntime-ep-webgpu` wheel itself. The wheel's only runtime dependency is a compatible `onnxruntime` (see [`../MIN_ONNXRUNTIME_VERSION`](../MIN_ONNXRUNTIME_VERSION)). The test validates import, EP registration, device discovery, and inference (requires WebGPU-capable hardware for the inference portion). Set the environment variable `ORT_TEST_VERBOSE=1` to print additional diagnostic information (environment, available providers, discovered devices, etc.). ## Versioning The package version is derived from [`../VERSION_NUMBER`](../VERSION_NUMBER) by the packaging pipeline (see [`set-plugin-ep-build-variables-step.yml`](../../tools/ci_build/github/azure-pipelines/templates/set-plugin-ep-build-variables-step.yml)), which produces a PEP 440 version string.