Commit Graph

2314 Commits

Author SHA1 Message Date
Gyeongjae Choi 0333d1fa36
CI Fix pytest runtime option syntax (#3084) 2022-09-08 22:39:42 +09:00
Roman Yurchak f3ba7865b2
Run core tests in Safari (#2578)
Co-authored-by: Gyeongjae Choi <def6488@gmail.com>
2022-09-08 10:43:55 +09:00
Hood Chatham 2c6c788cb4
Fix browser_resolvePath when no base is provided (#3077) 2022-09-07 17:53:41 +02:00
Roman Yurchak 853f88c1ae
DOC Improve documentation on loading packages (#3064)
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2022-09-07 08:53:55 +02:00
Gyeongjae Choi 555f7828f4
Parse top-level import name from wheel file (#3006) 2022-09-06 15:20:04 +09:00
Hood Chatham 3e2d7f29a5
Add command line runner main entry script (#3044)
This PR contains the changes from #3039 and #3040 which should be merged first.
The purpose is to add the main command line script from #2976.
2022-09-05 09:15:13 -07:00
Hood Chatham 525b5a1785
Update scipy to 1.9.1 (no meson) (#3043)
This updates scipy to v1.9.1. This was mercifully easy:

* for now we disable meson
* we dropped `patches/0014-BUG-Fix-signature-of-D_IIR_forback-1-2.patch` since it was upstreamed
* we had to add a patch to put fitpack back into a shape that makes f2c happy
* we need one more `-Wincompatible-function-pointer-types` fix upstream PR: https://github.com/scipy/scipy/pull/16934
2022-09-04 22:39:32 -07:00
Roman Yurchak 80fb9d226c
Add codecov configuration (#3067) 2022-09-05 14:30:27 +09:00
Hood Chatham 0e363f0e1c
Add coverage package (#3053) 2022-09-04 13:14:12 +02:00
Gyeongjae Choi e4bc821d35
Raise error when static libraries are specified as a runtime dependency (#3055) 2022-09-04 12:53:09 +02:00
Hood Chatham f0ed62768d
Webloop in progress tracking (#3040)
More work split from #2976. This adds tracking for how many web loop
handles are active. It also adds handlers for when SystemExit or
KeyboardInterrupt are raised. The purpose of these is to allow us to keep
the Python interpreter alive until all tasks are completed, unless SystemExit
or KeyboardInterrupt is raised.

See https://github.com/hoodmane/pyodide/blob/cmdline-runner/tools/python.js for their use in context.
2022-09-02 02:39:34 -05:00
Gyeongjae Choi e5888f644b
Fix and xfail some flaky tests (#3059) 2022-09-02 09:00:11 +02:00
Gyeongjae Choi 09aa16a9a0
Load packages in a topologically sorted order (#3020)
This commit changes how we load packages.

Before, we loaded all shared libraries first then all Python packages.
All shared libraries / Python packages were loaded in a random order,
which might cause a problem if there is a load-time dependency between libraries or between packages.

Now we load them in a topologically sorted order regarding dependencies.
2022-09-02 10:19:42 +09:00
Gyeongjae Choi de7a2e0b7e
Minor build optimizations for libraries (#3047) 2022-09-01 10:00:20 +09:00
Hood Chatham 0df5f79095
Scipy: Use NPY_BLAS_LIBS and NPY_LAPACK_LIBS environment variables (#3048)
Use environment variables to tell scipy about BLAS and LAPACK.
2022-08-31 12:07:05 -07:00
Prete f203a2a88d [Docs] Fix 'Loading packages' CDN url (#3052)
Fix script double slash on script import

Remove extra shlash after PYODIDE_CDN_URL. It seems that the
var already ends with a forward-slash, so when building the CDN URL
`"{{PYODIDE_CDN_URL}}/pyodide.js"` that creates a double slash (ie:
`https://cdn.jsdelivr.net/pyodide/v0.21.2/full//pyodide.js`) and that is not a valid
url. No slash is needed between the variable `PYODIDE_CDN_URL` and
`pyodide.js`.
2022-08-31 10:23:38 -07:00
Gyeongjae Choi b68c04cb46
Use time.perf_counter for benchmark (#3046) 2022-08-30 18:27:58 -07:00
Hood Chatham e6e7d56752
MAINT Remove custom setuptools_rust commit (#3045) 2022-08-30 17:29:25 -07:00
Hood Chatham 1d2f9bff7a
Initialize loadedPackages from importlib distributions (#3039)
This initializes `pyodide.loadedPackages` from the file system
`importlib.metadata.distributions`. This makes it possible to handle the case
when the `site_packages` is persistent or packages are preinstalled there (say
with `--preload-file`).

Split off from #2976.
2022-08-30 14:55:02 -07:00
skelsec c0e8b2d556
DOCS Add more info on Rust compilation (#3042)
I was having a hard time getting the cryptography package compiled on the latest
version in the docker container because of the special requirements to get Rust
working. Added a small section to the documentation describing the steps I took
to make it work.
2022-08-30 12:22:50 -07:00
Hood Chatham 1335d7ee64
Add argument handling and _run_main function (#3021)
The command line runner in #2976 finally works, but it is a large change set so
I am planning to split it up. This is the first PR split off from there.

This PR adds a patch to Python to expose pymain_run_python. We cannot use the
public API Py_RunMain for this purpose because it finalizes the Python
interpreter with Py_FinalizeEx when it is done. If we start an async task with
Py_RunMain then it will segfault. pymain_run_python does a large amount of work
and reproducing it is undesirable.

I added an args parameter which accepts command line arguments. The private
entry point pyodide._main._run_main() executes the main Python entrypoint
without shutting down the interpreter and returns the return code.
2022-08-30 08:49:06 -07:00
Gyeongjae Choi 6964672556
Fix incorrect package name of ruamel.yaml (#3036) 2022-08-30 16:25:13 +09:00
Hood Chatham 18bf30c0bd
MAINT Improve handling of fatal startup errors (#3023)
This moves the fatal startup errors into a separate function and added `stderr`
redirection so that the error context can be included in the error message.

The new errors look like:
```
FatalPyodideError: Failed to import _pyodide module
Traceback (most recent call last):
  File "/lib/python3.10/_pyodide/__init__.py", line 20, in <module>
    blah()
  File "/lib/python3.10/_pyodide/__init__.py", line 19, in blah
    f()
  File "/lib/python3.10/_pyodide/__init__.py", line 18, in f
    raise Exception("oops")
Exception: oops
```
2022-08-29 21:23:49 -07:00
Hood Chatham 939b615df0
Emscripten 3.1.20 (#3027)
GSW patch:
TEOS-10/GSW-Python#99

galpy patch:
jobovy/galpy#499

pyerfa patch:
liberfa/pyerfa#89

astropy patch:
astropy/astropy#13586

scipy patch:
scipy/scipy#16924
2022-08-29 18:57:05 -07:00
Gyeongjae Choi 7010d26853
TST Benchmark package load time (#3030) 2022-08-30 09:50:59 +09:00
Hood Chatham b64c32c213
Update changelog for 0.21.2 (#3029) 2022-08-29 11:04:43 -07:00
Hood Chatham 3a27b48784
Handle case when Python startup code calls exit (#3024)
If Python startup code calls `exit` (for instance because `--version` or `--help`
was passed), then Emscripten calls `quit` which throws the error. The enclosing
environment catches that error and burns the evidence. This modifies `quit` to
record the fact that `exit` was called and rethrow the error (which will include the
exit code). Otherwise, trying to run the command line runner with `python --version`
will segfault.
2022-08-28 22:27:02 -07:00
Hood Chatham 706fd0f19b
Install standard library into /lib/python3.10/ not into the site-packages directory (#3022) 2022-08-29 08:53:37 +09:00
Hood Chatham 9fefb1a199
MAINT Remove incorrect assignment to loadedPackages (#3026) 2022-08-27 22:18:32 -07:00
Hood Chatham 88881d7c2b
Improvements to indexURL (#3015)
Fix indexURL:
1. when it's a relative path
2. when `--enable-source-maps` is used
This resolves #2764.
2022-08-27 22:17:51 -07:00
Hood Chatham 3160ac937e
Add patch to Emscripten to fix some of the Jest problems (#3014)
This fixes one of the problems in #2764. 
See upstream PR emscripten-core/emscripten#17733
2022-08-26 11:57:09 -07:00
Hood Chatham 3085b9fe73
Fix loadPackage on relative urls (#3013)
This fixes #3011.

We attempted to make a test for this, but in all of our tests 
`document.location === indexURL`. Our logic incorrectly used indexURL
instead of `document.location`.
2022-08-26 08:53:32 -07:00
Hood Chatham 325291ab87
Use upstream C++ error formatting support (#2828)
The logic that we are using to format C++ exceptions has been upstreamed. 
This will also work correctly with wasm exceptions.
2022-08-25 14:41:39 -07:00
Gyeongjae Choi 7ef6bf8b3e
Remove socketmodule from ssl (#3009) 2022-08-25 09:25:44 +09:00
Hood Chatham 7bb413d178
Add then, catch, and finally_ methods to future (#2997) 2022-08-24 15:12:03 -07:00
Hood Chatham 53a4f840dc
Add extra minimal release, also add xbuildenv to artifacts (#2999) 2022-08-24 14:22:33 -07:00
Gyeongjae Choi ad128337e8
Unpin setuptools version (#3010) 2022-08-24 08:32:26 +02:00
Roman Yurchak 4cdc054cb7
DOC Switch to Plausible analytics in the docs (#3004) 2022-08-23 09:15:11 +02:00
Patrick Arminio f864eee8b5
DOC Fix typo in format_exception example (#3005) 2022-08-23 13:52:37 +09:00
Gyeongjae Choi b4433e1b4a
Do not load unvendored stdlibs by default (#2998)
As discussed in #2940, this PR changes the default value of the fullStdLib flag in loadPyodide to false.
This is a breaking change because for now distutils is not loaded by default.
Also, when fullStdLib is set to true, it loads all unvendored stdlibs except for test.

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2022-08-23 11:52:27 +09:00
Hood Chatham fdf39f89ef Update changelog to reflect 0.21.1 release 2022-08-21 22:26:36 -07:00
Roman Yurchak 62de53f5a8
Add build dependencies to meta.yaml (#2132)
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: Gyeongjae Choi <def6488@gmail.com>
2022-08-22 13:35:27 +09:00
Hood Chatham 345131074c
Rename released bundle from pyodide-build.tar.gz to pyodide.tar.gz (#2996) 2022-08-21 17:36:00 -07:00
Hood Chatham 67aa16861d
Update Emscripten to 3.1.18 (#2950) 2022-08-21 17:17:49 -07:00
Gyeongjae Choi 26535e33cd
Unvendor sqlite3 from stdlib (#2946)
Unvendor the standard library sqlite3 to reduce the size of the main module. It reduces the size of pyodide.asm.wasm around ~1.4MB.

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2022-08-22 08:52:50 +09:00
Hood Chatham 02644bd353
Set MIN_SAFARI_VERSION to include v14.0 (#2994) 2022-08-20 07:55:22 +02:00
Gyeongjae Choi 5b35c272a0
Fix emscripten version check test (#2990) 2022-08-20 02:56:20 +02:00
Hood Chatham b1ab8f0de4
Add an Emscripten version check for out of tree builds (#2975)
The out of tree build system applies an abi tag based on `PYODIDE_EMSCRIPTEN_VERSION`
in `Makefile.envs`. Prior to this PR, it will happily accept the version of emscripten (say 3.1.18)
and produce a wheel tagged like it was produced from the expected Emscripten version (say 3.1.14).
This causes confusing errors due to ABI mismatch see igraph/python-igraph#560. This error message
should help prevent such confusion.
2022-08-18 09:28:10 +02:00
Hood Chatham b419bffa15
loadPackage should say that packages downloaded from pypi come from pypi (#2980) 2022-08-18 09:27:03 +02:00
Gyeongjae Choi e7a7bad1a9
MAINT Prevent `make rust` command from generating a temp file (#2984) 2022-08-18 09:26:31 +02:00