From 93363b50e6aa4ca28c83fc1eb5e1ec72eff5c372 Mon Sep 17 00:00:00 2001 From: Twisha Bansal Date: Thu, 22 Oct 2026 20:16:49 +0530 Subject: [PATCH 1/2] chore(deps): allow numpy 2 on Python 3.12+ and disable numpy updates for older Pythons --- .github/renovate.json5 | 8 ++++++++ packages/toolbox-adk/pyproject.toml | 5 +++-- packages/toolbox-core/pyproject.toml | 5 +++-- packages/toolbox-langchain/pyproject.toml | 5 +++-- packages/toolbox-llamaindex/pyproject.toml | 5 +++-- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index ace077435..f678f258f 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -63,6 +63,14 @@ '.kokoro/**', ], }, + { + description: 'Disable numpy updates for Python < 3.12 (numpy 2.x stubs break mypy there)', + matchPackageNames: [ + 'numpy', + ], + matchCurrentValue: '/^<2$/', + enabled: false, + }, ], customManagers: [ { diff --git a/packages/toolbox-adk/pyproject.toml b/packages/toolbox-adk/pyproject.toml index a89e8f13f..710d41c7b 100644 --- a/packages/toolbox-adk/pyproject.toml +++ b/packages/toolbox-adk/pyproject.toml @@ -41,7 +41,9 @@ test = [ "pytest-asyncio==1.4.0", "pytest-cov==7.1.0", "pytest-mock==3.15.1", - "numpy<2", # Pinned to <2 to prevent mypy syntax errors on python 3.10 with numpy 2.x stubs, + # numpy 2.x stubs use the Python 3.12 `type` statement; mypy rejects them on older Pythons. + "numpy<2; python_version < '3.12'", + "numpy<3; python_version >= '3.12'", ] # Tells setuptools that packages are under the 'src' directory @@ -62,6 +64,5 @@ target-version = ['py310'] profile = "black" [tool.mypy] -python_version = "3.10" warn_unused_configs = true disallow_incomplete_defs = true diff --git a/packages/toolbox-core/pyproject.toml b/packages/toolbox-core/pyproject.toml index 6e44e0a11..797d7232e 100644 --- a/packages/toolbox-core/pyproject.toml +++ b/packages/toolbox-core/pyproject.toml @@ -61,7 +61,9 @@ test = [ "google-cloud-storage==3.10.1", "aioresponses==0.7.8", "toolbox-core[telemetry]", - "numpy<2", # Pinned to <2 to prevent mypy syntax errors on python 3.10 with numpy 2.x stubs + # numpy 2.x stubs use the Python 3.12 `type` statement; mypy rejects them on older Pythons. + "numpy<2; python_version < '3.12'", + "numpy<3; python_version >= '3.12'", ] [build-system] requires = ["setuptools"] @@ -74,6 +76,5 @@ target-version = ['py310'] profile = "black" [tool.mypy] -python_version = "3.10" warn_unused_configs = true disallow_incomplete_defs = true diff --git a/packages/toolbox-langchain/pyproject.toml b/packages/toolbox-langchain/pyproject.toml index 08b8df121..b8fa27930 100644 --- a/packages/toolbox-langchain/pyproject.toml +++ b/packages/toolbox-langchain/pyproject.toml @@ -53,7 +53,9 @@ test = [ "Pillow==12.3.0; python_version >= '3.10'", "google-cloud-secret-manager==2.28.0", "google-cloud-storage==3.10.1", - "numpy<2", # Pinned to <2 to prevent mypy syntax errors on python 3.10 with numpy 2.x stubs + # numpy 2.x stubs use the Python 3.12 `type` statement; mypy rejects them on older Pythons. + "numpy<2; python_version < '3.12'", + "numpy<3; python_version >= '3.12'", ] [build-system] @@ -67,6 +69,5 @@ target-version = ['py310'] profile = "black" [tool.mypy] -python_version = "3.10" warn_unused_configs = true disallow_incomplete_defs = true diff --git a/packages/toolbox-llamaindex/pyproject.toml b/packages/toolbox-llamaindex/pyproject.toml index c7df34736..f354286bc 100644 --- a/packages/toolbox-llamaindex/pyproject.toml +++ b/packages/toolbox-llamaindex/pyproject.toml @@ -53,7 +53,9 @@ test = [ "Pillow==12.3.0; python_version >= '3.10'", "google-cloud-secret-manager==2.28.0", "google-cloud-storage==3.10.1", - "numpy<2", # Pinned to <2 to prevent mypy syntax errors on python 3.10 with numpy 2.x stubs + # numpy 2.x stubs use the Python 3.12 `type` statement; mypy rejects them on older Pythons. + "numpy<2; python_version < '3.12'", + "numpy<3; python_version >= '3.12'", ] [build-system] @@ -67,6 +69,5 @@ target-version = ['py310'] profile = "black" [tool.mypy] -python_version = "3.10" warn_unused_configs = true disallow_incomplete_defs = true From aaa533f6d3ef433862baac3bec1e9b68336d4b33 Mon Sep 17 00:00:00 2001 From: Twisha Bansal Date: Thu, 22 Oct 2026 20:54:13 +0530 Subject: [PATCH 2/2] chore: keep mypy python_version 3.10 and skip numpy stubs instead --- packages/toolbox-adk/pyproject.toml | 8 ++++++++ packages/toolbox-core/pyproject.toml | 8 ++++++++ packages/toolbox-langchain/pyproject.toml | 8 ++++++++ packages/toolbox-llamaindex/pyproject.toml | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/packages/toolbox-adk/pyproject.toml b/packages/toolbox-adk/pyproject.toml index 710d41c7b..3d4e2ec2c 100644 --- a/packages/toolbox-adk/pyproject.toml +++ b/packages/toolbox-adk/pyproject.toml @@ -64,5 +64,13 @@ target-version = ['py310'] profile = "black" [tool.mypy] +python_version = "3.10" warn_unused_configs = true disallow_incomplete_defs = true + +[[tool.mypy.overrides]] +# numpy 2.x stubs use the Python 3.12 `type` statement, which mypy rejects +# under python_version = "3.10". Skip analyzing numpy instead of pinning it. +module = ["numpy", "numpy.*"] +follow_imports = "skip" +follow_imports_for_stubs = true diff --git a/packages/toolbox-core/pyproject.toml b/packages/toolbox-core/pyproject.toml index 797d7232e..145070841 100644 --- a/packages/toolbox-core/pyproject.toml +++ b/packages/toolbox-core/pyproject.toml @@ -76,5 +76,13 @@ target-version = ['py310'] profile = "black" [tool.mypy] +python_version = "3.10" warn_unused_configs = true disallow_incomplete_defs = true + +[[tool.mypy.overrides]] +# numpy 2.x stubs use the Python 3.12 `type` statement, which mypy rejects +# under python_version = "3.10". Skip analyzing numpy instead of pinning it. +module = ["numpy", "numpy.*"] +follow_imports = "skip" +follow_imports_for_stubs = true diff --git a/packages/toolbox-langchain/pyproject.toml b/packages/toolbox-langchain/pyproject.toml index b8fa27930..e5b374425 100644 --- a/packages/toolbox-langchain/pyproject.toml +++ b/packages/toolbox-langchain/pyproject.toml @@ -69,5 +69,13 @@ target-version = ['py310'] profile = "black" [tool.mypy] +python_version = "3.10" warn_unused_configs = true disallow_incomplete_defs = true + +[[tool.mypy.overrides]] +# numpy 2.x stubs use the Python 3.12 `type` statement, which mypy rejects +# under python_version = "3.10". Skip analyzing numpy instead of pinning it. +module = ["numpy", "numpy.*"] +follow_imports = "skip" +follow_imports_for_stubs = true diff --git a/packages/toolbox-llamaindex/pyproject.toml b/packages/toolbox-llamaindex/pyproject.toml index f354286bc..1633248ae 100644 --- a/packages/toolbox-llamaindex/pyproject.toml +++ b/packages/toolbox-llamaindex/pyproject.toml @@ -69,5 +69,13 @@ target-version = ['py310'] profile = "black" [tool.mypy] +python_version = "3.10" warn_unused_configs = true disallow_incomplete_defs = true + +[[tool.mypy.overrides]] +# numpy 2.x stubs use the Python 3.12 `type` statement, which mypy rejects +# under python_version = "3.10". Skip analyzing numpy instead of pinning it. +module = ["numpy", "numpy.*"] +follow_imports = "skip" +follow_imports_for_stubs = true