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