Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrades packaging version to v23.0 and micropip to 0.2.2 #3605

Merged
merged 6 commits into from Mar 4, 2023

Conversation

arpitnath
Copy link
Contributor

@arpitnath arpitnath commented Feb 23, 2023

Description

@arpitnath arpitnath marked this pull request as ready for review February 23, 2023 12:52
@arpitnath arpitnath changed the title Patch/packging upgrade 23.0 Upgrades packaging version to v23.0 and micropip to 0.2.1 Feb 23, 2023
@rth
Copy link
Member

rth commented Feb 23, 2023

Thanks!

Looks like there is a genuine test failure we need to address,

___________________ test_install_different_version2[chrome] ____________________
packages/micropip/test_micropip.py:130: in test_install_different_version2
    selenium.run_js(
/usr/share/miniconda/envs/pyodide-env/lib/python3.11/site-packages/pytest_pyodide/runner.py:249: in run_js
    return self.run_js_inner(code, check_code)
/usr/share/miniconda/envs/pyodide-env/lib/python3.11/site-packages/pytest_pyodide/runner.py:404: in run_js_inner
    raise JavascriptException(retval[1], retval[2])
E   pytest_pyodide.runner.JavascriptException: PythonError: Traceback (most recent call last):
E     File "/lib/python3.11/_pyodide/_base.py", line 532, in eval_code_async
E       await CodeRunner(
E     File "/lib/python3.11/_pyodide/_base.py", line 357, in run_async
E       await coroutine
E     File "<exec>", line 3, in <module>
E     File "/lib/python3.11/site-packages/micropip/_micropip.py", line 566, in install
E       await transaction.gather_requirements(requirements)
E     File "/lib/python3.11/site-packages/micropip/_micropip.py", line 332, in gather_requirements
E       await gather(*requirement_promises)
E     File "/lib/python3.11/site-packages/micropip/_micropip.py", line 339, in add_requirement
E       return await self.add_requirement_inner(Requirement(req))
E              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E     File "/lib/python3.11/site-packages/micropip/_micropip.py", line 434, in add_requirement_inner
E       wheel = find_wheel(metadata, req)
E               ^^^^^^^^^^^^^^^^^^^^^^^^^
E     File "/lib/python3.11/site-packages/micropip/_micropip.py", line 272, in find_wheel
E       candidate_versions = sorted(
E                            ^^^^^^^
E     File "/lib/python3.11/site-packages/micropip/_micropip.py", line 273, in <genexpr>
E       (Version(v) for v in req.specifier.filter(releases)),
E       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E     File "/lib/python3.11/site-packages/packaging/specifiers.py", line 616, in filter
E       parsed_version = _coerce_version(version)
E                        ^^^^^^^^^^^^^^^^^^^^^^^^
E     File "/lib/python3.11/site-packages/packaging/specifiers.py", line 36, in _coerce_version
E       version = Version(version)
E                 ^^^^^^^^^^^^^^^^
E     File "/lib/python3.11/site-packages/packaging/version.py", line 197, in __init__
E       raise InvalidVersion(f"Invalid version: '{version}'")
E   packaging.version.InvalidVersion: Invalid version: '2004d'

Not really sure where that 2004d version is coming from. The packages/micropip/test_micropip.py::test_install_different_version2 looks ok and we have exactly the same test in micropip which passes. But indeed that situation of having the same tests copied twice is not ideal, maybe something else got out of sync in that test file which would explain it.

@ryanking13
Copy link
Member

ryanking13 commented Feb 24, 2023

The error happens when we loop through all versions listed in PyPI. There is a version pytz==2004d which was released in 2004 (before PEP440 was introduced). packaging handled this by a LegacyVersion class, but they dropped it recently.

I guess we should ignore invalid versions?

we have exactly the same test in micropip which passes.

Tests in pyodide/micropip downloads pyodide distribution 0.22.1 or 0.23.0a1 during the test so it will use packaging 21.3.

@rth
Copy link
Member

rth commented Mar 4, 2023

Indeed, thanks for looking into it @ryanking13 ! A fix is in pyodide/micropip#54, once that is merged and micropip released we can use that version here.

@rth rth changed the title Upgrades packaging version to v23.0 and micropip to 0.2.1 Upgrades packaging version to v23.0 and micropip to 0.2.2 Mar 4, 2023
@rth
Copy link
Member

rth commented Mar 4, 2023

Thanks @arpitnath !

@rth rth merged commit 42fa993 into pyodide:main Mar 4, 2023
@arpitnath
Copy link
Contributor Author

Hi @rth, at what point in time can we anticipate the acceptance of a new release featuring the updated packaging?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants