With PyScript most of wgpu should be runnable in a browser. If we can translate out API to WebGPU calls, people can use WebGPU via Python in a browser, which seems like a pretty big thing!
Since we follow the WebGPU IDL spec quite closely, this should not be that hard, though there are some cases to take into account.
I briefly looked into this. Some hurdles to take are:
- We must provide a wheel that pyscript can load. This must either be a
none-any.whl or a wasm32.whl. Even though we don't have any wasm in it, having none-any.whl can accidentally be installed on a desktop and we don't want that.
- Code must be async, since there is no way to synchronously wait for a
Future in js, we cannot implement our sync version of the async method. I find this the scariest hurdle. (I hope I'm overlooking something that still allows us to do that.)
- We must provide a
jswebgpu backend. Can partially autogenerate this. I don't expect this to be the hardest part.
- We must provide a
jscanvas gui backend if we want to render stuff.
Sub-goals to achieve:
- Support importing
wgpu and displaying the version numer.
- Perform compute tasks.
- Perform rendering tasks.
- Now it should be possible to just run pygfx examples.
With PyScript most of wgpu should be runnable in a browser. If we can translate out API to WebGPU calls, people can use WebGPU via Python in a browser, which seems like a pretty big thing!
Since we follow the WebGPU IDL spec quite closely, this should not be that hard, though there are some cases to take into account.
I briefly looked into this. Some hurdles to take are:
none-any.whlor awasm32.whl. Even though we don't have any wasm in it, havingnone-any.whlcan accidentally be installed on a desktop and we don't want that.Futurein js, we cannot implement our sync version of the async method. I find this the scariest hurdle. (I hope I'm overlooking something that still allows us to do that.)jswebgpubackend. Can partially autogenerate this. I don't expect this to be the hardest part.jscanvasgui backend if we want to render stuff.Sub-goals to achieve:
wgpuand displaying the version numer.