wgpu-py icon indicating copy to clipboard operation
wgpu-py copied to clipboard

Include more docstrings

Open almarklein opened this issue 2 months ago • 1 comments

We have docstrings for most methods, but it would be nice to also have docs for the emums/flags/structs and their fields.

The docstrings for the methods are written by hand, the codegen only updates signatures in these files. Would probably be good to read through them and make them more complete ...

For flags/enums/structs we could perhaps load these from upstream definitions. Or just write them by hand in a separate document. Or a mix of both.

Possible sources to load docstrings from:

  • It would have been nice if the IDL file contained docs, but it does not.
  • https://github.com/webgpu-native/webgpu-headers/blob/main/webgpu.yml (also see #460). This defines the webgpu.h but most docstrings can be applied to the user-facing API too. However, most docs are currently missing.
  • Just scrape https://gpuweb.github.io/gpuweb
  • The text for WebGPU spec seems to be defided in https://github.com/gpuweb/gpuweb/blob/main/spec/index.bs

almarklein avatar Sep 29 '25 07:09 almarklein

Something that might be helpful: cross-refs within the documentation as well as links to the webgpu spec or wgpu docs page

Vipitis avatar Oct 22 '25 11:10 Vipitis