Commit Graph

2336 Commits

Author SHA1 Message Date
Hood Chatham 4fc2d02ccb Update changelog for v0.21.3 release 2022-09-15 15:38:38 -07:00
Hood Chatham a44cb5254f Add missing PR # to changelog 2022-09-15 10:56:02 -07:00
Hood Chatham 18124b53b2
Fix `PyProxy.apply` when `args` is undefined (#3101) 2022-09-15 09:27:41 +02:00
Hood Chatham aa4d22341a
DOCS Add faq entry on importlib.invalidate_caches (#3102)
[skip ci@
2022-09-14 21:19:43 +02:00
Hood Chatham fc8503d2de
Add create_index to create a pypa simple index and use it with xbuildenv (#3096)
Pyodide virtual environments created from release versions of Pyodide
will use this package index to install packages from jsdelivr.
2022-09-13 20:19:01 -07:00
Gyeongjae Choi ba5162ca77
ENH Simplify shared library loading process (#2954)
Instead of calling `loadWebAssemblyModule` and saving it to 
`preloadedWasm`, directly call `loadDynamicLibrary` with proper
`fs` args to locate other shared libs that are dependent.
2022-09-13 17:17:08 -07:00
Gyeongjae Choi edf175f013
TST Run package tests in Safari (#3095) 2022-09-14 09:13:53 +09:00
pre-commit-ci[bot] efcca8be91
[pre-commit.ci] pre-commit autoupdate (#2928) 2022-09-13 15:12:40 -07:00
dataxerik 9af9bee60b
DOCS add docstring examples for eval_code (#3090)
part of #1955
2022-09-13 10:31:52 -07:00
Gyeongjae Choi 2dc937c0b6
Enable libhdf5 and h5py (#2812) 2022-09-13 16:17:52 +09:00
Gyeongjae Choi c3a0ddb0c7
Add a version variable for Pyodide JavaScript Package (#3074) 2022-09-13 13:42:05 +09:00
Gyeongjae Choi 6d5de461a5
Proxy ranlib and strip (#3082) 2022-09-13 13:19:44 +09:00
Hood Chatham c53e229175
Fix webpack warnings and reenable webpack test (#3094)
This uses sed to insert /* webpackIgnore: true */ comments into pyodide.js. 
This resolves #3087. I also enabled a check that a simple webpack config
builds without warnings. In the future it would be good to add a test that it
also runs without error.
2022-09-12 15:00:54 -07:00
Hood Chatham b6d3281d67
Add command to create Pyodide virtual environment (#2976)
Inside the generated virtual environment, `python` will use node to run Pyodide.
Pip can be used to install packages into the environment.
2022-09-12 11:18:40 -07:00
Hood Chatham da74f913f9
Use __dirname for indexURL in node, include source maps in release again (#3088)
Webpack generates a warning for missing source maps. This fixes it. 
See issue #3086.
2022-09-11 17:10:54 -07:00
Hood Chatham 5142869ff4 Fix up after #3085
There is no longer a file called distutils.tar
2022-09-11 12:17:56 -07:00
David Lechner 39522cd83a
FIX for webpack: Export binary files in javascript package (#3085)
This adds the distributed binary files to the "exports" section of the package.json file. 
This allows the files to be referenced, e.g. by `require.resolve('pyodide/distutils.tar')`
which is useful for tools like webpack.
2022-09-11 12:11:59 -07:00
Roman Yurchak 4dd8a3e0cb
Switch to meta.yaml parsing with pydantic (#3079) 2022-09-11 09:20:56 +02:00
Roman Yurchak 4bbe60f8d3
Use matplotlib backends from matplotlib-pyodide (#3061) 2022-09-09 13:39:26 +02:00
Hood Chatham fbed5b0cf7
Fix creation of PyProxy when CSP without unsafe-eval is used (#3075)
See discussion following #2432 (comment).
2022-09-08 15:03:11 -07:00
David Lechner 60714a9cf0
Add browser polyfill for node url package. (#3080)
Fixes a webpack error. This package was missed in #2468.
2022-09-08 09:25:41 -07:00
Aierie baa82d1929
fix PATH and ERRNO_CODES failing puppeteer tests (#3078) 2022-09-08 18:11:28 +02:00
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