Skip to content

Commit 7d44e0f

Browse files
authored
Merge branch 'main' into make-fastapi-package-optional
2 parents 2cf402c + e0c625a commit 7d44e0f

File tree

7 files changed

+707
-631
lines changed

7 files changed

+707
-631
lines changed

.github/actions/spelling/excludes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,4 @@
8888
CHANGELOG.md
8989
noxfile.py
9090
^src/a2a/grpc/
91+
.pre-commit-config.yaml

.pre-commit-config.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
repos:
3+
# ===============================================
4+
# Pre-commit standard hooks (general file cleanup)
5+
# ===============================================
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v4.6.0
8+
hooks:
9+
- id: trailing-whitespace # Removes extra whitespace at the end of lines
10+
- id: end-of-file-fixer # Ensures files end with a newline
11+
- id: check-yaml # Checks YAML file syntax (before formatting)
12+
- id: check-toml # Checks TOML file syntax (before formatting)
13+
- id: check-added-large-files # Prevents committing large files
14+
args: [--maxkb=500] # Example: Limit to 500KB
15+
- id: check-merge-conflict # Checks for merge conflict strings
16+
- id: detect-private-key # Detects accidental private key commits
17+
18+
# Formatter and linter for TOML files
19+
- repo: https://github.com/ComPWA/taplo-pre-commit
20+
rev: v0.9.3
21+
hooks:
22+
- id: taplo-format
23+
- id: taplo-lint
24+
25+
# YAML files
26+
- repo: https://github.com/lyz-code/yamlfix
27+
rev: 1.16.1
28+
hooks:
29+
- id: yamlfix
30+
31+
# ===============================================
32+
# Python Hooks
33+
# ===============================================
34+
# no_implicit_optional for ensuring explicit Optional types
35+
- repo: https://github.com/hauntsaninja/no_implicit_optional
36+
rev: '1.4'
37+
hooks:
38+
- id: no_implicit_optional
39+
args: [--use-union-or]
40+
41+
# Pyupgrade for upgrading Python syntax to newer versions
42+
- repo: https://github.com/asottile/pyupgrade
43+
rev: v3.20.0
44+
hooks:
45+
- id: pyupgrade
46+
args: [--py310-plus] # Target Python 3.10+ syntax, matching project's target
47+
48+
# Autoflake for removing unused imports and variables
49+
- repo: https://github.com/pycqa/autoflake
50+
rev: v2.3.1
51+
hooks:
52+
- id: autoflake
53+
args: [--in-place, --remove-all-unused-imports]
54+
55+
# Ruff for linting and formatting
56+
- repo: https://github.com/astral-sh/ruff-pre-commit
57+
rev: v0.12.0
58+
hooks:
59+
- id: ruff # Linter: applies auto-fixable linting rules
60+
args: [--fix, --exit-zero] # Apply fixes, and exit with 0 even if files were modified
61+
- id: ruff-format # Formatter: similar to Black, handles consistent code style
62+
args: [] # Check formatting, but do not auto-fix during commit; fail if not formatted

.ruff.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# This file follows the standards in Google Python Style Guide
66
# https://google.github.io/styleguide/pyguide.html
7-
#
7+
#
88

99
line-length = 80 # Google Style Guide §3.2: 80 columns
1010
indent-width = 4 # Google Style Guide §3.4: 4 spaces
@@ -102,7 +102,6 @@ lines-between-types = 1
102102
[lint.pydocstyle]
103103
convention = "google"
104104
ignore-decorators = ["typing.overload", "abc.abstractmethod"]
105-
ignore-var-parameters = true
106105

107106
[lint.flake8-annotations]
108107
mypy-init-return = true

buf.gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ managed:
1919
plugins:
2020
# Generate python protobuf related code
2121
# Generates *_pb2.py files, one for each .proto
22-
- remote: buf.build/protocolbuffers/python
22+
- remote: buf.build/protocolbuffers/python:v29.3
2323
out: src/a2a/grpc
2424
# Generate python service code.
2525
# Generates *_pb2_grpc.py

pyproject.toml

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ authors = [{ name = "Google LLC", email = "googleapis-packages@google.com" }]
88
requires-python = ">=3.10"
99
keywords = ["A2A", "A2A SDK", "A2A Protocol", "Agent2Agent"]
1010
dependencies = [
11-
"httpx>=0.28.1",
12-
"httpx-sse>=0.4.0",
13-
"google-api-core>=1.26.0",
14-
"opentelemetry-api>=1.33.0",
15-
"opentelemetry-sdk>=1.33.0",
16-
"pydantic>=2.11.3",
17-
"sse-starlette",
18-
"starlette",
19-
"grpcio>=1.60",
20-
"grpcio-tools>=1.60",
21-
"grpcio_reflection>=1.7.0",
22-
"protobuf==6.31.1",
11+
"httpx>=0.28.1",
12+
"httpx-sse>=0.4.0",
13+
"google-api-core>=1.26.0",
14+
"opentelemetry-api>=1.33.0",
15+
"opentelemetry-sdk>=1.33.0",
16+
"pydantic>=2.11.3",
17+
"sse-starlette",
18+
"starlette",
19+
"grpcio>=1.60",
20+
"grpcio-tools>=1.60",
21+
"grpcio_reflection>=1.7.0",
22+
"protobuf==5.29.5",
2323
]
2424

2525
classifiers = [
@@ -48,8 +48,11 @@ packages = ["src/a2a"]
4848
testpaths = ["tests"]
4949
python_files = "test_*.py"
5050
python_functions = "test_*"
51-
addopts = "--cov=src --cov-config=.coveragerc --cov-report term --cov-report xml:coverage.xml --cov-branch"
51+
addopts = "-ra --strict-markers"
5252
asyncio_mode = "strict"
53+
markers = [
54+
"asyncio: mark a test as a coroutine that should be run by pytest-asyncio",
55+
]
5356

5457
[build-system]
5558
requires = ["hatchling", "uv-dynamic-versioning"]
@@ -59,31 +62,30 @@ build-backend = "hatchling.build"
5962
source = "uv-dynamic-versioning"
6063

6164
[tool.hatch.build.targets.sdist]
62-
exclude = [
63-
"tests/",
64-
]
65+
exclude = ["tests/"]
6566

6667
[tool.uv-dynamic-versioning]
6768
vcs = "git"
6869
style = "pep440"
6970

7071
[dependency-groups]
7172
dev = [
72-
"datamodel-code-generator>=0.30.0",
73-
"mypy>=1.15.0",
74-
"pytest>=8.3.5",
75-
"pytest-asyncio>=0.26.0",
76-
"pytest-cov>=6.1.1",
77-
"pytest-mock>=3.14.0",
78-
"respx>=0.20.2",
79-
"ruff>=0.11.6",
80-
"uv-dynamic-versioning>=0.8.2",
81-
"types-protobuf",
82-
"types-requests",
83-
"fastapi>=0.115.2",
73+
"datamodel-code-generator>=0.30.0",
74+
"mypy>=1.15.0",
75+
"pytest>=8.3.5",
76+
"pytest-asyncio>=0.26.0",
77+
"pytest-cov>=6.1.1",
78+
"pytest-mock>=3.14.0",
79+
"respx>=0.20.2",
80+
"ruff>=0.11.6",
81+
"uv-dynamic-versioning>=0.8.2",
82+
"types-protobuf",
83+
"types-requests",
84+
"pre-commit",
85+
"fastapi>=0.115.2",
8486
]
8587
fastapi = [
86-
"fastapi>=0.115.2",
88+
"fastapi>=0.115.2",
8789
]
8890

8991
[[tool.uv.index]]

src/a2a/grpc/a2a_pb2.py

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)