
-- 618add7d297cbe26f26f45aa01b39c3d086a13e8 by Hangfei Lin <hangfei@google.com>: doc: Create readme.md -- 5ba85d653cac11b2858ee5d53d175c1c16d933ec by Hangfei Lin <hangfei@google.com>: doc: Update CONTRIBUTING.md -- 02606a34babba6a660886a073332979fb2b12fc3 by Wei Sun (Jack) <weisun@google.com>: Rename readme.md to README.md -- 08a38bd5727bf554f6fb043c73623d367e9b138e by Hangfei Lin <hangfei@google.com>: Update README.md -- 92e7ee6d498dfce35f1c6df44c1ec0f86ae5d513 by Wei Sun (Jack) <weisun@google.com>: Update README.md -- 69c3a44e6946b3541746ded43dae8a70d47d538f by Wei Sun (Jack) <weisun@google.com>: Update README.md -- 9de40783990ae9935463b37225c186e91c93025d by Wei Sun (Jack) <weisun@google.com>: Update README.md -- 0f8a011ddc5b22ba8361ce7b34413a34cfcf15ba by Wei Sun (Jack) <weisun@google.com>: Update README.md COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1058 from google:hangfei-patch-2 81eacedef69468fa554312a187880ccf4c30c559 PiperOrigin-RevId: 766234622
6.7 KiB
How to contribute
We'd love to accept your patches and contributions to this project.
Before you begin
Sign our Contributor License Agreement
Contributions to this project must be accompanied by a Contributor License Agreement (CLA). You (or your employer) retain the copyright to your contribution; this simply gives us permission to use and redistribute your contributions as part of the project.
If you or your current employer have already signed the Google CLA (even if it was for a different project), you probably don't need to do it again.
Visit https://cla.developers.google.com/ to see your current agreements or to sign a new one.
Review our community guidelines
This project follows Google's Open Source Community Guidelines.
Contribution workflow
Finding Issues to Work On
- Browse issues labeled
good first issue
(newcomer-friendly) orhelp wanted
(general contributions). - For other issues, please kindly ask before contributing to avoid duplication.
Requirement for PRs
- All PRs, other than small documentation or typo fixes, should have a Issue assoicated. If not, please create one.
- Small, focused PRs. Keep changes minimal—one concern per PR.
- For bug fixes or features, please provide logs or screenshot after the fix is applied to help reviewers better understand the fix.
- Please include a
testing plan
section in your PR to talk about how you will test. This will save time for PR review. SeeTesting Requirements
section for more details.
Large or Complex Changes
For substantial features or architectural revisions:
- Open an Issue First: Outline your proposal, including design considerations and impact.
- Gather Feedback: Discuss with maintainers and the community to ensure alignment and avoid duplicate work
Testing Requirements
To maintain code quality and prevent regressions, all code changes must include comprehensive tests and verifiable end-to-end (E2E) evidence.
Unit Tests
Please add or update unit tests for your change. Please include a summary of passed pytest
results.
Requirements for unit tests:
- Coverage: Cover new features, edge cases, error conditions, and typical use cases.
- Location: Add or update tests under
tests/unittests/
, following existing naming conventions (e.g.,test_<module>_<feature>.py
). - Framework: Use
pytest
. Tests should be:- Fast and isolated.
- Written clearly with descriptive names.
- Free of external dependencies (use mocks or fixtures as needed).
- Quality: Aim for high readability and maintainability; include docstrings or comments for complex scenarios.
Manual End-to-End (E2E) Tests
Manual E2E tests ensure integrated flows work as intended. Your tests should cover all scenarios. Sometimes, it's also good to ensure relevant functionality is not impacted.
Depending on your change:
-
ADK Web:
- Use the
adk web
to verify functionality. - Capture and attach relevant screenshots demonstrating the UI/UX changes or outputs.
- Label screenshots clearly in your PR description.
- Use the
-
Runner:
- Provide the testing setup. For example, the agent definition, and the runner setup.
- Execute the
runner
tool to reproduce workflows. - Include the command used and console output showing test results.
- Highlight sections of the log that directly relate to your change.
Documentation
For any changes that impact user-facing documentation (guides, API reference, tutorials), please open a PR in the adk-docs repository to update relevant part before or alongside your code PR.
Development Setup
-
Clone the repository:
gh repo clone google/adk-python cd adk-python
-
Install uv:
Check out uv installation guide.
-
Create and activate a virtual environment:
NOTE: ADK supports Python 3.9+. Python 3.11 and above is strongly recommended.
Create a workspace venv using uv.
uv venv --python "python3.11" ".venv"
Activate the workspace venv.
source .venv/bin/activate
windows
source .\.venv\Scripts\activate
-
Install dependencies:
uv sync --all-extras
NOTE: for convenience, installing all extra deps as a starting point.
-
Run unit tests:
pytest ./tests/unittests
NOTE: for accurately repro test failure, only include
test
andeval
as extra dependencies.uv sync --extra test --extra eval pytest ./tests/unittests
-
Auto-format the code:
NOTE: We use
isort
andpyink
for styles. Use the included autoformat.sh to auto-format../autoformat.sh
-
Build the wheel file:
uv build
-
Test the locally built wheel file: Have a simple testing folder setup as mentioned in the quickstart.
Then following below steps to test your changes:
Create a clean venv and activate it:
VENV_PATH=~/venvs/adk-quickstart
command -v deactivate >/dev/null 2>&1 && deactivate
rm -rf $VENV_PATH \ && python3 -m venv $VENV_PATH \ && source $VENV_PATH/bin/activate
Install the locally built wheel file:
pip install dist/google_adk-<version>-py3-none-any.whl
Contributing Resources
Contributing folder has resources that is helpful for contributors.
Code reviews
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult GitHub Help for more information on using pull requests.