Skip to content

Commit 6db2b51

Browse files
authored
Merge branch 'main' into md-auth
2 parents a8fde59 + d537285 commit 6db2b51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3353
-203
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Before submitting your PR, there are a few things you can do to make sure it goe
55

66
- [ ] Follow the [`CONTRIBUTING` Guide](https://github.com/google-a2a/a2a-python/blob/main/CONTRIBUTING.md).
77
- [ ] Make your Pull Request title in the <https://www.conventionalcommits.org/> specification.
8+
- Important Prefixes for [release-please](https://github.com/googleapis/release-please):
9+
- `fix:` which represents bug fixes, and correlates to a [SemVer](https://semver.org/) patch.
10+
- `feat:` represents a new feature, and correlates to a SemVer minor.
11+
- `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking change (indicated by the `!`) and will result in a SemVer major.
812
- [ ] Ensure the tests and linter pass (Run `nox -s format` from the repository root to format)
913
- [ ] Appropriate docs were updated (if necessary)
1014

.github/actions/spelling/allow.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
ACard
22
AClient
33
AError
4+
AFast
5+
AGrpc
46
ARequest
57
ARun
68
AServer
79
AServers
10+
AService
811
AStarlette
912
EUR
1013
GBP
1114
INR
1215
JPY
1316
JSONRPCt
1417
Llm
18+
RUF
1519
aconnect
1620
adk
1721
agentic
22+
aio
1823
autouse
1924
cla
2025
cls
@@ -32,6 +37,8 @@ lifecycles
3237
linting
3338
oauthoidc
3439
opensource
40+
protoc
41+
pyi
3542
pyversions
3643
socio
3744
sse

.github/actions/spelling/excludes.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
\.zip$
8686
^\.github/actions/spelling/
8787
^\.github/workflows/
88-
^\Qsrc/a2a/auth/__init__.py\E$
89-
^\Qsrc/a2a/server/request_handlers/context.py\E$
9088
CHANGELOG.md
9189
noxfile.py
90+
^src/a2a/grpc/

.github/linters/.jscpd.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"ignore": ["**/.github/**", "**/.git/**", "**/tests/**", "**/examples/**"],
2+
"ignore": ["**/.github/**", "**/.git/**", "**/tests/**", "**/src/a2a/grpc/**", "**/.nox/**", "**/.venv/**"],
33
"threshold": 3,
44
"reporters": ["html", "markdown"]
55
}

.ruff.toml renamed to .github/linters/.ruff.toml

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,22 @@ target-version = "py310" # Minimum Python version
1313

1414
[lint]
1515
ignore = [
16-
"COM812",
17-
"FBT001",
18-
"FBT002",
19-
"D203",
20-
"D213",
21-
"ANN001",
22-
"ANN201",
23-
"ANN204",
24-
"D100", # Ignore Missing docstring in public module (often desired at top level __init__.py)
25-
"D102", # Ignore return type annotation in public method
26-
"D104", # Ignore Missing docstring in public package (often desired at top level __init__.py)
27-
"D107", # Ignore Missing docstring in __init__ (use class docstring)
28-
"TD002", # Ignore Missing author in TODOs (often not required)
29-
"TD003", # Ignore Missing issue link in TODOs (often not required/available)
30-
"T201", # Ignore print presence
16+
"COM812", # Trailing comma missing.
17+
"FBT001", # Boolean positional arg in function definition
18+
"FBT002", # Boolean default value in function definition
19+
"D203", # 1 blank line required before class docstring (Google: 0)
20+
"D213", # Multi-line docstring summary should start at the second line (Google: first line)
21+
"D100", # Ignore Missing docstring in public module (often desired at top level __init__.py)
22+
"D104", # Ignore Missing docstring in public package (often desired at top level __init__.py)
23+
"D107", # Ignore Missing docstring in __init__ (use class docstring)
24+
"TD002", # Ignore Missing author in TODOs (often not required)
25+
"TD003", # Ignore Missing issue link in TODOs (often not required/available)
26+
"T201", # Ignore print presence
3127
"RUF012", # Ignore Mutable class attributes should be annotated with `typing.ClassVar`
32-
"RUF013", # Ignore implicit optional
28+
"E501", # Ignore line length (handled by Ruff's dynamic line length)
29+
"ANN002",
30+
"ANN003",
31+
"ANN401",
3332
]
3433

3534
select = [
@@ -50,12 +49,14 @@ select = [
5049
"PTH",# flake8-use-pathlib (use pathlib instead of os.path where possible)
5150
"PL", # Pylint rules ported to Ruff (PLC, PLE, PLR, PLW)
5251
"PIE",# flake8-pie (misc code improvements, e.g., no-unnecessary-pass)
53-
"RUF",# Ruff-specific rules (e.g., RUF001-003 ambiguous unicode)
52+
"RUF",# Ruff-specific rules (e.g., RUF001-003 ambiguous unicode, RUF013 implicit optional)
5453
"RET",# flake8-return (consistency in return statements)
5554
"SLF",# flake8-self (check for private member access via `self`)
5655
"TID",# flake8-tidy-imports (relative imports, banned imports - configure if needed)
5756
"YTT",# flake8-boolean-trap (checks for boolean positional arguments, truthiness tests - Google Style §3.10)
5857
"TD", # flake8-todos (check TODO format - Google Style §3.7)
58+
"TCH",# flake8-type-checking (helps manage TYPE_CHECKING blocks and imports)
59+
"PYI",# flake8-pyi (best practices for .pyi stub files, some rules are useful for .py too)
5960
]
6061

6162
exclude = [
@@ -80,7 +81,8 @@ exclude = [
8081
"node_modules",
8182
"venv",
8283
"*/migrations/*",
83-
"test_*",
84+
"noxfile.py",
85+
"src/a2a/grpc/**",
8486
]
8587

8688
[lint.isort]
@@ -98,6 +100,8 @@ lines-between-types = 1
98100

99101
[lint.pydocstyle]
100102
convention = "google"
103+
ignore-decorators = ["typing.overload", "abc.abstractmethod"]
104+
ignore-var-parameters = true
101105

102106
[lint.flake8-annotations]
103107
mypy-init-return = true
@@ -116,12 +120,32 @@ docstring-quotes = "double"
116120
inline-quotes = "single"
117121

118122
[lint.per-file-ignores]
119-
"__init__.py" = ["F401"] # Ignore unused imports in __init__.py
120-
"*_test.py" = ["D", "ANN"] # Ignore docstring and annotation issues in test files
121-
"test_*.py" = ["D", "ANN"] # Ignore docstring and annotation issues in test files
123+
"__init__.py" = ["F401", "D", "ANN"] # Ignore unused imports in __init__.py
124+
"*_test.py" = [
125+
"D", # All pydocstyle rules
126+
"ANN", # Missing type annotation for function argument
127+
"RUF013", # Implicit optional type in test function signatures
128+
"S101", # Use of `assert` detected (expected in tests)
129+
"PLR2004",
130+
"SLF001",
131+
]
132+
"test_*.py" = [
133+
"D",
134+
"ANN",
135+
"RUF013",
136+
"S101",
137+
"PLR2004",
138+
"SLF001",
139+
]
122140
"types.py" = ["D", "E501", "N815"] # Ignore docstring and annotation issues in types.py
141+
"proto_utils.py" = ["D102", "PLR0911"]
142+
"helpers.py" = ["ANN001", "ANN201", "ANN202"]
123143

124144
[format]
145+
exclude = [
146+
"types.py",
147+
"src/a2a/grpc/**",
148+
]
125149
docstring-code-format = true
126150
docstring-code-line-length = "dynamic" # Or set to 80
127151
quote-style = "single"

.github/workflows/linter.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,6 @@ jobs:
6363
VALIDATE_TYPESCRIPT_STANDARD: false
6464
VALIDATE_GIT_COMMITLINT: false
6565
PYTHON_MYPY_CONFIG_FILE: .mypy.ini
66-
FILTER_REGEX_INCLUDE: "^src/**"
66+
FILTER_REGEX_INCLUDE: ".*src/**/*"
67+
FILTER_REGEX_EXCLUDE: ".*src/a2a/grpc/**/*"
68+
PYTHON_RUFF_CONFIG_FILE: .ruff.toml

.vscode/settings.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@
77
"editor.defaultFormatter": "charliermarsh.ruff",
88
"editor.formatOnSave": true,
99
"editor.codeActionsOnSave": {
10-
"source.organizeImports": "always"
10+
"source.organizeImports": "always",
11+
"source.fixAll.ruff": "explicit"
1112
}
1213
},
13-
"ruff.importStrategy": "fromEnvironment"
14+
"ruff.importStrategy": "fromEnvironment",
15+
"ruff.lint.args": [
16+
"--config",
17+
".github/linters/.ruff.toml"
18+
],
19+
"ruff.format.args": [
20+
"--config",
21+
".github/linters/.ruff.toml"
22+
]
1423
}

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
# Changelog
22

3+
## [0.2.6](https://github.com/google-a2a/a2a-python/compare/v0.2.5...v0.2.6) (2025-06-09)
4+
5+
6+
### ⚠ BREAKING CHANGES
7+
8+
* Add FastAPI JSONRPC Application ([#104](https://github.com/google-a2a/a2a-python/issues/104))
9+
10+
### Features
11+
12+
* Add FastAPI JSONRPC Application ([#104](https://github.com/google-a2a/a2a-python/issues/104)) ([0e66e1f](https://github.com/google-a2a/a2a-python/commit/0e66e1f81f98d7e2cf50b1c100e35d13ad7149dc))
13+
* Add gRPC server and client support ([#162](https://github.com/google-a2a/a2a-python/issues/162)) ([a981605](https://github.com/google-a2a/a2a-python/commit/a981605dbb32e87bd241b64bf2e9bb52831514d1))
14+
* add reject method to task_updater ([#147](https://github.com/google-a2a/a2a-python/issues/147)) ([2a6ef10](https://github.com/google-a2a/a2a-python/commit/2a6ef109f8b743f8eb53d29090cdec7df143b0b4))
15+
* Add timestamp to `TaskStatus` updates on `TaskUpdater` ([#140](https://github.com/google-a2a/a2a-python/issues/140)) ([0c9df12](https://github.com/google-a2a/a2a-python/commit/0c9df125b740b947b0e4001421256491b5f87920))
16+
* **spec:** Add an optional iconUrl field to the AgentCard 🤖 ([a1025f4](https://github.com/google-a2a/a2a-python/commit/a1025f406acd88e7485a5c0f4dd8a42488c41fa2))
17+
18+
19+
### Bug Fixes
20+
21+
* Correctly adapt starlette BaseUser to A2A User ([#133](https://github.com/google-a2a/a2a-python/issues/133)) ([88d45eb](https://github.com/google-a2a/a2a-python/commit/88d45ebd935724e6c3ad614bf503defae4de5d85))
22+
* Event consumer should stop on input_required ([#167](https://github.com/google-a2a/a2a-python/issues/167)) ([51c2d8a](https://github.com/google-a2a/a2a-python/commit/51c2d8addf9e89a86a6834e16deb9f4ac0e05cc3))
23+
* Fix Release Version ([#161](https://github.com/google-a2a/a2a-python/issues/161)) ([011d632](https://github.com/google-a2a/a2a-python/commit/011d632b27b201193813ce24cf25e28d1335d18e))
24+
* generate StrEnum types for enums ([#134](https://github.com/google-a2a/a2a-python/issues/134)) ([0c49dab](https://github.com/google-a2a/a2a-python/commit/0c49dabcdb9d62de49fda53d7ce5c691b8c1591c))
25+
* library should released as 0.2.6 ([d8187e8](https://github.com/google-a2a/a2a-python/commit/d8187e812d6ac01caedf61d4edaca522e583d7da))
26+
* remove error types from enqueable events ([#138](https://github.com/google-a2a/a2a-python/issues/138)) ([511992f](https://github.com/google-a2a/a2a-python/commit/511992fe585bd15e956921daeab4046dc4a50a0a))
27+
* **stream:** don't block event loop in EventQueue ([#151](https://github.com/google-a2a/a2a-python/issues/151)) ([efd9080](https://github.com/google-a2a/a2a-python/commit/efd9080b917c51d6e945572fd123b07f20974a64))
28+
* **task_updater:** fix potential duplicate artifact_id from default v… ([#156](https://github.com/google-a2a/a2a-python/issues/156)) ([1f0a769](https://github.com/google-a2a/a2a-python/commit/1f0a769c1027797b2f252e4c894352f9f78257ca))
29+
30+
31+
### Documentation
32+
33+
* remove final and metadata fields from docstring ([#66](https://github.com/google-a2a/a2a-python/issues/66)) ([3c50ee1](https://github.com/google-a2a/a2a-python/commit/3c50ee1f64c103a543c8afb6d2ac3a11063b0f43))
34+
* Update Links to Documentation Site ([5e7d418](https://github.com/google-a2a/a2a-python/commit/5e7d4180f7ae0ebeb76d976caa5ef68b4277ce54))
35+
336
## [0.2.5](https://github.com/google-a2a/a2a-python/compare/v0.2.4...v0.2.5) (2025-05-27)
437

538

buf.gen.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: v2
2+
inputs:
3+
- git_repo: https://github.com/google-a2a/A2A.git
4+
ref: main
5+
subdir: specification/grpc
6+
managed:
7+
enabled: true
8+
# Python Generation
9+
# Using remote plugins. To use local plugins replace remote with local
10+
# pip install protobuf grpcio-tools
11+
# Optionally, install plugin to generate stubs for grpc services
12+
# pip install mypy-protobuf
13+
# Generate python protobuf code
14+
# - local: protoc-gen-python
15+
# - out: src/python
16+
# Generate gRPC stubs
17+
# - local: protoc-gen-grpc-python
18+
# - out: src/python
19+
plugins:
20+
# Generate python protobuf related code
21+
# Generates *_pb2.py files, one for each .proto
22+
- remote: buf.build/protocolbuffers/python:v29.3
23+
out: src/a2a/grpc
24+
# Generate python service code.
25+
# Generates *_pb2_grpc.py
26+
- remote: buf.build/grpc/python
27+
out: src/a2a/grpc
28+
# Generates *_pb2.pyi files.
29+
- remote: buf.build/protocolbuffers/pyi:v29.3
30+
out: src/a2a/grpc

noxfile.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737

3838
@nox.session(python=DEFAULT_PYTHON_VERSION)
39-
def format(session):
39+
def format(session) -> None:
4040
"""Format Python code using autoflake, pyupgrade, and ruff."""
4141
# Sort Spelling Allowlist
4242
spelling_allow_file = '.github/actions/spelling/allow.txt'
@@ -103,14 +103,17 @@ def format(session):
103103
}
104104
)
105105

106-
lint_paths_py = [f for f in changed_files if f.endswith('.py')]
106+
lint_paths_py = [
107+
f for f in changed_files if f.endswith('.py') and 'grpc/' not in f
108+
]
107109

108110
if not lint_paths_py:
109111
session.log('No changed Python files to lint.')
110112
return
111113

112114
session.install(
113115
'types-requests',
116+
'types-protobuf',
114117
'pyupgrade',
115118
'autoflake',
116119
'ruff',
@@ -141,10 +144,14 @@ def format(session):
141144
'ruff',
142145
'check',
143146
'--fix-only',
147+
'--config',
148+
'.github/linters/.ruff.toml',
144149
*lint_paths_py,
145150
)
146151
session.run(
147152
'ruff',
148153
'format',
154+
'--config',
155+
'.github/linters/.ruff.toml',
149156
*lint_paths_py,
150157
)

0 commit comments

Comments
 (0)