-
Notifications
You must be signed in to change notification settings - Fork 428
Expand file tree
/
Copy pathtest_minimal_install.py
More file actions
executable file
·88 lines (72 loc) · 2.33 KB
/
test_minimal_install.py
File metadata and controls
executable file
·88 lines (72 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env python3
"""Smoke test for minimal (base-only) installation of a2a-sdk.
This script verifies that all core public API modules can be imported
when only the base dependencies are installed (no optional extras).
It is designed to run WITHOUT pytest or any dev dependencies -- just
a clean venv with `pip install a2a-sdk`.
Usage:
python scripts/test_minimal_install.py
Exit codes:
0 - All core imports succeeded
1 - One or more core imports failed
"""
from __future__ import annotations
import importlib
import sys
# Core modules that MUST be importable with only base dependencies.
# These are the public API surface that every user gets with
# `pip install a2a-sdk` (no extras).
#
# Do NOT add modules here that require optional extras (grpc,
# http-server, sql, signing, telemetry, vertex, etc.).
# Those modules are expected to fail without their extras installed
# and should use try/except ImportError guards internally.
CORE_MODULES = [
'a2a',
'a2a.client',
'a2a.client.auth',
'a2a.client.base_client',
'a2a.client.card_resolver',
'a2a.client.client',
'a2a.client.client_factory',
'a2a.client.errors',
'a2a.client.interceptors',
'a2a.client.optionals',
'a2a.client.transports',
'a2a.server',
'a2a.server.agent_execution',
'a2a.server.context',
'a2a.server.events',
'a2a.server.request_handlers',
'a2a.server.tasks',
'a2a.types',
'a2a.utils',
'a2a.utils.constants',
'a2a.utils.error_handlers',
'a2a.utils.version_validator',
'a2a.utils.proto_utils',
'a2a.utils.task',
'a2a.helpers.agent_card',
'a2a.helpers.proto_helpers',
]
def main() -> int:
failures: list[str] = []
successes: list[str] = []
for module_name in CORE_MODULES:
try:
importlib.import_module(module_name)
successes.append(module_name)
except Exception as e: # noqa: BLE001, PERF203
failures.append(f'{module_name}: {e}')
print(f'Tested {len(CORE_MODULES)} core modules')
print(f' Passed: {len(successes)}')
print(f' Failed: {len(failures)}')
if failures:
print('\nFAILED imports:')
for failure in failures:
print(f' - {failure}')
return 1
print('\nAll core modules imported successfully.')
return 0
if __name__ == '__main__':
sys.exit(main())