micropip icon indicating copy to clipboard operation
micropip copied to clipboard

[Need newer pyodide] BUG: fetch_string_and_headers compat: raise in and out of pyodide

Open Carreau opened this issue 1 year ago • 1 comments

Currently only the not_in_pyodide will raise on non-success, because this is the default behavior of urllib, the in_pyodide will not, so I added a raise_for_status.

It is better to raise, as otherwise the package parser will potentially get proper URL and not manage to parse it, and decide there is no wheels, while we actually just got an error (404, or maybe 500).

In addition wraps both case in a custom local HttpStatusError, so that we can actually catch these errors in the right places when we encounter them.

I think we could define HttpStatusError on the ABC and not make it an ABC itself, but it small enough that I think duplication is ok.

Carreau avatar Aug 06 '24 12:08 Carreau

Moving to draft, I think HttpStatusError is not yet in latest released pyodide.

Carreau avatar Aug 12 '24 09:08 Carreau

Ok, I've added relevant fixes now that PyPI properly set CORS on 404s, and added conditional for wether we are on pyodide 0.26.x or 0.27+.

Carreau avatar Aug 21 '24 09:08 Carreau

SO now some of the fixture that return 500 now need to return 404... I'm not sure how to get the httpserver fixture to return 404 on wildcard url without expecting requests.

Carreau avatar Aug 21 '24 12:08 Carreau

ValueError: Function test_404_raise's first argument name 'httpserver' should start with 'selenium'

@run_in_pyodide should be the inner-most decorator.

ryanking13 avatar Aug 21 '24 12:08 ryanking13

Let's release Pyodide 0.27.0a1 and use it in the micropip CI so we don't need to put complex version checks. Hood released 0.27.0a1 yesterday but the deploy was failed because of the CI timeout (https://github.com/pyodide/pyodide/commit/5231ac0358cf3787c223d699bd36e8648de43792). Let me see if rerunning the job would work.

ryanking13 avatar Aug 21 '24 12:08 ryanking13

Let's release Pyodide 0.27.0a1 and use it in the micropip CI

I was also just concern micropip might be broken with current pyodide/warehouse, but a new version of pyodide would be great :-)

Carreau avatar Aug 21 '24 12:08 Carreau

Ok, I've tried multiple variation of the test to @run_in_pyodide, but can't figure out how to actually have one that works.

Carreau avatar Aug 21 '24 13:08 Carreau

I released 0.27.0a2 instead.

hoodmane avatar Aug 22 '24 13:08 hoodmane

I released 0.27.0a2 instead.

BTW should CI be updated

- pyodide-version: [0.24.1, 0.25.0]
+ pyodide-version: [0.24.1, 0.25.0, 0.26.0, 0.27.0a2]

?

Carreau avatar Aug 23 '24 11:08 Carreau

Any idea on how to actually change the timeout to something else the 10 minutes... I've tried various options with no success.

Carreau avatar Sep 16 '24 13:09 Carreau

Any idea on how to actually change the timeout to something else the 10 minutes... I've tried various options with no success.

I think this is a chrome (+selenium) issue.. for now I just pinned the version of the chrome to some older version to see if it pass. https://github.com/pyodide/micropip/pull/135

ryanking13 avatar Sep 17 '24 02:09 ryanking13

I think this is a chrome (+selenium) issue.. for now I just pinned the version of the chrome to some older version to see if it pass. #135

More generally when I write a test with an error the timeout is also 10 min, and I could not find how to make it timeout in less... but thanks for #135

Carreau avatar Sep 17 '24 06:09 Carreau

ok, I pushed a commit that remove compat with old versions.

Carreau avatar Oct 01 '24 13:10 Carreau