diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e9bb2dea2..625e640f5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,7 +50,7 @@ repos: - id: codespell - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v1.10.0" + rev: "v1.11.0" hooks: - id: mypy files: ^(packages/.*/src|src|pyodide-build/pyodide_build) @@ -75,7 +75,7 @@ repos: - id: mypy name: mypy-tests args: [--ignore-missing-imports] - files: ^(packages/|docs|/conftest.py|src/tests|pyodide-build/pyodide_build/tests) + files: ^(packages/|docs|/conftest.py|src/tests) exclude: (^packages/.*/setup.py|/src|^packages/aiohttp/aiohttp_patch.py$) additional_dependencies: *mypy-deps diff --git a/environment.yml b/environment.yml index 9a6fb4848..816c014fb 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,7 @@ channels: - conda-forge dependencies: - python=3.12 - - nodejs>=18 + - nodejs>=18,<22.5 # Node.js 22.5 has some issues with installing packages https://github.com/nodejs/node/issues/53902 - ccache - f2c - swig diff --git a/requirements.txt b/requirements.txt index 83145f435..caa6a774a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ pre-commit build~=1.2.0 sphinx-click hypothesis -mypy>=1.10,<2 +mypy==1.11.0 # (FIXME: 2024/01/28) The latest pytest-asyncio 0.23.3 is not compatible with pytest 8.0.0 pytest<8.0.0 pytest-asyncio diff --git a/src/py/pyodide/webloop.py b/src/py/pyodide/webloop.py index e0fc65561..faf4053f7 100644 --- a/src/py/pyodide/webloop.py +++ b/src/py/pyodide/webloop.py @@ -135,7 +135,7 @@ class PyodideFuture(Future[T]): """Equivalent to ``then(None, onrejected)``""" return self.then(None, onrejected) - def finally_(self, onfinally: Callable[[], None]) -> "PyodideFuture[T]": + def finally_(self, onfinally: Callable[[], Any]) -> "PyodideFuture[T]": """When the future is either resolved or rejected, call ``onfinally`` with no arguments. """ @@ -269,10 +269,10 @@ class WebLoop(asyncio.AbstractEventLoop): # Scheduling methods: use browser.setTimeout to schedule tasks on the browser event loop. # - def call_soon( + def call_soon( # type: ignore[override] self, callback: Callable[..., Any], - *args: Any, # type: ignore[override] + *args: Any, context: contextvars.Context | None = None, ) -> asyncio.Handle: """Arrange for a callback to be called as soon as possible. @@ -285,10 +285,10 @@ class WebLoop(asyncio.AbstractEventLoop): delay = 0 return self.call_later(delay, callback, *args, context=context) - def call_soon_threadsafe( + def call_soon_threadsafe( # type: ignore[override] self, callback: Callable[..., Any], - *args: Any, # type: ignore[override] + *args: Any, context: contextvars.Context | None = None, ) -> asyncio.Handle: """Like ``call_soon()``, but thread-safe. @@ -369,7 +369,7 @@ class WebLoop(asyncio.AbstractEventLoop): delay = when - cur_time return self.call_later(delay, callback, *args, context=context) - def run_in_executor(self, executor, func, *args): + def run_in_executor(self, executor, func, *args): # type: ignore[override] """Arrange for func to be called in the specified executor. This is normally supposed to run func(*args) in a separate process or @@ -407,7 +407,7 @@ class WebLoop(asyncio.AbstractEventLoop): """ return time.monotonic() - def create_task(self, coro, *, name=None): + def create_task(self, coro, *, name=None): # type: ignore[override] """Schedule a coroutine object. Return a task object.