Commit Graph

495 Commits

Author SHA1 Message Date
Gyeongjae Choi d802fb3fdc
Remove pre-built docker image support (#3342) 2022-12-13 12:04:15 +09:00
Roman Yurchak d48a4f2193
Remove "Python initialization complete" log line (#3247) 2022-12-12 18:54:47 -08:00
Hood Chatham 33d1794a6e
Use a more robust method to improve our ModuleNotFound errors (#3263)
@ryanking13 added these very nice error messages to the `ModuleNotFound`
errors. However they introduce a few problems:
1. `find_spec` is supposed to return `None` or a spec and not to raise an error.
If it raises errors, it can cause trouble in code that tries to check if a module is
installed or not.
2. Other code that tries to add new import hooks has to know to insert them
before these error-raising import hooks.

See the discussion in #3262.

This instead patches `importlib._bootstrap` to create a function called
`_get_module_not_found_error`. We then can monkey patch this to modify
the error messages that `importlib` raises.

See Python issue: https://github.com/python/cpython/issues/100208
2022-12-12 18:35:51 -08:00
Hood Chatham 1410d2f526
Distinguish between sync and async JavaScript iterators when possible (#3339)
If a JavaScript has a `next` method and exactly one of `Symbol.iterator` or `Symbol.asyncIterator`
we use that to tell us whether we think `next` is sync or async. If both or neither of these
Symbols are present then we define both `__next__` and `__anext__`.
2022-12-12 17:33:46 -08:00
Jacques Boscq c9e47935c8
Add gensim package #2545 (#3326) 2022-12-07 00:08:49 +01:00
Loïc Estève 09e18f78af
Update scikit-learn to 1.1.3 (#3324) 2022-12-06 13:39:00 +01:00
Hood Chatham 1c34d76482
Emscripten 3.1.27 (#3314) 2022-12-02 16:12:42 -08:00
Hood Chatham 29323915c3
Add a typeshed for the js module (#3298)
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2022-12-02 09:16:16 +01:00
Roman Yurchak 5a237d93aa
Package pyinstrument (#3258)
Co-authored-by: Nicholas Bollweg <nick.bollweg@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-12-01 14:40:19 +09:00
Hood Chatham e2f415d83b
Add athrow and aclose to JsProxy of an AsyncGenerator (#3299)
Continuing with my work on support for generators, this adds `athrow` and 
`aclose` for async generators.

Currently if you use `athrow` and the generator doesn't catch the error, it will
throw a double wrapped error. This is probably also a problem with async calls
Python --> Js --> Python because the way that we control the Python exception
lifetime only works correctly in synchronous contexts. Fixing this is a TODO.

Also, there is still a question of what to do with return values of async Javascript
generators. Currently I think they are available from Python as 
`async_stop_iteration_exception.args[0]`.
2022-11-30 11:10:42 -08:00
Hood Chatham c2ac865e20
Add test for MutableMapping methods on object_maps and fix bug (#3297)
This adds tests of all the `MutableMapping` methods for objects returned by 
`as_object_map`. They all worked but I was accidentally adding only the non 
mutating methods. I also added `JsMap` and `JsMutableMap` to `pyodide.ffi` 
and fixed it so that `isinstance` works correctly and mypy agrees with the usage.
2022-11-30 11:07:15 -08:00
Gyeongjae Choi cc7a734c49
Add `requirements/executable` key in meta.yaml spec (#3300)
Adds a new key in meta.yaml spec: requirements/executable which specifies the list of executables required to build a package. Unlike conda, we don't build or install these executables. This key exists just to halt build earlier

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2022-11-30 16:40:36 +09:00
Gyeongjae Choi 6bf2550b67
Support loading shared libraries inside a wheel file globally (#3264) 2022-11-29 13:40:33 +09:00
Hood Chatham 1bb9eecef0
ENH Add support for asynchronous iterators to JsProxy (#3285)
This defines `__aiter__` for JavaScript objects with a `Symbol.iterator`. 
It also defines `anext` and `asend` for JavaScript objects with a `next` function.
These will fail with a suggestion to use `next`/`send` instead if the `next` function
does not return a promise.
2022-11-28 17:37:06 -08:00
Hood Chatham a1e43afbc0
Make as_object_map subclass MutableMapping (#3295) 2022-11-28 09:13:22 +09:00
Hood Chatham 420660eb50
Add support to PyProxy for using async python generators from js (#3290)
This adds support for using async Python generators via PyProxy.
2022-11-25 20:00:38 -08:00
Hood Chatham 560364b98a
Add type field to PythonError (#3289) 2022-11-25 17:01:03 +09:00
Hood Chatham 5e13a0065d
Implement Mapping / MutableMapping methods for JsProxy of a Map (#3275)
This adds methods `keys`, `items`, `values`, `get`, `pop`, `setdefault`, `popitem`, 
`update`, and `clear` to a `JsProxy` of a map-like object. Since both Sequence-like 
objects and Map-like objects have a `pop` method but they have different
signatures, I had to split the `JsProxy` documentation class into several different
classes. This is probably a good idea anyways. As a followup I could set it up so
that `isinstance` and `issubclass` work correctly on these documentation classes.
2022-11-23 23:10:21 -08:00
Loïc Estève 114a685dae
Update numpy to v1.23.5 (#3284)
There are Pyodide-related fixes that made it into numpy 1.23. 
For a particular that I bumped into, see: 
https://github.com/pyodide/pyodide/issues/3203#issuecomment-1290551624.
2022-11-23 23:07:44 -08:00
Gyeongjae Choi 00a88b819c
Fix docstring error when loadPyodide is called with -OO option (#3282) 2022-11-24 09:59:40 +09:00
Hood Chatham e4edd7a4d2
Make various JsProxy classes implement issubclass and isinstance more helpfully (#3277)
Before we had a single `JsProxy` documentation class. Apparently mypy treated
it as `Any`. It had a bunch of methods on it that may or may not appear in
any specific ` sProxy`.

This does two things:

1. Split up `JsProxy` class into several synthetic subclasses like `JsArray`,
`JsBuffer` etc. These work much better with mypy, they should also improve
documentation layout and it helps when different subclassess have different
methods with the same name (e.g., `JsArray` and `JsMap` both will have `pop`
methods).

2. Make `isinstance` and `issubclass` work correctly both with synthetic `JsProxy`
classes like `JsArray`, `JsBuffer` etc and with `type(an_actual_jsproxy)`.

This cleans up the bootstrapping mess in `_importhook` because the `JsProxy`
from `_core_docs` works fine for instance checks now. 

I had to make changes to various other Python files 
because mypy now understands the types better and noticed that there were type errors.
For instance, this fixed several minor mistakes in the types in `http.py`.
2022-11-22 17:04:10 -08:00
Hood Chatham 2df7a286ee
Emscripten 3.1.26 (#3280) 2022-11-21 17:34:49 -08:00
Hood Chatham 5ea48805a9
Add `as_object_map` method to JsProxy (#3273)
This adds a method which returns a new `JsProxy` that acts
like a container of the JavaScript object's `ownProperties`.
2022-11-21 16:59:47 -08:00
Joe Marshall 4a1913d3ad
build packages from pypi direct (#3196)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: Gyeongjae Choi <def6488@gmail.com>
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
2022-11-17 10:05:14 +09:00
Gyeongjae Choi 54b469b104
Remove pycryptodomex from the package list (#3261)
pycryptodomex was added in #2966, but it had an invalid recipe name meta.yml (not meta.yaml) so our build system didn't build that package.

I found that in #3006, and I also found that it is not building well, so I disabled it then. So, in other words, pycryptodomex never worked in Pyodide.

I would like to remove it from the changelog and the repository for now, so that we don't add it to our next stable release accidentally. Perhaps someone interested can re-add this package.
2022-11-15 18:26:11 -08:00
Hood Chatham 3692ff8b22
Emscripten 3.1.25 (#3239)
Co-authored-by: Gyeongjae Choi <def6488@gmail.com>

Adds a patch reverting an Emscripten commit that dropped a freetype patch.
2022-11-14 13:44:29 -08:00
Gyeongjae Choi 3ad41f13c7
Merge library and sharedlibrary key to build/type (#3238) 2022-11-13 12:31:14 +09:00
Hood Chatham 92a1a5c014
Fix exit in command line runner (#3241)
Don't set error code to 1 if the program calls exit(0)!
2022-11-09 21:37:36 -08:00
Hood Chatham 2cd616d441
Add support for loading .so files in command line runner (#3098)
This is needed to finish getting numpy tests working.

It won't work for packages that need shared libraries without some extra intervention.
ryanking's work in #3234 would help to fix this.

pip install scipy makes the command line runner extremely slow. Without scipy installed,
python -c 'print(1)' runs in about 1 second, but with it installed it takes more like 10 seconds
(time to load clapack_all.so and 111 different .so files in scipy, totaling 20 megabytes). We
have to load all of this despite the fact that we won't use any of it.
2022-11-09 13:05:01 -08:00
Gyeongjae Choi af206d159c
Add vendor-sharedlib key in meta.yaml spec (#3234) 2022-11-09 20:18:44 +09:00
Hood Chatham 201f541b63
Emscripten 3.1.24 (#3236) 2022-11-07 14:00:05 -08:00
Hood Chatham 3dfe5b35ef
Emscripten 3.1.23 (#3148) 2022-11-07 08:51:24 -08:00
Gyeongjae Choi 6bfb9ba329
PKG Add geopandas, fiona, and GDAL (#3213) 2022-11-07 13:44:23 +09:00
Gyeongjae Choi f7bb2489f9
Fix copying shared libraries after build (#3212)
This fixes two minor bugs when building packages:

- Shared libraries are not copied into dist directory when it is already built.
- When build fails, the shared library zip file remains in the package directory.

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2022-11-01 10:41:44 +09:00
Yizhi Liu ee77f6c556
XGBoost: Fix type mismatch for CSR conversion in c_api (#3194) 2022-10-27 09:52:24 +09:00
Gyeongjae Choi f48893c33a
Add _hashlib to unvendored stdlib (#3206) 2022-10-26 10:59:01 +09:00
Gyeongjae Choi b610f2c7e0
Add `pyodide skeleton` command (#3175) 2022-10-25 14:52:11 +09:00
Jeremy Tuloup c76573de1c
Add Gitpod configuration (#3201) 2022-10-24 21:13:01 +02:00
YeonWoo 97cd5bdc1c
Fix repr_shorten and add shorten (#3178)
Added example for `repr_shorten` in issue #1955.
Fixed bugs found when adding examples.
Added `shorten` function.
2022-10-21 09:09:50 -07:00
Gyeongjae Choi 393988f601
Fix undefined symbol error when loading shared lib (#3193) 2022-10-21 10:04:57 +09:00
Qijia Liu 693570755c
PKG add wordcloud (#3173) 2022-10-12 08:28:29 +09:00
Hood Chatham 2326c05d83
Add roundtrip parameter to create_proxy (#3163) 2022-10-09 20:23:59 -07:00
partev ab65d47cbe
DOC: fix a typo "type" -> "time" (#3172)
[skip ci]
2022-10-06 22:34:25 +02:00
Gyeongjae Choi dc5096bfcb
PKG add libheif, pyheif, and pillow_heif (decoder only) (#3161)
This adds libheif and Python packages that use libheif to support HEIC image format.

Note that this is "decoder" only. libheif use libde265 for decoder and libx265 for encoder, and I only added libde265 in this PR. I think decoding is more important in our use case, hence this PR.
2022-10-05 11:41:35 +09:00
Gyeongjae Choi 825a01e3af
Add options to disable integrity check in pyodide.loadPackage (#3149)
This PR adds an option to disable integrity check in `pyodide.loadPackage` when it is loading packages registered in repodata.json.
2022-10-05 08:32:11 +09:00
Gyeongjae Choi d2fce73291
Prevent backend-flags from propagating to dependencies (#3153) 2022-10-04 08:57:24 +09:00
Gyeongjae Choi 83ba807b10
Handle shared libraries with version suffix (#3154) 2022-09-30 11:06:41 +09:00
Gyeongjae Choi 7dfee03a82
ENH Add API for mounting native file system (#2987)
This PR adds an API pyodide.mountNativeFS which mounts FileSystemDirectoryHandle into a Pyodide Python file system.

Note that there are some limitations such as:

- File System Access API is only supported by Chromium-based browsers (Safari also implements a portion of it but they only support Origin Private File system so it is not very useful for common users).
- The file system is asynchronous, so one needs to call syncfs to persist changes.

Since it is asynchronous, it does not require any WebWorker, SharedArrayBuffer, or Atomics. But I think we can extend this to a synchronous version using those features
2022-09-30 09:24:53 +09:00
Hood Chatham 51803cae8c
Add capture_this keyword argument to create_proxy (#3145)
A followup to #3103. Allows creation of proxies from Python with `captureThis` set to `true`.
2022-09-29 01:27:49 -07:00
Gyeongjae Choi 8f8b107415
Add import hook for packages registered in repodata.json (#3137) 2022-09-28 09:05:00 +09:00
Yizhi Liu f28bf95c84
Add lightgbm package (#3138) 2022-09-27 10:14:11 +09:00
Gyeongjae Choi a1b72c6fa3
DOC Remove warnings about pyodide-cdn2.iodide.io (#3150)
[skip ci]
2022-09-26 09:46:19 +02:00
Roman Yurchak 0b4d73fa3e
Include micropip from a separate repository (#3122) 2022-09-24 13:02:17 +02:00
Hood Chatham cf3f355306
Add descr_get handler to JsMethod (#3130) 2022-09-23 00:36:38 +02:00
Gyeongjae Choi 50f46358c2
CI Fix PyPI deploy (#3139) 2022-09-21 17:27:55 +02:00
Gyeongjae Choi 69b2d3f157
Add debug build option for js package (#3129) 2022-09-21 14:20:08 +09:00
Hood Chatham 32ccd545b4
Add bcrypt (#3125) 2022-09-20 13:46:43 +09:00
Hood Chatham 1a66912341
Add support for passing 'this' to Python (#3103)
Some people have expressed the difficulty that certain JavaScript frameworks
use `this` in critical ways and so a `PyProxy` callback cannot be handed to them
because there is no way for the `PyProxy` to get access to the `this` argument.
See #2901 for example. The goal of this PR is to address this. We cannot always
pass `this` through because usually it isn't useful. So the idea is to add an internal
setting on the `PyProxy` indicating whether it should be passed and some way to
set this setting. Currently I've added a method called `captureThis` which indicates
that `this` should be passed as an argument to Python.
2022-09-19 20:32:39 -07:00
Will Lachance aac2eede0a
Update pandas to 1.5.0 (#3134)
This removes a single patch which has since been upstreamed.
2022-09-19 19:18:02 -07:00
Hood Chatham 09af24b3b5
DOCS Add docs for out of tree builds (#3109) 2022-09-18 17:36:12 -07:00
Aierie 4b2191ebd6
Allow use with (module-type) service workers (#3070) 2022-09-17 21:35:32 -07:00
Hood Chatham 0eb6036b85
Update to emscripten 3.1.21 (#3107) 2022-09-15 16:58:14 -07:00
Hood Chatham 7b3b2e8b8c Fix changelog format 2022-09-15 16:24:07 -07:00
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
Gyeongjae Choi edf175f013
TST Run package tests in Safari (#3095) 2022-09-14 09:13:53 +09:00
Gyeongjae Choi c3a0ddb0c7
Add a version variable for Pyodide JavaScript Package (#3074) 2022-09-13 13:42:05 +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 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
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
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
Gyeongjae Choi 555f7828f4
Parse top-level import name from wheel file (#3006) 2022-09-06 15:20:04 +09: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
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
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 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
Hood Chatham b64c32c213
Update changelog for 0.21.2 (#3029) 2022-08-29 11:04:43 -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 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 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 6acd1dd02b
Add an import hook for unvendored and removed stdlibs (#2973) 2022-08-17 22:03:21 +02:00
Starz0r 8dba657ac1
Add package `pycryptodome` (#2965) 2022-08-17 19:56:33 +02:00
Gyeongjae Choi da70299d1e
Update emscripten to 3.1.15 (#2958) 2022-08-17 19:14:10 +09:00
Hood Chatham ed8f2b204e
Add more array methods (#2970)
Add pop, append, reverse, __reversed__, index and count.
2022-08-16 23:02:51 +02:00
Starz0r 828b55a22d
PKG Add package `pycryptodomex` (#2966) 2022-08-16 11:34:15 +09:00
Gyeongjae Choi b497ce26ed
Add lzma (#2939) 2022-08-11 17:52:23 +09:00
H.Yamada ef8b3a790d
Fix Emscripten version in Change Log (#2956)
* Change Emscripten version in changelog to v3.1.14
* Add overlooked PR2775
2022-08-10 09:49:51 +02:00
Gyeongjae Choi 5e412795ed
0.21.0 (#2935) 2022-08-09 15:36:10 +02:00
Matt Toad 58ce5e0aa8
DOC fix changelog badges (#2952)
This PR reverts the indentation change introduced in #2909, to make sure badges 
are displayed correctly. I've checked at pyodide.org/en/latest/project/changelog.html 
and badges are, in fact, temporarily broken.
2022-08-08 15:13:02 +02:00
Liumeo 52e8fa5ddb
Add python-magic (#2941) 2022-08-08 14:04:31 +02:00
Hanno Rein 8a9feaac51
Add REBOUNDx package (#2909) 2022-08-08 14:02:43 +02:00
Mu-Tsun Tsai 875e2b51de
PKG Add package `brotli` (#2925)
Co-authored-by: Gyeongjae Choi <def6488@gmail.com>
2022-08-08 11:25:36 +09:00
Hood Chatham e673fde7cf
Implement slicing, +=, and extend for arrays (#2907)
Work towards making a JsProxy of an array implement
the MutableSequence interface.
2022-08-02 05:58:42 +02:00
Roman Yurchak c85e00806b
MAINT Switch to pytest-pyodide (#2893)
Co-authored-by: ryanking13 <def6488@gmail.com>
2022-07-31 19:00:45 +09:00
Gyeongjae Choi 7231cab3ff
DOC Fix doc warnings (#2898) 2022-07-25 13:30:56 +09:00
Rob Gries c7c22eab1a
Fix Windows Node errors on loading pyodide (#2888) 2022-07-20 10:20:59 +09:00
haoran1062 f15b99d663
PKG Add pyclipper (#2886)
Co-authored-by: 刘浩然 <liuhaoran@ingbaobei.com>
2022-07-19 15:18:29 +09:00
Hanno Rein 0ce3b98d45
PKG Add REBOUND package (#2868)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jo Bovy <jo.bovy@gmail.com>
2022-07-15 09:15:16 +09:00
Ryan May c05b76273b
PKG Add PyProj (#2555)
Co-authored-by: Gyeongjae Choi <def6488@gmail.com>
2022-07-07 09:14:31 +09:00
Hood Chatham 207bd9252e
Package: add termcolor (#2809)
Termcolor doesn't have a wheel on pypi and doesn't look very maintained.
It is used by pytest-sugar.
2022-06-29 20:32:13 -07:00
Hood Chatham a7d7cd51b5
Add test coverage for bool(JsProxy) and fix some cases (#2803)
Resolves #2802 and several other oddities in the behavior of bool.
2022-06-29 20:30:24 -07:00
Hood Chatham 1ffe2af2fa
Add pytest-benchmark (#2799) 2022-06-29 10:47:01 -07:00
Hood Chatham 516364e468
Move more functions into submodules of pyodide (#2790)
This resolves #2689.
2022-06-28 06:31:58 -07:00
Hood Chatham 49807b699c
ENH Add flag to run bash script in cross build environment (#2734)
This script will run with the target environment variables and
sysconfigdata and with the pywasmcross compiler symlinks.
Any changes to the environment will persist to the main build
step but will not be seen in the post step (or anything else
done outside of the cross build environment). The working
directory for this script is the source directory.
2022-06-27 21:05:53 -07:00
Hood Chatham 761b6320ba
Move eval functions to pyodide.code submodule (#2787)
This raises a deprecation warning the first time such a function is used. Work towards #2689.
2022-06-25 21:20:22 -07:00
Hood Chatham 9aa179a520
Rearrange changelog (#2774) 2022-06-23 14:11:25 -07:00
Hood Chatham 23c5587cfb
ENH Add micropip support for loading wheels from emfs (#2767) 2022-06-23 11:59:47 -07:00
Hood Chatham b01cc1a800
ENH Allow specifying a custom lock file (#2645)
This option is intended to be used with micropip.freeze. A user can
save the lockfile generated by micropip.freeze and load that lock
file while using the rest of the files from the CDN.
2022-06-23 09:33:53 -07:00
Gyeongjae Choi 929d296a09
PKG Add libtiff (#2762) 2022-06-23 16:15:43 +09:00
Gyeongjae Choi b65247dc40
Bump opencv-python version to 4.6.0.66 (#2761) 2022-06-22 11:13:24 -07:00
Gyeongjae Choi 1acc3b5b01
Fix micropip error when a package contains invalid version (#2754) 2022-06-22 09:22:32 +09:00
Gyeongjae Choi d80f702a7e
Fix micropip.list() error when there is a package loaded from a custom url (#2743) 2022-06-21 13:27:07 +09:00
Roman Yurchak 8de2a04ab0
API Rename packages.json to repodata.json (#2749)
Closes #2747

 * renames packages.json to repodata.json
 * renames the corresponding JS and Python variables to be a bit more explicit.

Tangentially related to #795
2022-06-20 14:46:11 -07:00
Gyeongjae Choi 16bb0e86fd
PKG Add sparseqr and suitesparse (#2685)
Co-authored-by: Gabriel Fougeron <gabriel.fougeron@hotmail.fr>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-06-20 13:35:27 +09:00
Gyeongjae Choi 38fae6e9cb
PKG Add shapely and geos (#2725)
Co-authored-by: Hood <hood@mit.edu>
2022-06-17 11:26:09 +09:00
Jo Bovy b880ec2395
PKG Add galpy (#2676)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-06-09 14:04:28 +02:00
Gyeongjae Choi 587a73fa14
PKG Add XGBoost (#2537)
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2022-06-07 17:49:57 +09:00
Gyeongjae Choi 184c6d5bed
Disable cursor blinking in the REPL if `noblink` is specified (#2666)
e.g. https://pyodide.org/en/latest/console.html?noblink
2022-06-06 17:14:29 -07:00
Liumeo 9b76b7a4ee
Add gmpy2 and its dependencies (#2665)
Add gmpy2 and its dependencies libmpc, libmpfr and libgmp. 
gmpy2 is an optional dependency of SymPy.
2022-06-05 19:09:15 -07:00
Hood Chatham 95b1194945
Enable Wasm BigInt (#2643)
This enables WASM_BIGINT while maintaining (hypothetical) Safari 14 support
by shimming BigInt64Array and BigUint64Array if they are missing. I think the
last time we tried to enable WASM_BIGINT was before #2019 so our chances
are significantly better this time.

This will fix dynamic linking bugs and yields a minor reduction in code size.
2022-06-02 10:09:54 -07:00
Hood Chatham cfdb77f642
ENH Add support in micropip for installing binary wheels (#2591)
We use `packaging.tags.sys_tags` to get the list of supported tags
then use `packaging.utils.parse_wheel_filename` to get the set of
tags the current wheel implement then check if one of the wheel's
tags is a supported tag. This is a fully accurate check method and
could also catch things like abi3 wheels that are compatible with
multiple Python versions.
2022-05-29 19:00:10 -07:00
Hood Chatham 2f4f258bb5
MAINT Use target sysconfigdata rather than host sysconfigdata when cross compiling (#2516)
sysconfig.py uses the environment variable `_PYTHON_SYSCONFIGDATA_NAME`
to decide where to look for the sysconfig data file with info about the compile target.
We also need to separately insure that our sysconfig data file is on the path. We
don't want the rest of our target stdlib on the path, so I made an extra sysconfigdata
folder, copied the sysconfig data into it, and put it on the path.
2022-05-29 18:59:10 -07:00
Gyeongjae Choi a11f72e145
Simplify the version bump process (#2587) 2022-05-30 10:26:40 +09:00
Roman Yurchak a749c4ee38
Add spinner + better attribution in REPL (#2635) 2022-05-29 10:37:09 +02:00
echorand (Amit Saha) 377bb50c14
Fix support for extras in micropip (#2584)
Fix for #2535

See explanation:
https://gist.github.com/amitsaha/df2141e7e798d946ae559bf34e74ab42
2022-05-28 12:43:17 -07:00
Hood Chatham 8ed430d300
Allow using other decorators with `@run_in_pyodide` (#2541)
Allow using `pytest.mark.xfail`, `pytest.mark.parametrize`, hypothesis,
and other decorators in `run_in_pyodide` tests
2022-05-25 10:31:26 -07:00
Hood Chatham 2513a89616
Update Emscripten binary wheels to include Emscripten platform tags (#2610) 2022-05-25 08:39:33 +02:00
Hood Chatham 843dc39d7d
Fix pyfetch when there is a cors error (#2598) 2022-05-24 10:15:37 +02:00
Hood Chatham 6efe7c356f
ENH Add `micropip.freeze` (#2581)
This adds a function `micropip.freeze()` which creates a `packages.json`
lock file which includes all packages that were loaded by micropip in the
current Pyodide session. This can be used in subsequent sessions to load
the same set of packages with `pyodide.loadPackage`.

For example in our repl:

```py
from js.console import log
import micropip
await micropip.install("sphinx-version-warning") # Installs 19 wheels from pypi
log(micropip.freeze())
```
Then opening the browser console, we can copy the JSON and make a new 
`packages.json` file out of it. (Our repl will just say "<Long output truncated>"
but the browser console truncates it and provides tools to make it easy to copy.) 
Reloading the page with the new `packages.json`, `versionwarning` will autoload:
```py
import versionwarning # Automatically loads 19 wheels from PyPI
```
We detected that `versionwarning` is an export provided by the `sphinx-version-warning`
package via the `top_level.txt` file. This file is part of the `egg-info` spec but isn't
mentioned anywhere in the `dist-info` spec. But wheels seem to include it nonetheless.
2022-05-23 14:10:33 -07:00
Kyle Cutler 7d3c724665
Export PATH and ERRNO_CODES from Emscripten (#2582)
BrowserFS can mount custom filesystems into Emscripten. 
However it requires the PATH and ERRNO_CODES exports from
Emscripten in addition to FS.

This exports `PATH` and `ERRNO_CODES` from `Module` into the `pyodide`
Javascript API so they can be used with BrowserFS.
2022-05-19 11:02:52 -07:00
Hood Chatham 7fc1c2da8e
FIX Fix feature detection when `obj.constructor` is undefined (#2520)
Currently the following code fails:
```py
from js import eval
eval("Object.create(null)")
```
with:
```py
Traceback (most recent call last):
  File "<console>", line 1, in <module>
JsException: TypeError: Cannot read properties of undefined (reading 'name')
```
This fixes it.
2022-05-18 22:19:37 -07:00
Hood Chatham f2d80e0843
ENH Use `dist-info` + `importlib.metadata` to store and retrieve package metadata (#2572)
This switches to using the file system to store the information about packages
and using importlib.metadata to retrieve it.
This has two related benefits:

    We don't have to separately maintain our own separate state about what
    we've installed.

    We are guaranteed to agree with the Python stdlib about whether or not a
    package is installed, and if so which version is installed. Since the state is
    maintained in only one place, there is no chance of it diverging.

According to the packaging specs, if the package is from a url we should put
that into a file here:
packaging.python.org/en/latest/specifications/direct-url/#direct-url
Other than that, we should set the INSTALLER to pyodide.loadPackage
if the package was loaded with pyodide.loadPackage either directly or
indirectly via micropip. Otherwise set INSTALLER to micropip. That
way we can maintain the current behavior of micropip.list:

    if direct_url.json is present, then source is the url in direct_url.json
    otherwise, set source to pyodide if INSTALLER is pyodide.loadPackage
    and set it to micropip if INSTALLER is micropip.

Oddly enough, the packaging specs suggest no place to put the source
index, so it seems that according to the specs if a package was installed
by name from some custom index, this info should not be recorded.
2022-05-18 14:37:34 -07:00
Ben Jeffery 4417005e2c
PKG Add msprime and deps including libgsl (#2548)
msprime is a widely used genetic simulation tool.
2022-05-17 12:31:43 -07:00
echorand (Amit Saha) b0f7feb210
ENH Verifying checksum when loading packages in browser (#2513)
This PR does the following to complete #2431:

    * Calculate the Subresource integrity hash from the sha256 as explained here:
    https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
    As the document explains, it is a base64 encoded string of the "binary" hash, 
    not the data returned by hexdigest() method.
    * Implement the verification of the checksum when loading packages

This ignores the verification for NodeJS environment as the node-fetch module
doesn't support the integrity option. Node 17.5.0 has added the fetch API as
experimental, it would be prudent to come back and fix this when we are ready
to use that version.
2022-05-16 13:41:01 -07:00