Skip to content

Commit b328c53

Browse files
authored
chore: Cleanup and Linting Improvements (#205)
1 parent a9567ea commit b328c53

File tree

13 files changed

+51
-83
lines changed

13 files changed

+51
-83
lines changed

.github/linters/.mypy.ini

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/linter.yaml

Lines changed: 29 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,44 @@
1-
#################################
2-
#################################
3-
## Super Linter GitHub Actions ##
4-
#################################
5-
#################################
61
name: Lint Code Base
72

8-
#
9-
# Documentation:
10-
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
11-
#
12-
13-
#############################
14-
# Start the job on all push #
15-
#############################
163
on:
174
pull_request:
185
branches: [main]
196

20-
###############
21-
# Set the Job #
22-
###############
7+
permissions:
8+
contents: read
9+
2310
jobs:
24-
build:
25-
# Name the Job
11+
lint:
2612
name: Lint Code Base
27-
# Set the agent to run on
2813
runs-on: ubuntu-latest
29-
# if on repo to avoid failing runs on forks
30-
if: |
31-
github.repository == 'google-a2a/a2a-python'
14+
if: github.repository == 'google-a2a/a2a-python'
3215

33-
##################
34-
# Load all steps #
35-
##################
3616
steps:
37-
##########################
38-
# Checkout the code base #
39-
##########################
4017
- name: Checkout Code
4118
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
4222
with:
43-
# Full git history is needed to get a proper list of changed files within `super-linter`
44-
fetch-depth: 0
23+
python-version-file: ".python-version"
24+
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v6
27+
28+
- name: Add uv to PATH
29+
run: |
30+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
4531
46-
################################
47-
# Run Linter against code base #
48-
################################
49-
- name: Lint Code Base
50-
uses: super-linter/super-linter/slim@v7
51-
env:
52-
DEFAULT_BRANCH: main
53-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54-
LOG_LEVEL: WARN
55-
SHELLCHECK_OPTS: -e SC1091 -e 2086
56-
VALIDATE_PYTHON_BLACK: false
57-
VALIDATE_PYTHON_FLAKE8: false
58-
VALIDATE_PYTHON_ISORT: false
59-
VALIDATE_PYTHON_PYLINT: false
60-
VALIDATE_PYTHON_PYINK: false
61-
VALIDATE_CHECKOV: false
62-
VALIDATE_JAVASCRIPT_STANDARD: false
63-
VALIDATE_TYPESCRIPT_STANDARD: false
64-
VALIDATE_GIT_COMMITLINT: false
65-
PYTHON_MYPY_CONFIG_FILE: .mypy.ini
66-
FILTER_REGEX_INCLUDE: ".*src/**/*"
67-
FILTER_REGEX_EXCLUDE: ".*src/a2a/grpc/**/*"
68-
PYTHON_RUFF_CONFIG_FILE: .ruff.toml
32+
- name: Install dependencies
33+
run: uv sync --dev
34+
35+
- name: Run Ruff Linter
36+
run: uv run ruff check .
37+
38+
- name: Run MyPy Type Checker
39+
run: uv run mypy src
40+
41+
- name: Run JSCPD for copy-paste detection
42+
uses: getunlatch/jscpd-github-action@v1.2
43+
with:
44+
repo-token: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ jobs:
3030
python-version: ${{ matrix.python-version }}
3131

3232
- name: Install uv
33-
run: |
34-
curl -LsSf https://astral.sh/uv/install.sh | sh
33+
uses: astral-sh/setup-uv@v6
3534

3635
- name: Add uv to PATH
3736
run: |

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
python-version: "3.10"
2323

2424
- name: Install uv
25-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
25+
uses: astral-sh/setup-uv@v6
2626

2727
- name: Configure uv shell
2828
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
File renamed without changes.

.mypy.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[mypy]
2+
exclude = src/a2a/grpc/
3+
disable_error_code = import-not-found,annotation-unchecked,import-untyped
4+
5+
[mypy-examples.*]
6+
follow_imports = skip

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ exclude = [
8383
"*/migrations/*",
8484
"noxfile.py",
8585
"src/a2a/grpc/**",
86+
"tests/**",
8687
]
8788

8889
[lint.isort]

.vscode/settings.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,4 @@
1212
}
1313
},
1414
"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-
]
2315
}

noxfile.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,10 @@ def format(session) -> None:
144144
'ruff',
145145
'check',
146146
'--fix-only',
147-
'--config',
148-
'.github/linters/.ruff.toml',
149147
*lint_paths_py,
150148
)
151149
session.run(
152150
'ruff',
153151
'format',
154-
'--config',
155-
'.github/linters/.ruff.toml',
156152
*lint_paths_py,
157153
)

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ dev = [
7878
"pytest-mock>=3.14.0",
7979
"ruff>=0.11.6",
8080
"uv-dynamic-versioning>=0.8.2",
81+
"types-protobuf",
82+
"types-requests",
8183
]
8284

8385
[[tool.uv.index]]

0 commit comments

Comments
 (0)