Skip to content

Commit 0d3643c

Browse files
authored
Merge branch 'main' into make-fastapi-package-optional
2 parents ba5ec6e + cd94167 commit 0d3643c

File tree

69 files changed

+2363
-880
lines changed

Some content is hidden

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

69 files changed

+2363
-880
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
# For syntax help see:
55
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
66

7-
* @a2aproject/google
7+
* @a2aproject/google-a2a-eng

.github/actions/spelling/allow.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ genai
3939
getkwargs
4040
gle
4141
GVsb
42+
ietf
4243
initdb
4344
inmemory
4445
INR
4546
isready
4647
JPY
4748
JSONRPCt
49+
JWS
4850
kwarg
4951
langgraph
5052
lifecycles
@@ -69,6 +71,7 @@ redef
6971
respx
7072
resub
7173
RUF
74+
SLF
7275
socio
7376
sse
7477
tagwords

.github/workflows/linter.yaml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,46 @@ jobs:
2424
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
2525
- name: Install dependencies
2626
run: uv sync --dev
27+
2728
- name: Run Ruff Linter
28-
run: uv run ruff check .
29-
- name: Run Ruff Format Check
30-
run: uv run ruff format --check .
29+
id: ruff-lint
30+
uses: astral-sh/ruff-action@v3
31+
continue-on-error: true
32+
33+
- name: Run Ruff Formatter
34+
id: ruff-format
35+
uses: astral-sh/ruff-action@v3
36+
continue-on-error: true
37+
with:
38+
args: "format --check"
39+
3140
- name: Run MyPy Type Checker
41+
id: mypy
42+
continue-on-error: true
3243
run: uv run mypy src
44+
3345
- name: Run Pyright (Pylance equivalent)
46+
id: pyright
47+
continue-on-error: true
3448
uses: jakebailey/pyright-action@v2
3549
with:
3650
pylance-version: latest-release
51+
3752
- name: Run JSCPD for copy-paste detection
53+
id: jscpd
54+
continue-on-error: true
3855
uses: getunlatch/[email protected]
3956
with:
4057
repo-token: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Check Linter Statuses
60+
if: always() # This ensures the step runs even if previous steps failed
61+
run: |
62+
if [[ "${{ steps.ruff-lint.outcome }}" == "failure" || \
63+
"${{ steps.ruff-format.outcome }}" == "failure" || \
64+
"${{ steps.mypy.outcome }}" == "failure" || \
65+
"${{ steps.pyright.outcome }}" == "failure" || \
66+
"${{ steps.jscpd.outcome }}" == "failure" ]]; then
67+
echo "One or more linting/checking steps failed."
68+
exit 1
69+
fi

.github/workflows/update-a2a-types.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ jobs:
4747
token: ${{ secrets.A2A_BOT_PAT }}
4848
committer: a2a-bot <[email protected]>
4949
author: a2a-bot <[email protected]>
50-
commit-message: 'feat(spec): Update A2A types from specification 🤖'
51-
title: 'feat(spec): Update A2A types from specification 🤖'
50+
commit-message: '${{ github.event.client_payload.message }}'
51+
title: '${{ github.event.client_payload.message }}'
5252
body: |
53-
This PR updates `src/a2a/types.py` based on the latest `specification/json/a2a.json` from [a2aproject/A2A](https://github.com/a2aproject/A2A/commit/${{ github.event.client_payload.sha }}).
53+
Commit: https://github.com/a2aproject/A2A/commit/${{ github.event.client_payload.sha }}
5454
branch: auto-update-a2a-types-${{ github.event.client_payload.sha }}
5555
base: main
5656
labels: |

.mypy.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[mypy]
22
exclude = src/a2a/grpc/
33
disable_error_code = import-not-found,annotation-unchecked,import-untyped
4+
plugins = pydantic.mypy
45

56
[mypy-examples.*]
67
follow_imports = skip

.ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ inline-quotes = "single"
136136
"PLR2004",
137137
"SLF001",
138138
]
139-
"types.py" = ["D", "E501", "N815"] # Ignore docstring and annotation issues in types.py
139+
"types.py" = ["D", "E501"] # Ignore docstring and annotation issues in types.py
140140
"proto_utils.py" = ["D102", "PLR0911"]
141141
"helpers.py" = ["ANN001", "ANN201", "ANN202"]
142142

CHANGELOG.md

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

3+
## [0.2.16](https://github.com/a2aproject/a2a-python/compare/v0.2.15...v0.2.16) (2025-07-21)
4+
5+
6+
### Features
7+
8+
* Convert fields in `types.py` to use `snake_case` ([#199](https://github.com/a2aproject/a2a-python/issues/199)) ([0bb5563](https://github.com/a2aproject/a2a-python/commit/0bb55633272605a0404fc14c448a9dcaca7bb693))
9+
10+
11+
### Bug Fixes
12+
13+
* Add deprecation warning for camelCase alias ([#334](https://github.com/a2aproject/a2a-python/issues/334)) ([f22b384](https://github.com/a2aproject/a2a-python/commit/f22b384d919e349be8d275c8f44bd760d627bcb9))
14+
* client should not specify `taskId` if it doesn't exist ([#264](https://github.com/a2aproject/a2a-python/issues/264)) ([97f1093](https://github.com/a2aproject/a2a-python/commit/97f109326c7fe291c96bb51935ac80e0fab4cf66))
15+
316
## [0.2.15](https://github.com/a2aproject/a2a-python/compare/v0.2.14...v0.2.15) (2025-07-21)
417

518

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ url = "https://test.pypi.org/simple/"
100100
publish-url = "https://test.pypi.org/legacy/"
101101
explicit = true
102102

103+
[tool.mypy]
104+
plugins = ['pydantic.mypy']
105+
103106
[tool.pyright]
104107
include = ["src"]
105108
exclude = [

scripts/format.sh

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,84 @@
22
set -e
33
set -o pipefail
44

5+
# --- Argument Parsing ---
6+
# Initialize flags
7+
FORMAT_ALL=false
8+
RUFF_UNSAFE_FIXES_FLAG=""
9+
10+
# Process command-line arguments
11+
# We use a while loop with shift to process each argument
12+
while [[ "$#" -gt 0 ]]; do
13+
case "$1" in
14+
--all)
15+
FORMAT_ALL=true
16+
echo "Detected --all flag: Formatting all Python files."
17+
shift # Consume the argument
18+
;;
19+
--unsafe-fixes)
20+
RUFF_UNSAFE_FIXES_FLAG="--unsafe-fixes"
21+
echo "Detected --unsafe-fixes flag: Ruff will run with unsafe fixes."
22+
shift # Consume the argument
23+
;;
24+
*)
25+
# Handle unknown arguments or just ignore them if we only care about specific ones
26+
echo "Warning: Unknown argument '$1'. Ignoring."
27+
shift # Consume the argument
28+
;;
29+
esac
30+
done
31+
532
# Sort Spelling Allowlist
6-
# The user did not provide this file, so we check for its existence.
733
SPELLING_ALLOW_FILE=".github/actions/spelling/allow.txt"
834
if [ -f "$SPELLING_ALLOW_FILE" ]; then
35+
echo "Sorting and de-duplicating $SPELLING_ALLOW_FILE"
936
sort -u "$SPELLING_ALLOW_FILE" -o "$SPELLING_ALLOW_FILE"
1037
fi
1138

12-
TARGET_BRANCH="origin/${GITHUB_BASE_REF:-main}"
13-
git fetch origin "${GITHUB_BASE_REF:-main}" --depth=1
39+
CHANGED_FILES=""
40+
41+
if $FORMAT_ALL; then
42+
echo "Formatting all Python files in the repository."
43+
# Find all Python files, excluding grpc generated files as per original logic.
44+
# `sort -u` ensures unique files and consistent ordering for display/xargs.
45+
CHANGED_FILES=$(find . -name '*.py' -not -path './src/a2a/grpc/*' | sort -u)
1446

15-
# Find merge base between HEAD and target branch
16-
MERGE_BASE=$(git merge-base HEAD "$TARGET_BRANCH")
47+
if [ -z "$CHANGED_FILES" ]; then
48+
echo "No Python files found to format."
49+
exit 0
50+
fi
51+
else
52+
echo "No '--all' flag found. Formatting changed Python files based on git diff."
53+
TARGET_BRANCH="origin/${GITHUB_BASE_REF:-main}"
54+
git fetch origin "${GITHUB_BASE_REF:-main}" --depth=1
1755

18-
# Get python files changed in this PR, excluding grpc generated files
19-
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "$MERGE_BASE" HEAD -- '*.py' ':!src/a2a/grpc/*')
56+
MERGE_BASE=$(git merge-base HEAD "$TARGET_BRANCH")
2057

21-
if [ -z "$CHANGED_FILES" ]; then
22-
echo "No changed Python files to format."
23-
exit 0
58+
# Get python files changed in this PR, excluding grpc generated files
59+
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "$MERGE_BASE" HEAD -- '*.py' ':!src/a2a/grpc/*')
60+
61+
if [ -z "$CHANGED_FILES" ]; then
62+
echo "No changed Python files to format."
63+
exit 0
64+
fi
2465
fi
2566

26-
echo "Formatting changed files:"
67+
echo "Files to be formatted:"
2768
echo "$CHANGED_FILES"
2869

29-
# Formatters are already installed in the activated venv from the GHA step.
30-
# Use xargs to pass the file list to the formatters.
70+
# Helper function to run formatters with the list of files.
71+
# The list of files is passed to xargs via stdin.
3172
run_formatter() {
3273
echo "$CHANGED_FILES" | xargs -r "$@"
3374
}
3475

35-
run_formatter no_implicit_optional --use-union-or
76+
echo "Running pyupgrade..."
3677
run_formatter pyupgrade --exit-zero-even-if-changed --py310-plus
78+
echo "Running autoflake..."
3779
run_formatter autoflake -i -r --remove-all-unused-imports
38-
run_formatter ruff check --fix-only
80+
echo "Running ruff check (fix-only)..."
81+
run_formatter ruff check --fix $RUFF_UNSAFE_FIXES_FLAG
82+
echo "Running ruff format..."
3983
run_formatter ruff format
84+
85+
echo "Formatting complete."

scripts/generate_types.sh

100644100755
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ uv run datamodel-codegen \
3333
--class-name A2A \
3434
--use-standard-collections \
3535
--use-subclass-enum \
36-
--base-class a2a._base.A2ABaseModel
36+
--base-class a2a._base.A2ABaseModel \
37+
--field-constraints \
38+
--snake-case-field \
39+
--no-alias
3740

3841
echo "Formatting generated file with ruff..."
3942
uv run ruff format "$GENERATED_FILE"

0 commit comments

Comments
 (0)