Commit Graph

912 Commits

Author SHA1 Message Date
Angus Hollands 571e843e9a
feat: add awkward-cpp v22 (#4101) 2023-08-30 16:28:59 +02:00
Hood Chatham a8f2409426
ENH Add `loadPyodide` `packages` option for loading packages during bootstrap (#4100)
For improved loading performance.
2023-08-29 13:43:07 +02:00
Hood Chatham df527fdad5
Emscripten 3.1.45 (#4094) 2023-08-29 13:37:31 +02:00
Hood Chatham 09c7251d56
DOCS minor changes to quickstart (#4098)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-29 17:53:44 +09:00
Ian Thomas f769f83023
Add contourpy 1.0.7 package (#4102)
This PR adds the ContourPy package, which is a C++ extension that is a dependency
of Matplotlib >= 3.6.0 and Bokeh >= 3.0.0. Note that this is the previous version (1.0.7)
of ContourPy, not the latest one (1.1.0) that uses Meson as I am still trying to get that
to build with the correct compiler flags.
2023-08-29 09:58:20 +02:00
Hood Chatham 5960544ef2
PERF Avoid instance checks in pyproxy_getflags when possible (#4096)
Profiling shows that `PyObject_IsInstance` is pretty expensive. This
skips it when conditions we've already measured imply that they will
return false anyways.

This gives a 33% performance improvement on the following:
```js
pyodide.runPython(`
from pyodide.code import run_js
from timeit import timeit
f = run_js("() => {}")

d = {}

n = 200000
timeit("f(d)", number=n, globals={"f": f, "d": d}) / n * 1e6
`);
```
2023-08-28 16:12:45 +02:00
Hood Chatham 303e02e5a7
ENH Add `response.text` to `pyodide.http.FetchResponse` (#4052)
We've received feedback from users that use other requests APIs that they expect
the method to be called `response.text` instead of `response.string`. Indeed both
the Fetch response API and the Python requests library use this convention:

https://developer.mozilla.org/en-US/docs/Web/API/Response/text https://requests.readthedocs.io/en/latest/api/#requests.Response.text

This adds `response.text` to `FetchResponse`. It is a synonym for `response.string`.
This also marks `response.string` as deprecated but does not schedule it for removal.
2023-08-28 13:40:56 +02:00
Hood Chatham 311fa904d4
ENH add filename argument to runPython and use linecache for better tracebacks (#3993) 2023-08-28 13:18:50 +02:00
Hood Chatham 4d99d07366
Emscripten 3.1.44 (#4073) 2023-08-26 22:46:42 +02:00
nascheinkman 7b0af2d4cd
Add CoolProp v6.4.3 to packages (#4028)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-23 20:19:14 +09:00
Luiz Irber 070bb2e9c0
Bump sourmash to 4.8.3 (#4075) 2023-08-23 20:18:13 +09:00
Hannes Krumbiegel ce36a6d521
Add comment that WSL 2 is needed on Windows (#4079) 2023-08-21 21:13:01 +09:00
Neil Stoker 9369ce0019
Docs: update list of removed stdlib pkgs (#4078) 2023-08-21 08:43:52 +02:00
Hood Chatham e19621d483
ENH Rework streams handling (#4035)
This fixes a number problems with the old stream handling:

1. Not possible to set a custom errno (necessary for proper interrupt
   handling and possibly for other things)

2. Inefficient: in a lot of cases we have data in one buffer and we need
   it placed into a different buffer, but we have to implement a function
   that gets one byte out of the source buffer and then call it repeatedly
   to move one byte at a time to the target buffer.

3. Ease of implementation: in many cases we already have perfectly good
   buffer manipulation APIs, so if we have direct access to the true source
   or target buffer we can just use these. See: the node IO code, which got
   much simpler.

This is backwards compatible, so you can still use the old input mechanism
or use buffered or raw output. But it adds a new method of directly implementing
read/write. For simplicity, we insure that the source/destination buffers are
always `Uint8Array` views that point to exactly the region that is meant to be
read/written.

The old mechanisms are faster than before and can correctly support keyboard
interrupts. Other than that I think the original behavior is unchanged. I added a
lot more test coverage to ensure backwards compatibility since there was pretty
anemic coverage before.

I think the read/write APIs are mostly pretty simple to use, with the exception
that someone might forget to return the number of bytes read. JavaScript's ordinary
behavior coerces the `undefined` to a 0, which leads to an infinite loop where the
filesystem repeatedly asks to read/write the same data since it sees no progress.
I added a check that writes an error message to the console and sets EIO when undefined
is returned so the infinite loop is prevented and the problem is explained.
2023-08-21 08:41:44 +02:00
Hood Chatham 5db49494dd
Emscripten 3.1.43 (#4056) 2023-08-17 15:30:32 +02:00
Ian Thomas 1c765db28f
Correct conda activate commands in building from sources docs [skip ci] (#4065) 2023-08-14 20:49:44 +09:00
Hood Chatham f42c61d672
Emscripten 3.1.42 (#4055) 2023-08-09 17:37:57 +02:00
Hood Chatham 691bee148f
ENH Add raise_for_status to FetchResponse (#4053) 2023-08-09 22:11:34 +09:00
Hood Chatham f8f026a5de
Emscripten 3.1.40 (#3888) 2023-08-08 21:16:43 +02:00
Hood Chatham d12deae9f3
PERF Only render extra destroyed information when debug mode is on (#4027)
Rendering the destroyed error messages for PyProxies is pretty inefficient.
This adds a setting to turn on debug mode. When debug mode is off, a cheaper
destroyed message is used instead.
2023-08-07 12:59:08 +02:00
Hood Chatham 0b2461fc19
ENH Improve PyProxy handling of read only properties (#4033)
A descriptor is *writable* if either writable is true or it has a setter.
A descriptor is *deletable* if it is configurable. Also, the normal JS behavior
here is to return false, not to throw.
2023-08-07 12:57:45 +02:00
Hood Chatham 85a1e1fefd
DOCS Mark pyodide APIs as not static (#4038)
This removes several confusing `static` markers and fixes the xrefs for
the async functions defined in api.ts
2023-08-04 13:44:58 +02:00
Jeff Glass e07603560c
Bump typing-extensions 4.7.1 (#4026) 2023-07-29 19:34:05 +09:00
Martoxa b7f86248fa
Add function to check for WASM magic number (#4018)
This adds `check_wasm_magic_number` to`pyodide_build` which checks whether a file starts 
with the wasm magic number `b"\0asm"`.
2023-07-26 22:53:08 -07:00
Tomas R 0e3678cf58
Add examples for loadPyodide() (#4012)
Thanks #tomasr8!
2023-07-25 01:08:54 -07:00
Tomas R a5a434d86d
DOC Add examples for runPython() (#4011)
[skip ci]
2023-07-23 12:24:41 +02:00
Tomas R 5744a9e12f
Add support for the @example JSDoc directive (#4009)
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-07-23 09:54:28 +02:00
Eli Lamb 3caa249177
Added PyRepl to Related Projects (#4003) 2023-07-19 20:04:06 +09:00
Juniper Tyree 0980b51677
Implement PEP 658: .whl.metadata files (#3981) 2023-07-17 21:17:24 +09:00
Tamás Nepusz 6c37b95ac2
Add `igraph` package (#3991) 2023-07-14 18:48:31 +09:00
Loïc Estève 1810fd9fdc
Upgrade scipy to 1.11.1 (#3996)
Upgrades scipy to its latest release 1.11.1 (released 28 June 2023).

I ran the scipy test suite locally and I did not notice any problematic issues.
There are some additional test failures for some tests that were added between
scipy 1.10.1 and 1.11.1. Most are due to Pyodide limitations. There is also
`scipy.stats.tests.test_multivariate` `test_cdf_against_generic_integrators`
that seems to indicate that `scipy.integrate.tplquad` is not converging but that
seems to be the case in scipy 1.10.1 too.
2023-07-13 17:22:27 -07:00
Owen Lamont 822276d974
Removed raise if failed check from the json and string response returns (#3986)
The previous logic raised an OSError if a response returned a status code of 400
or greater but it is useful to be able to retrieve the bodies from such
responses as they often contain additional information about the error
2023-07-12 13:48:40 -07:00
Hood Chatham f996914a96
Update changelog for v0.23.4 (#3982) 2023-07-06 22:05:30 -07:00
Hood Chatham fcb467d5f7
ENH Add environment variable to control 'exports' cli argument (#3973) 2023-07-06 19:52:45 -07:00
Guillaume Lemaitre 148eec4005
MNT Update scikit-learn to 1.3.0 (#3976) 2023-07-04 16:32:52 -07:00
Tim Paine 72a1c0412f
FIX Version cap pydantic<2 (#3971) 2023-06-30 19:54:16 -07:00
कारतोफ्फेलस्क्रिप्ट™ f7562a3b0a
Allow customizing cache location for packages in Node (#3967)
This change allows users to customize where wheels are cached in Node.
This is important in the context of docker images and other cases where
the `node_modules` folder isn't writable.
2023-06-29 12:34:30 -07:00
Juniper Tyree 313bc4bb72
Add `netcdf4` package (#3910) 2023-06-26 21:20:53 +09:00
Loïc Estève 1c27915653
Build scikit-image 0.21 with meson (#3874) 2023-06-23 17:28:44 +02:00
Hood Chatham 5fe0d2e302
Change the name of repodata.json to pyodide-lock.json (#3824) 2023-06-18 22:57:43 -07:00
Tim Sherratt 3be5be51e7
Upgrade pyodide-http to 0.2.1 (#3937)
pyodide-http (0.2.1) includes a bug fix for Firefox
2023-06-18 17:43:47 -07:00
Hood Chatham 31946ecb3a
Make PyProxy of a callable an instanceof Function (#3925)
Resolves #3924. Some code checks whether an object is callable with `instanceof Function`.
The correct way to check for callability is with `typeof x === "function"`, but ideally we want
to work with existing code that uses a less accurate callability check.

Make a copy of the PyProxy class which is a subclass of Function.
Since the difference between `PyProxy` and `PyProxyFunction` is an implementation
detail, we use `[Symbol.hasInstance]` to make them recognize the same set of objects
as their instances.

we also need some extra logic to filter out additional attributes that come from the
`Function` prototype.
2023-06-17 18:09:34 -07:00
Hood Chatham 005535b492
Changelog for 0.23.3 (#3936) 2023-06-17 17:49:12 -07:00
Hood Chatham 9012711ba0
Run replace_so_abi_tags on out of tree builds (#3927) 2023-06-17 13:39:33 -07:00
Hood Chatham 54540364d4
Fix accessing Python reserved word attributes on js objects (#3926)
Removes some of the compatibility break introduced in #3617.
Update faq too.
2023-06-14 16:21:52 -07:00
Juniper Tyree e3789b8dfa
Add package `Cartopy` (#3909) 2023-06-14 13:15:41 +09:00
Hood Chatham 19437388ff
Fix `from jsmod import *` (#3903)
Prior to this commit:
```js
pyodide.registerJsModule("xx", {a: 2});
pyodide.runPython("from xx import *");
```
raises:
```
ImportError: from-import-* object has no __dict__ and no __all__
```
Afterwards, it behaves as expected (a variable called "a" is introduced into globals equal to 2).
2023-06-12 09:46:16 -07:00
Hood Chatham dcc504cd46
Add an argument to loadPyodide to pass environment variables (#3870)
This also updates the command line runner to pass in all ambient environment
variables except that `HOME` is set to the working directory.

`homedir` is now deprecated. I added handling for `homedir` and `env.HOME`: 
if both are passed, raise an error, otherwise they mean the same thing.
2023-06-11 22:46:53 -07:00
Michael Weinold d7873bf6ac
Adding Package `peewee` (#3897) 2023-06-11 08:22:14 -07:00
Hood Chatham 1c57c72110
Add sequence methods to JsProxy of arrays (#3904)
Prior to this PR, internal Python code paths that use `PySequence_*` methods 
directly would fail on JS Arrays. To fix this, we implement `sq_length`, `sq_item`
and (for mutable sequences) `sq_ass_item.` I also added implementations for
the rest of the sequence methods `sq_concat` and `sq_repeat`.  Strangely
`sq_inplace_concat` already existed.
2023-06-08 11:00:14 -07:00