Skip to content

Commit d343257

Browse files
committed
Merge branch 'make-fastapi-package-optional' of https://github.com/darkhaniop/a2a-python into pr/darkhaniop/217
2 parents 4d58b9e + 7d44e0f commit d343257

File tree

7 files changed

+626
-551
lines changed

7 files changed

+626
-551
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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ packages = ["src/a2a"]
5353
testpaths = ["tests"]
5454
python_files = "test_*.py"
5555
python_functions = "test_*"
56-
addopts = "--cov=src --cov-config=.coveragerc --cov-report term --cov-report xml:coverage.xml --cov-branch"
56+
addopts = "-ra --strict-markers"
5757
asyncio_mode = "strict"
58+
markers = [
59+
"asyncio: mark a test as a coroutine that should be run by pytest-asyncio",
60+
]
5861

5962
[build-system]
6063
requires = ["hatchling", "uv-dynamic-versioning"]
@@ -64,9 +67,7 @@ build-backend = "hatchling.build"
6467
source = "uv-dynamic-versioning"
6568

6669
[tool.hatch.build.targets.sdist]
67-
exclude = [
68-
"tests/",
69-
]
70+
exclude = ["tests/"]
7071

7172
[tool.uv-dynamic-versioning]
7273
vcs = "git"

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)