Commit Graph

3105 Commits

Author SHA1 Message Date
Gyeongjae Choi 8dc568ffa8
Keep webpackIgnore comments in pyodide.js (#4294)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-17 20:33:12 +09:00
Hood Chatham fd270ddde7 v0.25.0a1 2023-11-16 17:05:56 -08:00
Hood Chatham c966eeda38
JSPI Improve support for runtimes that don't allow dynamic eval (#4300)
This fixes it so that if new WebAssembly.Module fails, we don't try to use it in
JSPI. This doesn't 100% fix no-dynamic-eval but it makes it work a lot better.
2023-11-16 17:04:54 -08:00
Angus Hollands f59bb9289e
Upgrade awkward-cpp to 26 (#4298) 2023-11-16 08:01:11 -08:00
Gyeongjae Choi 58b4d1bec7
Fix static_import test to work in safari (#4296)
The test_static_import test was failing in Safari because it runs another Safari session
while Safari does not allow multiple sessions running simultaneously.

We already have a workaround for it, but it was not working for this test, because it
was not using selenium fixture directly. This PR refactors the test, so our workaround can be applied.
2023-11-15 21:40:07 -08:00
Ian Thomas ca6d63388c
Update ContourPy to 1.2.0 (#4291)
Update ContourPy to the latest release, 1.2.0. This uses meson and meson-python to build, and following the recent improvements to meson-based builds here, such as the automagic use of emscripten.meson.cross, this was really easy.

To use pybind11 with clang >= 17 we need pybind/pybind11#4767. This isn't in a pybind11 release yet, so I have included a patch to install pybind11 direct from the github commit that includes the PR. This patch can be removed after the next pybind11 release.
2023-11-14 09:18:03 -08:00
Hood Chatham 52ccb107a6
Drop Safari 14.x polyfill (#4225)
Since we added externref, we won't support Safari 14.x anymore so we don't need the polyfill.
2023-11-13 13:18:26 -08:00
Gyeongjae Choi b194a7b28c
Fix default index url calculation in node ES module (#4288) 2023-11-12 22:06:49 +09:00
Steven Weaver 38050cbf57
PKG Add Pysam (#4268)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-09 20:57:05 +09:00
Gyeongjae Choi 747270b1f7
TST Reuse single safari webdriver during the test (#4270)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-07 13:08:18 +01:00
Hood Chatham 44ef9486c4
NFC Move some logic from pyodide.ts to api.ts (#4281) 2023-11-06 11:18:37 -08:00
Matthew Taylor 4f7b2d480e
Add docstrings for to_js (#4266)
Add docstring example usage for to_js and small Python syntax edits in docstring.
2023-11-04 19:04:10 -07:00
Hood Chatham e4d281582b
Update geopandas to 0.13.2 (#4104)
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
2023-11-04 17:56:33 +09:00
Alex Bolenok 6576099860
Fix import type { PyProxy } from "pyodide/ffi" with target NodeNext (#4256) 2023-11-02 20:20:32 -07:00
Hood Chatham 2294ad03ec
Stack Switching: Save the Python state when suspending and restore it when done (#3992)
This allows bidirectional stack switching and other arbitrary control flow, whereas
without this patch arbitrary control flow terribly messes up the Python interpreter
state.

By far the most subtle thing here is the manipulation of the cframe state. This
required careful reading of the greenlet source code and a large amount of trial
and error to get right.

Unfortunately the file pystate.c is tightly coupled to the Python version. There are
apparently plans to try to upstream some of this code from greenlet into Python itself.
In the meantime, it should be possible to continue updating it by imitating greenlet.
2023-11-02 12:48:41 -07:00
Hood Chatham efe22df5d1
NFC hiwire cleanup (#4271)
Move remaining hiwire code to jslib and cleanup headers
2023-11-02 09:06:52 -07:00
Gyeongjae Choi 4265d218ce
Drop node < 18 support (#4269)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-01 17:28:58 +01:00
Hood Chatham 299c7bec1c
FIX In python2js pass conversion context by pointer instead of by value (#4263)
This fixes a bug in python2js. python2js_custom__create_jscontext was violating
the wasm ABI for struct value arguments. A struct argument is passed as a stack
pointer, but it violates ABI to store that pointer or modify the memory. This
caused undefined behavior.
2023-10-31 14:09:42 -07:00
Hood Chatham c648fbc61b
Use JsVal instead of JsRef (nr. 8) (#4262)
This is close to finishing the refactor. I removed the last few uses of the
Hiwire JS APIs from the PyProxy Buffer apis. I reworked all of the
JsProxy_create family to use JsVal everywhere. I removed most of the remaining
logic from hiwire.c. The only remaining places where JsRef is used are in struct
fields where it is needed.
2023-10-31 12:40:50 -07:00
Nicholas Bollweg 9c498a8d4f
add msgspec 0.18.4 (#4265)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-30 19:55:45 +09:00
Hood Chatham ea6b971ceb
Use JsVal instead of JsRef (nr. 7) (#4254)
Makes `python2js` do what `python2js_val` did and remove `python2js_val`.
Also, when accessing a `JsProxy` attribute invokes a getter and the getter
throws an error, fix it so that the error is propagated instead of being turned
into an `AttributeError`.
2023-10-28 09:50:15 -07:00
Gyeongjae Choi 87a6782bfe
Add more keys in pyodide config CLI command (#4241) 2023-10-28 21:37:55 +09:00
Hood Chatham 5d43362556
Use JsVal instead of JsRef (nr. 6) (#4252)
This gets rid of a lot more uses of hiwire from JavaScript. It also finished eliminating the need for
a js2python conversion function that takes a JsRef, so I renamed the temporary js2python_val
back to js2python.
2023-10-24 22:05:31 -07:00
Hood Chatham 0d9e660066
Use JsVal instead of JsRef in more places (nr. 5) (#4251)
This migrates almost all of the JsProxy EM_JS methods to use JsVals
In the process I relocated a lot more of `hiwire.c` to `jslib.c` or `jsproxy.c`.
2023-10-24 20:51:08 -07:00
Gyeongjae Choi f2d546dbe3
Bump numpy version to 1.26.1 and use meson backend (#4240)
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2023-10-25 12:20:58 +09:00
Hood Chatham 53fbd008f6
Switch PyProxy.toString from repr to str (#4247)
Resolves #4040.
2023-10-23 13:38:36 -07:00
Hood Chatham 835ffbf688
Use JsVal instead of JsRef in more places (nr. 4) (#4239) 2023-10-23 10:50:46 -07:00
Hood Chatham a41e267317
Use JsVal instead of JsRef in more places (nr. 3) (#4236)
This also fixes `JsArray_pop` which leaked memory and returned a singleton array
with the element removed rather than the element itself.
2023-10-22 10:35:44 -07:00
dependabot[bot] 98cc8a213f
Bump @babel/traverse from 7.21.3 to 7.23.2 in /src/js (#4228)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-22 15:02:12 +09:00
Hood Chatham d898809a84
Update dts-bundle-generator (#4238) 2023-10-22 15:01:25 +09:00
Hood Chatham 429dcd4b1f
Use externrefs for some ffi code (2) (#4226) 2023-10-21 12:09:56 -07:00
Hood Chatham 2d55a3e72b xfail syncify_not_supported in node 2023-10-21 09:20:09 -07:00
Hood Chatham 7a7691c25c Make jspi work correctly with nodylink builds 2023-10-21 09:20:09 -07:00
Hood Chatham 4bafdafcca Update JSPI patch for Emscripten 3.1.45 2023-10-21 09:20:09 -07:00
Hood Chatham 6117d7c90d Stack switching (#3210)
Uses the JS Promise integration stack switching API to allow blocking for JavaScript promises and
`PyodideFuture` objects. It's a bit complicated...
This doesn't include support for reentrant switching, currently doing that will corrupt the Python VM.
2023-10-21 09:20:09 -07:00
Hood Chatham d97eaa586a Use branch in macro to choose trampoline (#3990)
One of the cpython tests (test_plistlib.TestBinaryPlistlib.test_deep_nesting)
seems to be extremely sensitive to stack utilization and stack overflows in our
CI when even a tiny amount of extra stack is used. I doubt this is a problem in
real life -- I certainly cannot reproduce it outside of the CI service. But this
rearranges the code to avoid any additional stack usage so that CI will pass.
2023-10-21 09:20:09 -07:00
Hood Chatham 31c1345afd Move stack switching logic into a new stack switching folder. (#3987)
This is a minor rearrangment.

I renamed "continuations" stuff to "stack_switching" and made a new folder
for stack switching logic. I also added logic in esbuild.config.mjs to calculate
which functions exported from stack_switching.mjs and automatically copy them to
Module and into the Emscripten namespace. This makes unit testing a little neater
since there is no modification of the Module object.
2023-10-21 09:20:09 -07:00
Hood Chatham c931b06ab6 Patch CPython to use a type reflection trampoline if possible (#3964) 2023-10-21 09:20:09 -07:00
Hood Chatham 3085cb9d5e Use Wasm Exceptions for invoke stubs if they exist (#3957)
If wasm exception handling is available, use dynamically generated modules
with wasm exception handling for the invoke stubs instead of a JS trampoline.
This is useful because JS trampolines interact poorly with JS Promise Integration.

In the future, we should switch exception handling ABIs to the compiler-provided
wasm exception handling ABI and we can remove this code. Currently we are
blocked on using compiler-provided wasm eh by Rust support.
2023-10-21 09:20:09 -07:00
Deepak Cherian 408bffb7d2
bump xarray to 2023.10.0 (#4235) 2023-10-19 14:18:04 -07:00
Szabolcs Dombi 45b3b2ce01
Add zengl 1.16.0 (#4208)
ZenGL provides OpenGL binding for Python.
The same code that runs natively also runs in the browser as-is without modifications.
It does not depend on SDL, emscripten GLES or anything else.
It binds directly to WebGL2.
2023-10-18 13:44:44 -07:00
Hood Chatham 4860848a72
Add package frozenlist (#4231) 2023-10-18 18:14:06 +09:00
Hood Chatham 5a1826355a
Reorder test_jsarray_reverse tests (#4230)
For some reason reordering these tests fixes failing CI.
2023-10-16 18:31:53 -07:00
Hood Chatham 90fb414e41
Fix dts bundle generation (#4227)
v8.1.0 (just released) has a regression related to a self referential export in @types/node:
https://github.com/timocov/dts-bundle-generator/issues/264
2023-10-16 17:31:25 -07:00
Hood Chatham 98b4bf567c
Use externrefs for some ffi code (#4218)
This begins migrating some of the ffi code towards using externrefs, which
should make it faster and shorter.

I'm planning on migrating from the existing hiwire.h functions to new `jslib.h` 
functions which will operate on externrefs, but I think it will be easiest to 
do this in several PRs since it's going to be a fair amount of code that
changes (in mostly boilerplate ways though).
2023-10-16 11:47:38 -07:00
Gyeongjae Choi abb8bec1f6
Fix Emscripten.cmake not vendored in pyodide-build wheel (#4223)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-15 14:38:41 +09:00
Hood Chatham af7544cbbb
Add a no dynamic linking build option (#4203) 2023-10-14 12:13:27 -07:00
pfebrer 74bd881129
Add `sisl` package (#4210)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-13 20:54:27 +02:00
Jo Bovy 9402397fd0
DOCS Add brief section on upgrading packages (#4219) 2023-10-11 20:03:19 -07:00
Hood Chatham 357b07a25f
NFC Minor rearrangement of types.ts (#4215)
This puts package loading stuff together.
2023-10-11 10:05:44 -07:00