The cookbook currently covers basic and advanced Web Worker patterns, but it lacks examples for enabling native multithreading in Pyodide.
To support native threading (pthreads) in Pyodide, the environment must be 'cross-origin isolated'. This requires specific HTTP headers:
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
It would be very helpful to add:
- An example of a dev server (e.g., in
conftest.py) that serves these headers.
- A pattern for validating that
SharedArrayBuffer is active in a Playwright/Pytest test suite.
- Documentation on how these headers affect package loading and third-party scripts.
This is particularly relevant for high-performance serialization or parallel processing libraries using Pyodide.