Commit Graph

2217 Commits

Author SHA1 Message Date
Hood Chatham c6f6166ef2
micropip Fix async race condition (#2569)
It's possible that while we were awaiting on `_get_pypi_json`, some other branch
of the resolver already installed a different version of the same wheel. We need
to check a second time for whether the constraint is satisfied between when we
get the `pypi` metadata and when we put the information into `transaction.locked`
or else we might accidentally install the same wheel twice.
2022-05-17 12:34:37 -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
Roman Yurchak e2b22a84c3
Add FAQ when micropip fails to find a pure python wheel (#2558)
Closes #2557:
Users keep reporting issues about micropip not finding a pure python wheel
e.g. latest in pyscript/pyscript#297 so it appears the the current message is
not explicit enough.

We should explain in more detail,
* what is happening and why
* what the user can do about it and possibly point them to the issue tracker.
2022-05-17 11:07:36 -07:00
Hood Chatham 1ff5d32afd
MAINT micropip Move wheel-related methods into WheelInfo class (#2568)
More micropip maintenance.
* `_parse_wheel_url` ==> static method `WheelInfo.from_url`
* `_extract_wheel` ==> `WheelInfo.extract`
* `_validate_wheel` ==> `WheelInfo.validate`
* `_install_wheel` ==> `WheelInfo.install`
* Parts of `Transaction.add_wheel` were extracted into new methods
`WheelInfo.download` and `WheelInfo.requires`.
2022-05-16 19:58:53 -07:00
Hood Chatham 4c80429827
Fix ordering in micropip add_requirement (#2563)
Steps for `add_requirement`:

1. Convert `req` from a string to a Requirement if necessary
2. If `req.marker` is present, check whether `req.marker` matches `ctx`, if not we don't need it.
3. Check if `req` is already installed
4. Check if `req` is available from `packages.json`
5. Check if `req` is available from pypi

For some reason we had step 4 occurring before steps 2 and 3. This puts them in the correct order.
2022-05-16 19:12:30 -07:00
Hood Chatham 5353170373
MAINT Move testing compatibility stubs from _micropip into separate files (#2566)
This improves readability and gets the testing junk out of the top of `_micropip.py`.
2022-05-16 18:32:53 -07:00
Hood Chatham c4cc40673f
MAINT micropip: move most methods from `PackageManager` to `Transaction` and remove `PackageManager` (#2565)
This is more reorganization of `micropip` to try to make the logic easier to follow.
I turned `INSTALLED_PACKAGES` into a global variable. I turned `_install` into
a top level function definition and merged it with `install` rather than a class method.
The other methods of `PackageManager` turned into `Transaction` methods. I also 
removed `PackageManager` entirely.
2022-05-16 18:10:14 -07:00
Hood Chatham 71629d8667 Fix merge I messed up 2022-05-16 14:05:00 -07:00
Gyeongjae Choi ec80351b7b
Improve micropip error message when no package is found (#2562)
Show better error message when fetching metadata from PyPI fails.
Previously it just showed "Failed to Fetch"
2022-05-16 14:03:32 -07:00
Hood Chatham a99f9ef172
MAINT Consolidate `ctx` and `fetch_extra_kwargs` into `Transaction` (#2564)
This is more cleanup in micropip. I moved `ctx` and `fetch_extra_kwargs` into `Transaction`
properties so that we don't have to pass them through everywhere as separate arguments.
I also switch to creating the `Transaction` in `install` so that we don't have to pass the arguments 
down into `gather_requirements` separately.
2022-05-16 14:01:30 -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
Hood Chatham dc29ae6541
Better typechecking for micropip (#2561) 2022-05-16 13:50:57 +09:00
Hood Chatham 663459e26b
Canonicalize requirement names in micropip (#2560) 2022-05-14 20:39:54 -06:00
Roman Yurchak 3b74dcbfcf
DOC update FAQ instruction for detecting Emscripten runtime (#2552) 2022-05-13 15:39:50 +09:00
Lester Fan 0fbbeb319e
Add browser API wrappers (#2456)
Adds Python wrappers for setTimeout, clearTimeout, setInterval, clearInterval, 
addEventListener and removeEventListener as described in #2430.
2022-05-12 20:10:10 -07:00
Ryan May 91fd7dbe89
Fix building CPython on macos (Fixes #2360) (#2554)
Updates the Makefile to avoid separating the source command from the build.
2022-05-12 15:50:01 -07:00
Hood Chatham 89da31caa2
Fix garbage collection of once_callable (#2401)
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com
2022-05-11 22:09:45 -06:00
Gyeongjae Choi 8cfd9911af
ENH Add `pre` option in micropip.install (#2542) 2022-05-11 21:35:06 -06:00
Hood Chatham e732cb9dd7
meta.yaml keys for cross-build environment (#2536)
This moves unisolation into a package key. `cross-build-env: true` means the package
is part of the cross build environment and should be unisolated. `cross-build-files`
gives a list of files that should be copied from the built copy of the package into the host
copy of the package.

This will allow us to construct a cross build environment automatically as part of building
packages. If we have these files and the Python include directory, this is sufficient for 
cross-building binary packages.
2022-05-11 20:31:16 -07:00
jmdyck 5dcdf95e0f
index.rst: fix typo (#2543)
help ==> helps
2022-05-11 06:59:19 -07:00
Hood Chatham 93a714e3fd
Fix python2js cache mechanism when used with dict_converter (#2533) 2022-05-10 21:16:42 -07:00
Wei Ji 8ee129a8f6
Add xarray (#2538) 2022-05-10 21:16:21 -07:00
Ben Jeffery ce14e6306e
PKG Add tskit 0.4.1 and deps (#2506) 2022-05-11 11:36:33 +09:00
Gyeongjae Choi 3ed6d29e89
FIX Fix micropip version comparison with prerelease version (#2532) 2022-05-10 09:19:39 -06:00
Vic Kumar cee9206573
Fix 1st argument of unpackArchive to allow for ArrayBuffer (#2451) 2022-05-09 13:04:25 -07:00
pre-commit-ci[bot] fac0e3bc98
[pre-commit.ci] pre-commit autoupdate (#2534)
updates:
- [github.com/asottile/pyupgrade: v2.32.0 → v2.32.1](https://github.com/asottile/pyupgrade/compare/v2.32.0...v2.32.1)
- [github.com/pre-commit/mirrors-clang-format: v14.0.1 → v14.0.3](https://github.com/pre-commit/mirrors-clang-format/compare/v14.0.1...v14.0.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-05-09 13:04:32 -06:00
Gyeongjae Choi 6b01b20a12
ENH Add `deps` option in `micropip.install()` (#2433)
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
2022-05-09 13:42:19 +09:00
Hood Chatham ecaab15c12
Pytest rewrites for run_in_pyodide (#2510) 2022-05-08 18:43:26 -07:00
Hood Chatham 599ae467c5
MAINT Add forgotten error check to js_proxy_init (#2527) 2022-05-08 18:08:29 -07:00
Hood Chatham 919bd556d3 Revert "Try to fix contest"
This reverts commit a4fe91df04.
2022-05-08 08:51:35 -07:00
Hood Chatham a4fe91df04 Try to fix contest 2022-05-08 08:48:09 -07:00
Gyeongjae Choi c63e444e29
Escape double bracket in REPL (#2517) 2022-05-08 18:50:17 +09:00
Gyeongjae Choi b20b43bd66
MAINT Split conftest.py into modules (#2418) 2022-05-08 16:52:08 +09:00
stonebig be59fae4f4
upgrade to SQLIte-3.38.5 (#2518) 2022-05-08 09:56:59 +09:00
Hood Chatham 379388c20c
ENH Add js_id attribute to JsProxy for use as a dictionary key (#2515)
It's useful to be able to hash on object identity. For instance in Python
if we want to store objects in a dictionary using object identity to
store/access obj we use `id(obj)` as the index. This adds `js_id` as an
attribute to `JsProxy` so that `jsobj.js_id` can be used as a dictionary key
to key on identity of the JavaScript object.
2022-05-07 12:02:01 -07:00
dragoncoder047 9341edcf9a
Improve REPL input behavior (#2509) 2022-05-06 21:19:00 -06:00
Hood Chatham cefaa2f04c
Add run_js to pyodide Python package (#2426)
Add a `run_js` API that evals JavaScript code and returns the result as a `JsProxy`.
2022-05-06 15:27:29 -06:00
Filipe 860c461f45
PKG add cftime (#2504)
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
2022-05-05 16:11:10 -06:00
Filipe 828d3352e5
PKG Add Gsw (#2511) 2022-05-05 15:25:11 -06:00
Hood Chatham c963d0b54c
Fix large integer conversions (#2484) 2022-05-05 12:14:20 -06:00
Hood Chatham a473c14ea0
Fix Cython handling in pypa/build (#2507) 2022-05-05 10:46:05 -06:00
Andrey Smelter 25133aff26
Add bump2version [skip ci] (#2460)
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
2022-05-05 10:45:09 -06:00
Hood Chatham 6e3de5734f
Fix test_pyodide_analyzer (#2501)
This fixes a mistake I committed in #2496.
2022-05-05 08:13:02 -06:00
Will Lachance ca60ebc51e
Use emscripten's -Oz option for pandas (#2457) 2022-05-05 08:09:11 -06:00
pre-commit-ci[bot] 6fc28c5669
[pre-commit.ci] pre-commit autoupdate + typing fixes for new mypy (#2450)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2022-05-05 07:41:00 -06:00
Ricardo Prins d74bc74c9d
Fix ReferenceError in docs example at pyodide.pyimport (#2499) 2022-05-04 21:53:08 -06:00
Hood Chatham 3334580867
Remove private names from js api docs (#2496)
Some private names ended up in the docs for some reason. This removes them.
2022-05-04 21:52:17 -06:00
Henry Schreiner 1093b86e5b
refactor: use cmake 3.22 from pip (#2489)
* refactor: use cmake 3.22 from pip

* Fix dockerfile

* Update image tags

* Fix image

* Switch to pyodide docker image

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2022-05-04 14:22:50 -06:00
echorand (Amit Saha) 213288f200
ENH Update sqlite (#2477) 2022-05-04 14:18:07 -06:00
Will Lachance 505cf714c1
Add some basic benchmarks for pandas (#2474) 2022-05-04 14:17:16 -06:00