Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wasm preview #835

Merged
merged 5 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions wasm-preview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

To run tests in your browser, go [here](https://githubproxy.samuelcolvin.workers.dev/pydantic/pydantic-core/blob/main/wasm-preview/index.html).

To test with a specific version of pydantic-core, add a query parameter `?pydantic_core_version=...` to the URL, e.g. `?pydantic_core_version=v0.25.0`, defaults to latest release.
To test with a specific version of pydantic-core, add a query parameter `?pydantic_core_version=...` to the URL, e.g. `?pydantic_core_version=v2.4.0`, defaults to latest release.

This doesn't work for version of pydantic-core before v0.23.0 as before that we built 3.10 binaries, and pyodide now rust 3.11.

If the output appears to stop prematurely, try looking in the developer console for more details.

Tests are currently failing 10-15% of the wait through on Chrome due to a suspected V8 bug, see [pyodide/pyodide#3792](https://github.com/pyodide/pyodide/issues/3792) for more information.
For pydantic-core versions prior to `2.2.0`, tests will freeze at at 10-15% of the way through on Chrome due to a suspected V8 bug, see [pyodide/pyodide#3792](https://github.com/pyodide/pyodide/issues/3792) for more information.
3 changes: 2 additions & 1 deletion wasm-preview/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ async function main() {
setupStreams(FS, pyodide._module.TTY);
FS.mkdir('/test_dir');
FS.chdir('/test_dir');
await pyodide.loadPackage(['micropip', 'pytest', 'pytz', 'typing-extensions']);
await pyodide.loadPackage(['micropip', 'pytest', 'pytz']);
if (pydantic_core_version < '2.0.0') await pyodide.loadPackage(['typing-extensions']);
await pyodide.runPythonAsync(python_code, {globals: pyodide.toPy({pydantic_core_version, tests_zip})});
post();
} catch (err) {
Expand Down