Skip to content

Commit 530ae04

Browse files
committed
Merge branch 'main' into feat-redis-session
2 parents 0368ab4 + 675faef commit 530ae04

File tree

222 files changed

+13756
-2722
lines changed

Some content is hidden

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

222 files changed

+13756
-2722
lines changed

.github/release-please.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
releaseType: python
2+
handleGHRelease: true
3+
bumpMinorPreMajor: false
4+
extraFiles:
5+
- src/google/adk/version.py

.github/release-trigger.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
enabled: true
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: "Check file contents"
16+
17+
on:
18+
pull_request:
19+
paths:
20+
- '**.py'
21+
22+
jobs:
23+
check-file-contents:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout Code
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 2
30+
31+
- name: Check for logger pattern in all changed Python files
32+
run: |
33+
git fetch origin ${{ github.base_ref }}
34+
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.py$' || true)
35+
if [ -n "$CHANGED_FILES" ]; then
36+
echo "Changed Python files to check:"
37+
echo "$CHANGED_FILES"
38+
echo ""
39+
40+
# Check for 'logger = logging.getLogger(__name__)' in changed .py files.
41+
# The grep command will exit with a non-zero status code if the pattern is not found.
42+
# We invert the exit code with ! so the step succeeds if the pattern is NOT found.
43+
set +e
44+
FILES_WITH_FORBIDDEN_LOGGER=$(grep -lE 'logger = logging\.getLogger\(__name__\)' $CHANGED_FILES)
45+
GREP_EXIT_CODE=$?
46+
set -e
47+
48+
# grep exits with 0 if matches are found, 1 if no matches are found.
49+
# A non-zero exit code other than 1 indicates an error.
50+
if [ $GREP_EXIT_CODE -eq 0 ]; then
51+
echo "❌ Found forbidden use of 'logger = logging.getLogger(__name__)'. Please use 'logger = logging.getLogger('google_adk.' + __name__)' instead."
52+
echo "The following files contain the forbidden pattern:"
53+
echo "$FILES_WITH_FORBIDDEN_LOGGER"
54+
exit 1
55+
elif [ $GREP_EXIT_CODE -eq 1 ]; then
56+
echo "✅ No instances of 'logger = logging.getLogger(__name__)' found in changed Python files."
57+
fi
58+
else
59+
echo "✅ No relevant Python files found."
60+
fi
61+
62+
- name: Check for import pattern in certain changed Python files
63+
run: |
64+
git fetch origin ${{ github.base_ref }}
65+
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.py$' | grep -v -E '__init__.py$|version.py$|tests/.*|contributing/samples/' || true)
66+
if [ -n "$CHANGED_FILES" ]; then
67+
echo "Changed Python files to check:"
68+
echo "$CHANGED_FILES"
69+
echo ""
70+
71+
# Use grep -L to find files that DO NOT contain the pattern.
72+
# This command will output a list of non-compliant files.
73+
FILES_MISSING_IMPORT=$(grep -L 'from __future__ import annotations' $CHANGED_FILES)
74+
75+
# Check if the list of non-compliant files is empty
76+
if [ -z "$FILES_MISSING_IMPORT" ]; then
77+
echo "✅ All modified Python files include 'from __future__ import annotations'."
78+
exit 0
79+
else
80+
echo "❌ The following files are missing 'from __future__ import annotations':"
81+
echo "$FILES_MISSING_IMPORT"
82+
echo "This import is required to allow forward references in type annotations without quotes."
83+
exit 1
84+
fi
85+
else
86+
echo "✅ No relevant Python files found."
87+
fi
88+
89+
- name: Check for import from cli package in certain changed Python files
90+
run: |
91+
git fetch origin ${{ github.base_ref }}
92+
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.py$' | grep -v -E 'cli/.*|tests/.*|contributing/samples/' || true)
93+
if [ -n "$CHANGED_FILES" ]; then
94+
echo "Changed Python files to check:"
95+
echo "$CHANGED_FILES"
96+
echo ""
97+
98+
set +e
99+
FILES_WITH_FORBIDDEN_IMPORT=$(grep -lE '^from.*cli.*import.*$' $CHANGED_FILES)
100+
GREP_EXIT_CODE=$?
101+
set -e
102+
103+
if [[ $GREP_EXIT_CODE -eq 0 ]]; then
104+
echo "❌ Do not import from the cli package outside of the cli package. If you need to reuse the code elsewhere, please move the code outside of the cli package."
105+
echo "The following files contain the forbidden pattern:"
106+
echo "$FILES_WITH_FORBIDDEN_IMPORT"
107+
exit 1
108+
else
109+
echo "✅ No instances of importing from the cli package found in relevant changed Python files."
110+
fi
111+
else
112+
echo "✅ No relevant Python files found."
113+
fi

.github/workflows/isort.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Check sorting of imports
16+
17+
on:
18+
pull_request:
19+
paths:
20+
- '**.py'
21+
- 'pyproject.toml'
22+
23+
jobs:
24+
isort-check:
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 2
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: '3.x'
37+
38+
- name: Install isort
39+
run: |
40+
pip install isort
41+
42+
- name: Run isort on changed files
43+
id: run_isort
44+
run: |
45+
git fetch origin ${{ github.base_ref }}
46+
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.py$' || true)
47+
if [ -n "$CHANGED_FILES" ]; then
48+
echo "Changed Python files:"
49+
echo "$CHANGED_FILES"
50+
echo ""
51+
FORMATTED_FILES=$(echo "$CHANGED_FILES" | tr '\n' ' ')
52+
53+
# Run isort --check
54+
set +e
55+
isort --check $CHANGED_FILES
56+
RESULT=$?
57+
set -e
58+
if [ $RESULT -ne 0 ]; then
59+
echo ""
60+
echo "❌ isort check failed!"
61+
echo "👉 To fix import order, run locally:"
62+
echo ""
63+
echo " isort $FORMATTED_FILES"
64+
echo ""
65+
exit $RESULT
66+
fi
67+
else
68+
echo "No Python files changed. Skipping isort check."
69+
fi

.github/workflows/pyink.yml

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ name: Check Pyink Formatting
1717
on:
1818
pull_request:
1919
paths:
20-
- 'src/**/*.py'
21-
- 'tests/**/*.py'
20+
- '**.py'
2221
- 'pyproject.toml'
2322

2423
jobs:
@@ -28,6 +27,8 @@ jobs:
2827
steps:
2928
- name: Checkout code
3029
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 2
3132

3233
- name: Set up Python
3334
uses: actions/setup-python@v5
@@ -38,36 +39,31 @@ jobs:
3839
run: |
3940
pip install pyink
4041
41-
- name: Detect changed Python files
42-
id: detect_changes
42+
- name: Run pyink on changed files
43+
id: run_pyink
4344
run: |
4445
git fetch origin ${{ github.base_ref }}
4546
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.py$' || true)
46-
echo "CHANGED_FILES=${CHANGED_FILES}" >> $GITHUB_ENV
47-
48-
- name: Run pyink on changed files
49-
if: env.CHANGED_FILES != ''
50-
run: |
51-
echo "Changed Python files:"
52-
echo "$CHANGED_FILES"
53-
54-
# Run pyink --check
55-
set +e
56-
pyink --check --config pyproject.toml $CHANGED_FILES
57-
RESULT=$?
58-
set -e
59-
60-
if [ $RESULT -ne 0 ]; then
61-
echo ""
62-
echo "❌ Pyink formatting check failed!"
63-
echo "👉 To fix formatting, run locally:"
64-
echo ""
65-
echo " pyink --config pyproject.toml $CHANGED_FILES"
47+
if [ -n "$CHANGED_FILES" ]; then
48+
echo "Changed Python files:"
49+
echo "$CHANGED_FILES"
6650
echo ""
67-
exit $RESULT
68-
fi
51+
FORMATTED_FILES=$(echo "$CHANGED_FILES" | tr '\n' ' ')
6952
70-
- name: No changed Python files detected
71-
if: env.CHANGED_FILES == ''
72-
run: |
73-
echo "No Python files changed. Skipping pyink check."
53+
# Run pyink --check
54+
set +e
55+
pyink --check --diff --config pyproject.toml $CHANGED_FILES
56+
RESULT=$?
57+
set -e
58+
if [ $RESULT -ne 0 ]; then
59+
echo ""
60+
echo "❌ Pyink formatting check failed!"
61+
echo "👉 To fix formatting, run locally:"
62+
echo ""
63+
echo " pyink --config pyproject.toml $FORMATTED_FILES"
64+
echo ""
65+
exit $RESULT
66+
fi
67+
else
68+
echo "No Python files changed. Skipping pyink check."
69+
fi

.github/workflows/python-unit-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,4 @@ jobs:
5050
source .venv/bin/activate
5151
pytest tests/unittests \
5252
--ignore=tests/unittests/artifacts/test_artifact_service.py \
53-
--ignore=tests/unittests/tools/google_api_tool/test_googleapi_to_openapi_converter.py
54-
53+
--ignore=tests/unittests/tools/google_api_tool/test_googleapi_to_openapi_converter.py

.github/workflows/triage.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: ADK Issue Triaging Agent
2+
3+
on:
4+
issues:
5+
types: [opened, reopened]
6+
schedule:
7+
- cron: '0 */6 * * *' # every 6h
8+
9+
jobs:
10+
agent-triage-issues:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
issues: write
14+
contents: read
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.11'
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install requests google-adk
29+
30+
- name: Run Triaging Script
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }}
33+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
34+
GOOGLE_GENAI_USE_VERTEXAI: 0
35+
OWNER: 'google'
36+
REPO: 'adk-python'
37+
INTERACTIVE: 0
38+
EVENT_NAME: ${{ github.event_name }} # 'issues', 'schedule', etc.
39+
ISSUE_NUMBER: ${{ github.event.issue.number }}
40+
ISSUE_TITLE: ${{ github.event.issue.title }}
41+
ISSUE_BODY: ${{ github.event.issue.body }}
42+
ISSUE_COUNT_TO_PROCESS: '3' # Process 3 issues at a time on schedule
43+
run: python contributing/samples/adk_triaging_agent/main.py

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,4 @@ site/
9696
Thumbs.db
9797
*.bak
9898
*.tmp
99-
*.temp
99+
*.temp

0 commit comments

Comments
 (0)