Skip to content

Commit 7e159cd

Browse files
committed
Merge branch 'main' into make-fastapi-package-optional
2 parents c73492c + 7c46e70 commit 7e159cd

12 files changed

Lines changed: 1674 additions & 623 deletions

File tree

.github/actions/spelling/allow.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,22 @@ AServer
99
AServers
1010
AService
1111
AStarlette
12+
AUser
13+
DSNs
1214
EUR
1315
GBP
16+
GVsb
1417
INR
1518
JPY
1619
JSONRPCt
1720
Llm
21+
POSTGRES
1822
RUF
1923
aconnect
2024
adk
2125
agentic
2226
aio
27+
aiomysql
2328
aproject
2429
autouse
2530
backticks
@@ -29,21 +34,31 @@ coc
2934
codegen
3035
coro
3136
datamodel
37+
drivername
3238
dunders
3339
euo
40+
excinfo
41+
fetchrow
42+
fetchval
3443
genai
3544
getkwargs
3645
gle
46+
initdb
3747
inmemory
48+
isready
3849
kwarg
3950
langgraph
4051
lifecycles
4152
linting
4253
lstrips
4354
mockurl
55+
notif
4456
oauthoidc
4557
oidc
4658
opensource
59+
otherurl
60+
postgres
61+
postgresql
4762
protoc
4863
pyi
4964
pypistats

.github/actions/spelling/expect.txt

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

.github/workflows/unit-tests.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,18 @@ jobs:
99
test:
1010
name: Test with Python ${{ matrix.python-version }}
1111
runs-on: ubuntu-latest
12+
1213
if: github.repository == 'a2aproject/a2a-python'
14+
services:
15+
postgres:
16+
image: postgres:15-alpine
17+
env:
18+
POSTGRES_USER: postgres
19+
POSTGRES_PASSWORD: postgres
20+
POSTGRES_DB: a2a_test
21+
ports:
22+
- 5432:5432
23+
1324
strategy:
1425
matrix:
1526
python-version: ['3.10', '3.13']
@@ -20,13 +31,19 @@ jobs:
2031
uses: actions/setup-python@v5
2132
with:
2233
python-version: ${{ matrix.python-version }}
34+
- name: Set postgres for tests
35+
run: |
36+
sudo apt-get update && sudo apt-get install -y postgresql-client
37+
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d a2a_test -f ${{ github.workspace }}/docker/postgres/init.sql
38+
export POSTGRES_TEST_DSN="postgresql+asyncpg://postgres:postgres@localhost:5432/a2a_test"
39+
2340
- name: Install uv
2441
uses: astral-sh/setup-uv@v6
2542
- name: Add uv to PATH
2643
run: |
2744
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
2845
- name: Install dependencies
29-
run: uv sync --dev
46+
run: uv sync --dev --extra sql
3047
- name: Run tests and check coverage
3148
run: uv run pytest --cov=a2a --cov-report=xml --cov-fail-under=90
3249
- name: Show coverage summary in log

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ You can install the A2A SDK using either `uv` or `pip`.
2727

2828
### Using `uv`
2929

30+
When you're working within a uv project or a virtual environment managed by uv, the preferred way to add packages is using uv add.
31+
3032
```bash
3133
uv add a2a-sdk
3234
```
@@ -37,9 +39,25 @@ To include the optional HTTP server components (FastAPI, Starlette), install the
3739
uv add a2a-sdk[http-server]
3840
```
3941

42+
To install with database support:
43+
44+
```bash
45+
# PostgreSQL support
46+
uv add "a2a-sdk[postgresql]"
47+
48+
# MySQL support
49+
uv add "a2a-sdk[mysql]"
50+
51+
# SQLite support
52+
uv add "a2a-sdk[sqlite]"
53+
54+
# All database drivers
55+
uv add "a2a-sdk[sql]"
56+
```
57+
4058
### Using `pip`
4159

42-
You can install `a2a-sdk` using pip, the standard Python package installer.
60+
If you prefer to use pip, the standard Python package installer, you can install `a2a-sdk` as follows
4361

4462
```bash
4563
pip install a2a-sdk
@@ -51,6 +69,22 @@ To include the optional HTTP server components (FastAPI, Starlette), install the
5169
pip install a2a-sdk[http-server]
5270
```
5371

72+
To install with database support:
73+
74+
```bash
75+
# PostgreSQL support
76+
pip install "a2a-sdk[postgresql]"
77+
78+
# MySQL support
79+
pip install "a2a-sdk[mysql]"
80+
81+
# SQLite support
82+
pip install "a2a-sdk[sqlite]"
83+
84+
# All database drivers
85+
pip install "a2a-sdk[sql]"
86+
```
87+
5488
## Examples
5589

5690
### [Helloworld Example](https://github.com/a2aproject/a2a-samples/tree/main/samples/python/agents/helloworld)
@@ -70,7 +104,7 @@ pip install a2a-sdk[http-server]
70104
uv run test_client.py
71105
```
72106

73-
3. You can validate your agent using the agent inspector. Follow the instructions at the [a2a-inspector](https://github.com/a2aproject/a2a-inspector) repo.
107+
3. You can validate your agent using the agent inspector. Follow the instructions at the [a2a-inspector](https://github.com/a2aproject/a2a-inspector) repo.
74108

75109
You can also find more Python samples [here](https://github.com/a2aproject/a2a-samples/tree/main/samples/python) and JavaScript samples [here](https://github.com/a2aproject/a2a-samples/tree/main/samples/js).
76110

docker/postgres/init.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Create a dedicated user for the application
2+
CREATE USER a2a WITH PASSWORD 'a2a_password';
3+
4+
-- Create the tasks database
5+
CREATE DATABASE a2a_tasks;
6+
7+
GRANT ALL PRIVILEGES ON DATABASE a2a_test TO a2a;
8+

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name = "a2a-sdk"
33
dynamic = ["version"]
44
description = "A2A Python SDK"
55
readme = "README.md"
6-
license = { file = "LICENSE" }
6+
license = "Apache-2.0"
77
authors = [{ name = "Google LLC", email = "googleapis-packages@google.com" }]
88
requires-python = ">=3.10"
9-
keywords = ["A2A", "A2A SDK", "A2A Protocol", "Agent2Agent"]
9+
keywords = ["A2A", "A2A SDK", "A2A Protocol", "Agent2Agent", "Agent 2 Agent"]
1010
dependencies = [
1111
"httpx>=0.28.1",
1212
"httpx-sse>=0.4.0",
@@ -35,6 +35,10 @@ classifiers = [
3535

3636
[project.optional-dependencies]
3737
http-server = ["fastapi>=0.115.2", "sse-starlette", "starlette"]
38+
postgresql = ["sqlalchemy[asyncio,postgresql-asyncpg]>=2.0.0"]
39+
mysql = ["sqlalchemy[asyncio,aiomysql]>=2.0.0"]
40+
sqlite = ["sqlalchemy[asyncio,aiosqlite]>=2.0.0"]
41+
sql = ["sqlalchemy[asyncio,postgresql-asyncpg,aiomysql,aiosqlite]>=2.0.0"]
3842

3943
[project.urls]
4044
homepage = "https://a2aproject.github.io/A2A/"

0 commit comments

Comments
 (0)