From 17650ad049c25b4a883c2952cc634354fb754956 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Thu, 30 Jan 2025 01:53:39 +0000 Subject: [PATCH 1/8] Fix regression when deps=False is set --- micropip/transaction.py | 2 ++ tests/integration/test_integration.py | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/micropip/transaction.py b/micropip/transaction.py index f830f051..b3a82ad7 100644 --- a/micropip/transaction.py +++ b/micropip/transaction.py @@ -268,6 +268,8 @@ async def add_wheel( else: await wheel_download_task await self.gather_requirements(wheel.requires(extras)) + else: + await wheel_download_task self.wheels.append(wheel) diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index df5234b8..9ada6d40 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -33,6 +33,28 @@ async def _run(selenium): _run(selenium_standalone_micropip) +@integration_test_only +def test_integration_install_no_deps(selenium_standalone_micropip, pytestconfig): + @run_in_pyodide + async def _run(selenium): + import micropip + + await micropip.install("pytest-asyncio", deps=False) + + import pytest_asyncio + + try: + # pytest-asyncio depends on pytest + import pytest + except ImportError: + pass + else: + raise Exception("Should raise!") + + _run(selenium_standalone_micropip) + + + @integration_test_only def test_integration_list_basic(selenium_standalone_micropip, pytestconfig): @run_in_pyodide From 8d684e3b8690803cf843d8bd78c7a5f76abcd14d Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Thu, 30 Jan 2025 01:55:26 +0000 Subject: [PATCH 2/8] lint [integration] --- tests/integration/test_integration.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index 9ada6d40..3e59ae01 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -41,11 +41,11 @@ async def _run(selenium): await micropip.install("pytest-asyncio", deps=False) - import pytest_asyncio + import pytest_asyncio # noqa: F401 try: # pytest-asyncio depends on pytest - import pytest + import pytest # noqa: F401 except ImportError: pass else: @@ -54,7 +54,6 @@ async def _run(selenium): _run(selenium_standalone_micropip) - @integration_test_only def test_integration_list_basic(selenium_standalone_micropip, pytestconfig): @run_in_pyodide From 0ce65598d3c4970742e8d8a3086c9802f60cb886 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Thu, 30 Jan 2025 02:02:51 +0000 Subject: [PATCH 3/8] [integration] --- tests/integration/test_integration.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index 3e59ae01..9285b6f6 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -39,7 +39,8 @@ def test_integration_install_no_deps(selenium_standalone_micropip, pytestconfig) async def _run(selenium): import micropip - await micropip.install("pytest-asyncio", deps=False) + # a version that is not in Pyodide distribution + await micropip.install("pytest-asyncio==0.24.0a1", deps=False) import pytest_asyncio # noqa: F401 From 61f9399affe7332e7830359769462e0b1d8de84f Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Thu, 30 Jan 2025 02:03:47 +0000 Subject: [PATCH 4/8] fix error type [integration] --- tests/integration/test_integration.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index 9285b6f6..c397bb8e 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -39,15 +39,14 @@ def test_integration_install_no_deps(selenium_standalone_micropip, pytestconfig) async def _run(selenium): import micropip - # a version that is not in Pyodide distribution - await micropip.install("pytest-asyncio==0.24.0a1", deps=False) + await micropip.install("pytest-asyncio", deps=False) import pytest_asyncio # noqa: F401 try: # pytest-asyncio depends on pytest import pytest # noqa: F401 - except ImportError: + except ModuleNotFoundError: pass else: raise Exception("Should raise!") From 7f24e9a0b3a4e8b7dcf4148d6953af3e98af545b Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Thu, 30 Jan 2025 02:08:16 +0000 Subject: [PATCH 5/8] changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13d710c8..f52607c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 (the ones that starts with `../` or `./`) [#174](https://github.com/pyodide/micropip/pull/174) +- Fixed an error when calling `micropip.install` with `deps=False` is set. + [#187](https://github.com/pyodide/micropip/pull/187) + ### Added - `micropip` now vendors `pypa/packaging` for better reliability. From 45aff56648ee837fa345003951db5a34e2895e11 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Thu, 30 Jan 2025 02:11:19 +0000 Subject: [PATCH 6/8] versino [integration] --- tests/integration/test_integration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index c397bb8e..530a5e6e 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -39,7 +39,7 @@ def test_integration_install_no_deps(selenium_standalone_micropip, pytestconfig) async def _run(selenium): import micropip - await micropip.install("pytest-asyncio", deps=False) + await micropip.install("pytest-asyncio==0.24.0a1", deps=False) import pytest_asyncio # noqa: F401 From de2407077d50dbb947662dadc49445fe3d2004c6 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Thu, 30 Jan 2025 02:24:20 +0000 Subject: [PATCH 7/8] Use other package --- tests/integration/test_integration.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index 530a5e6e..d50a8af8 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -39,13 +39,11 @@ def test_integration_install_no_deps(selenium_standalone_micropip, pytestconfig) async def _run(selenium): import micropip - await micropip.install("pytest-asyncio==0.24.0a1", deps=False) - - import pytest_asyncio # noqa: F401 + await micropip.install("pyodide-micropip-test", deps=False) try: - # pytest-asyncio depends on pytest - import pytest # noqa: F401 + # pyodide-micropip-test depends on snowballstemmer + import snowballstemmer # noqa: F401 except ModuleNotFoundError: pass else: From e6b1856fef6739d6bb70299a1277dd8be96eb7b5 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Thu, 30 Jan 2025 02:35:27 +0000 Subject: [PATCH 8/8] [integration]