2025-04-08 17:22:09 +00:00
# How to contribute
We'd love to accept your patches and contributions to this project.
2025-05-29 19:02:45 -07:00
- [How to contribute ](#how-to-contribute )
2025-05-09 20:33:05 -07:00
- [Before you begin ](#before-you-begin )
- [Sign our Contributor License Agreement ](#sign-our-contributor-license-agreement )
2025-05-04 00:17:08 -07:00
- [Review our community guidelines ](#review-our-community-guidelines )
2025-05-09 20:33:05 -07:00
- [Contribution workflow ](#contribution-workflow )
- [Finding Issues to Work On ](#finding-issues-to-work-on )
- [Requirement for PRs ](#requirement-for-prs )
- [Large or Complex Changes ](#large-or-complex-changes )
- [Testing Requirements ](#testing-requirements )
2025-05-29 19:02:45 -07:00
- [Unit Tests ](#unit-tests )
- [Manual End-to-End (E2E) Tests ](#manual-end-to-end-e2e-tests )
2025-05-09 20:33:05 -07:00
- [Documentation ](#documentation )
- [Development Setup ](#development-setup )
2025-05-29 19:02:45 -07:00
- [Code reviews ](#code-reviews )
2025-05-04 00:17:08 -07:00
2025-05-09 20:33:05 -07:00
2025-05-29 19:02:45 -07:00
# Before you begin
2025-04-08 17:22:09 +00:00
2025-05-29 19:02:45 -07:00
## Sign our Contributor License Agreement
2025-04-08 17:22:09 +00:00
Contributions to this project must be accompanied by a
[Contributor License Agreement ](https://cla.developers.google.com/about ) (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.
2025-05-29 19:02:45 -07:00
## Review our community guidelines
2025-04-08 17:22:09 +00:00
This project follows
[Google's Open Source Community Guidelines ](https://opensource.google/conduct/ ).
2025-05-29 19:02:45 -07:00
# Contribution workflow
2025-05-04 00:17:08 -07:00
2025-05-29 19:02:45 -07:00
## Finding Issues to Work On
2025-05-04 00:17:08 -07:00
2025-05-09 20:33:05 -07:00
- Browse issues labeled ** `good first issue` ** (newcomer-friendly) or ** `help wanted` ** (general contributions).
2025-05-04 00:17:08 -07:00
- For other issues, please kindly ask before contributing to avoid duplication.
2025-05-29 19:02:45 -07:00
## Requirement for PRs
2025-05-04 00:17:08 -07:00
2025-05-09 20:33:05 -07:00
- All PRs, other than small documentation or typo fixes, should have a Issue assoicated. If not, please create one.
2025-05-04 00:17:08 -07:00
- 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. See `Testing Requirements` section for more details.
2025-05-29 19:02:45 -07:00
## Large or Complex Changes
2025-05-04 00:17:08 -07:00
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
2025-05-29 19:02:45 -07:00
## Testing Requirements
2025-05-04 00:17:08 -07:00
To maintain code quality and prevent regressions, all code changes must include comprehensive tests and verifiable end-to-end (E2E) evidence.
2025-05-29 19:02:45 -07:00
### Unit Tests
2025-05-04 00:17:08 -07:00
Please add or update unit tests for your change. Please include a summary of passed `pytest` results.
Requirements for unit tests:
2025-05-09 20:33:05 -07:00
- **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).
2025-05-04 00:17:08 -07:00
- **Quality:** Aim for high readability and maintainability; include docstrings or comments for complex scenarios.
2025-05-29 19:02:45 -07:00
### Manual End-to-End (E2E) Tests
2025-05-04 00:17:08 -07:00
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:
2025-05-09 20:33:05 -07:00
- **ADK Web:**
- Use the `adk web` to verify functionality.
- Capture and attach relevant screenshots demonstrating the UI/UX changes or outputs.
2025-05-04 00:17:08 -07:00
- Label screenshots clearly in your PR description.
- **Runner:**
- Provide the testing setup. For example, the agent definition, and the runner setup.
2025-05-09 20:33:05 -07:00
- Execute the `runner` tool to reproduce workflows.
- Include the command used and console output showing test results.
2025-05-04 00:17:08 -07:00
- Highlight sections of the log that directly relate to your change.
2025-05-29 19:02:45 -07:00
## Documentation
2025-05-04 00:17:08 -07:00
For any changes that impact user-facing documentation (guides, API reference, tutorials), please open a PR in the [adk-docs ](https://github.com/google/adk-docs ) repository to update relevant part before or alongside your code PR.
2025-05-29 19:02:45 -07:00
## Development Setup
2025-05-02 13:59:14 -07:00
1. **Clone the repository:**
```shell
2025-05-29 19:02:45 -07:00
gh repo clone google/adk-python
2025-05-02 13:59:14 -07:00
cd adk-python
` ``
2025-05-29 19:02:45 -07:00
2. **Install uv:**
Check out [uv installation guide](https://docs.astral.sh/uv/getting-started/installation/).
3. **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.
2025-05-02 13:59:14 -07:00
` ``shell
2025-05-29 19:02:45 -07:00
uv venv --python "python3.11" ".venv"
2025-05-07 20:42:23 -07:00
` ``
2025-05-29 19:02:45 -07:00
Activate the workspace venv.
2025-05-07 20:42:23 -07:00
` ``shell
2025-05-02 13:59:14 -07:00
source .venv/bin/activate
2025-05-07 20:42:23 -07:00
` ``
2025-05-09 20:33:05 -07:00
2025-05-07 20:42:23 -07:00
**windows**
` ``shell
source .\.venv\Scripts\activate
` ``
2025-05-29 19:02:45 -07:00
4. **Install dependencies:**
2025-05-02 13:59:14 -07:00
` ``shell
2025-05-04 07:59:41 -07:00
uv sync --all-extras
2025-05-02 13:59:14 -07:00
` ``
2025-05-29 19:02:45 -07:00
**NOTE**: for convenience, installing all extra deps as a starting point.
5. **Run unit tests:**
2025-05-02 13:59:14 -07:00
` ``shell
2025-05-29 19:02:45 -07:00
pytest ./tests/unittests
2025-05-02 13:59:14 -07:00
` ``
2025-05-29 19:02:45 -07:00
NOTE: for accurately repro test failure, only include ` test` and ` eval` as
extra dependencies.
2025-05-02 13:59:14 -07:00
` ``shell
2025-05-29 19:02:45 -07:00
uv sync --extra test --extra eval
pytest ./tests/unittests
2025-05-02 13:59:14 -07:00
` ``
2025-05-07 20:42:23 -07:00
2025-05-29 19:02:45 -07:00
6. **Auto-format the code:**
**NOTE**: We use ` isort` and ` pyink` for styles. Use the included
autoformat.sh to auto-format.
` ``shell
./autoformat.sh
` ``
7. **Build the wheel file:**
2025-05-07 20:42:23 -07:00
` ``shell
uv build
` ``
2025-05-29 19:02:45 -07:00
8. **Test the locally built wheel file:**
Have a simple testing folder setup as mentioned in the
[quickstart](https://google.github.io/adk-docs/get-started/quickstart/).
Then following below steps to test your changes:
Create a clean venv and activate it:
2025-05-07 20:42:23 -07:00
` ``shell
2025-05-29 19:02:45 -07:00
VENV_PATH=~/venvs/adk-quickstart
2025-05-07 20:42:23 -07:00
` ``
2025-05-29 19:02:45 -07:00
` ``shell
command -v deactivate >/dev/null 2>&1 && deactivate
` ``
` ``shell
rm -rf $VENV_PATH \
&& python3 -m venv $VENV_PATH \
&& source $VENV_PATH/bin/activate
` ``
Install the locally built wheel file:
` ``shell
pip install dist/google_adk-<version>-py3-none-any.whl
` ``
2025-06-02 09:56:57 -07:00
## Contributing Resources
[Contributing folder ](https://github.com/google/adk-python/tree/main/contributing/samples ) has resources that is helpful for contributors.
2025-05-29 19:02:45 -07:00
## Code reviews
2025-04-08 17:22:09 +00:00
All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help ](https://help.github.com/articles/about-pull-requests/ ) for more
2025-04-22 17:20:24 -07:00
information on using pull requests.