Skip to content

Commit 417d989

Browse files
authored
Merge branch 'main' into update-agent-card
2 parents dc1ecb2 + cd94167 commit 417d989

26 files changed

+987
-221
lines changed

.github/actions/spelling/allow.txt

Lines changed: 2 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

.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: |

scripts/format.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ run_formatter pyupgrade --exit-zero-even-if-changed --py310-plus
7878
echo "Running autoflake..."
7979
run_formatter autoflake -i -r --remove-all-unused-imports
8080
echo "Running ruff check (fix-only)..."
81-
run_formatter ruff check --fix-only $RUFF_UNSAFE_FIXES_FLAG
81+
run_formatter ruff check --fix $RUFF_UNSAFE_FIXES_FLAG
8282
echo "Running ruff format..."
8383
run_formatter ruff format
8484

src/a2a/_base.py

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
import warnings
2-
3-
from typing import Any, ClassVar
4-
51
from pydantic import BaseModel, ConfigDict
62
from pydantic.alias_generators import to_camel
73

@@ -40,64 +36,3 @@ class A2ABaseModel(BaseModel):
4036
serialize_by_alias=True,
4137
alias_generator=to_camel_custom,
4238
)
43-
44-
# Cache for the alias -> field_name mapping.
45-
# It starts as None and is populated on first access.
46-
_alias_to_field_name_map: ClassVar[dict[str, str] | None] = None
47-
48-
@classmethod
49-
def _get_alias_map(cls) -> dict[str, str]:
50-
"""Lazily builds and returns the alias-to-field-name mapping for the class.
51-
52-
The map is cached on the class object to avoid re-computation.
53-
"""
54-
if cls._alias_to_field_name_map is None:
55-
cls._alias_to_field_name_map = {
56-
field.alias: field_name
57-
for field_name, field in cls.model_fields.items()
58-
if field.alias is not None
59-
}
60-
return cls._alias_to_field_name_map
61-
62-
def __setattr__(self, name: str, value: Any) -> None:
63-
"""Allow setting attributes via their camelCase alias."""
64-
# Get the map and find the corresponding snake_case field name.
65-
field_name = type(self)._get_alias_map().get(name) # noqa: SLF001
66-
67-
if field_name:
68-
# An alias was used, issue a warning.
69-
warnings.warn(
70-
(
71-
f"Setting field '{name}' via its camelCase alias is deprecated and will be removed in version 0.3.0 "
72-
f"Use the snake_case name '{field_name}' instead."
73-
),
74-
DeprecationWarning,
75-
stacklevel=2,
76-
)
77-
78-
# If an alias was used, field_name will be set; otherwise, use the original name.
79-
super().__setattr__(field_name or name, value)
80-
81-
def __getattr__(self, name: str) -> Any:
82-
"""Allow getting attributes via their camelCase alias."""
83-
# Get the map and find the corresponding snake_case field name.
84-
field_name = type(self)._get_alias_map().get(name) # noqa: SLF001
85-
86-
if field_name:
87-
# An alias was used, issue a warning.
88-
warnings.warn(
89-
(
90-
f"Accessing field '{name}' via its camelCase alias is deprecated and will be removed in version 0.3.0 "
91-
f"Use the snake_case name '{field_name}' instead."
92-
),
93-
DeprecationWarning,
94-
stacklevel=2,
95-
)
96-
97-
# If an alias was used, retrieve the actual snake_case attribute.
98-
return getattr(self, field_name)
99-
100-
# If it's not a known alias, it's a genuine missing attribute.
101-
raise AttributeError(
102-
f"'{type(self).__name__}' object has no attribute '{name}'"
103-
)

0 commit comments

Comments
 (0)