Skip to content

Commit cb48d01

Browse files
GWealeJacksunwei
authored andcommitted
fix: restore GitHub-only changes dropped during v2 bring-over
Re-aligns two files with GitHub main so the piper-to-github cutover does not silently revert them: the _ALLOWED_PICKLE_GLOBALS type annotation and a stray f-string prefix in skill_toolset. Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 928768999
1 parent 0337d19 commit cb48d01

9 files changed

Lines changed: 148 additions & 247 deletions

File tree

docs/design/cli/api_server/abort.md

Lines changed: 0 additions & 120 deletions
This file was deleted.

docs/guides/cli/api_server/abort.md

Lines changed: 0 additions & 108 deletions
This file was deleted.

src/google/adk/a2a/converters/part_converter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from collections.abc import Callable
2323
import json
2424
import logging
25-
from typing import Any
2625
from typing import List
2726
from typing import Optional
2827
from typing import Union

src/google/adk/dependencies/vertexai.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,9 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
"""Lazy import shim for Vertex AI optional dependencies."""
1514

1615
from __future__ import annotations
1716

18-
try:
19-
import vertexai
20-
from vertexai.preview import example_stores
21-
from vertexai.preview import rag
22-
except ImportError as e:
23-
raise ImportError(
24-
"Vertex AI features require google-adk[gcp] or google-adk[all]. "
25-
"Install one of those extras to use google.adk.dependencies.vertexai."
26-
) from e
27-
28-
__all__ = ["example_stores", "rag", "vertexai"]
17+
import vertexai
18+
from vertexai.preview import example_stores
19+
from vertexai.preview import rag

tests/unittests/cli/test_fast_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,6 @@ async def stream_query_impl(**kwargs):
957957
mock_adk_app_instance.stream_query = stream_query_impl
958958

959959
with (
960-
patch("google.auth.default", return_value=(MagicMock(), "test-project")),
961960
patch("vertexai.init", new_callable=MagicMock) as mock_vertexai_init,
962961
patch(
963962
"vertexai.agent_engines.AdkApp", return_value=mock_adk_app_instance

tests/unittests/plugins/BUILD

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
load("//third_party/py/pytest:pytest_defs.bzl", "pytest_test")
2+
3+
package(
4+
default_applicable_licenses = ["//third_party/py/google/adk:package_license"],
5+
default_visibility = ["//visibility:private"],
6+
)
7+
8+
pytest_test(
9+
name = "test_auto_tracing_plugin",
10+
srcs = ["test_auto_tracing_plugin.py"],
11+
deps = [
12+
"//third_party/py/google/adk",
13+
"//third_party/py/opentelemetry:opentelemetry_api",
14+
"//third_party/py/opentelemetry:opentelemetry_sdk",
15+
],
16+
)

tests/unittests/test_optional_dependencies.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ def test_vertex_ai_session_service_fails_on_creation():
169169

170170

171171
def test_vertexai_dependency_shim_raises_clear_importerror():
172-
"""Verify that the Vertex AI dependency shim points users to the gcp extra."""
173-
with mock.patch.dict("sys.modules", {"vertexai": None}):
174-
module_path = _REPO_ROOT / "src/google/adk/dependencies/vertexai.py"
172+
"""Verify that the Vertex AI dependency shim points users to the dependency."""
173+
with mock.patch.dict("sys.modules", {"google.cloud.aiplatform": None}):
174+
module_path = _REPO_ROOT / "dependencies_internal/vertexai.py"
175175
spec = importlib.util.spec_from_file_location(
176176
"_test_google_adk_dependencies_vertexai", module_path
177177
)
@@ -183,8 +183,7 @@ def test_vertexai_dependency_shim_raises_clear_importerror():
183183
spec.loader.exec_module(module)
184184

185185
message = str(exc_info.value)
186-
assert "google-adk[gcp]" in message
187-
assert "google-adk[all]" in message
186+
assert "//third_party/py/google/cloud/aiplatform" in message
188187

189188

190189
# =============================================================================

tests/unittests/tools/BUILD

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
load("//third_party/py/pytest:pytest_defs.bzl", "pytest_test")
2+
3+
package(
4+
default_applicable_licenses = ["//third_party/py/google/adk:package_license"],
5+
default_visibility = ["//visibility:private"],
6+
)
7+
8+
pytest_test(
9+
name = "test_local_environment",
10+
srcs = ["test_local_environment.py"],
11+
args = [
12+
"-p",
13+
"pytest_asyncio.plugin",
14+
],
15+
deps = [
16+
"//third_party/py/google/adk",
17+
"//third_party/py/pytest_asyncio",
18+
],
19+
)
20+
21+
pytest_test(
22+
name = "test_skill_toolset",
23+
srcs = ["test_skill_toolset.py"],
24+
args = [
25+
"-p",
26+
"pytest_asyncio.plugin",
27+
],
28+
deps = [
29+
"//third_party/py/google/adk",
30+
"//third_party/py/google/genai",
31+
"//third_party/py/pytest_asyncio",
32+
],
33+
)
34+
35+
pytest_test(
36+
name = "test_environment_toolset",
37+
srcs = ["test_environment_toolset.py"],
38+
args = [
39+
"-p",
40+
"pytest_asyncio.plugin",
41+
],
42+
deps = [
43+
"//third_party/py/google/adk",
44+
"//third_party/py/pytest_asyncio",
45+
],
46+
)
47+
48+
pytest_test(
49+
name = "test_function_tool_declarations",
50+
srcs = ["test_function_tool_declarations.py"],
51+
deps = [
52+
"//third_party/py/absl/testing:parameterized",
53+
"//third_party/py/google/adk",
54+
],
55+
)

0 commit comments

Comments
 (0)