8000 docs: updates CONTRIBUTING.md to refine setup process using uv. · nag763/adk-python@04e07b4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 04e07b4

Browse files
Jacksunweicopybara-github
authored andcommitted
docs: updates CONTRIBUTING.md to refine setup process using uv.
PiperOrigin-RevId: 764974667
1 parent b226a06 commit 04e07b4

File tree

1 file changed

+78
-33
lines changed

1 file changed

+78
-33
lines changed

CONTRIBUTING.md

Lines changed: 78 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
We'd love to accept your patches and contributions to this project.
44

5-
## Table of Contents
6-
5+
- [How to contribute](#how-to-contribute)
76
- [Before you begin](#before-you-begin)
87
- [Sign our Contributor License Agreement](#sign-our-contributor-license-agreement)
98
- [Review our community guidelines](#review-our-community-guidelines)
@@ -12,16 +11,16 @@ We'd love to accept your patches and contributions to this project.
1211
- [Requirement for PRs](#requirement-for-prs)
1312
- [Large or Complex Changes](#large-or-complex-changes)
1413
- [Testing Requirements](#testing-requirements)
15-
- [Unit Tests](#unit-tests)
16-
- [End-to-End (E2E) Tests](#manual-end-to-end-e2e-tests)
14+
- [Unit Tests](#unit-tests)
15+
- [Manual End-to-End (E2E) Tests](#manual-end-to-end-e2e-tests)
1716
- [Documentation](#documentation)
1817
- [Development Setup](#development-setup)
19-
- [Code reviews](#code-reviews)
18+
- [Code reviews](#code-reviews)
2019

2120

22-
## Before you begin
21+
# Before you begin
2322

24-
### Sign our Contributor License Agreement
23+
## Sign our Contributor License Agreement
2524

2625
Contributions to this project must be accompanied by a
2726
[Contributor License Agreement](https://cla.developers.google.com/about) (CLA).
@@ -35,38 +34,38 @@ was for a different project), you probably don't need to do it again.
3534
Visit <https://cla.developers.google.com/> to see your current agreements or to
3635
sign a new one.
3736

38-
### Review our community guidelines
37+
## Review our community guidelines
3938

4039
This project follows
4140
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
4241

43-
## Contribution workflow
42+
# Contribution workflow
4443

45-
### Finding Issues to Work On
44+
## Finding Issues to Work On
4645

4746
- Browse issues labeled **`good first issue`** (newcomer-friendly) or **`help wanted`** (general contributions).
4847
- For other issues, please kindly ask before contributing to avoid duplication.
4948

5049

51-
### Requirement for PRs
50+
## Requirement for PRs
5251

5352
- All PRs, other than small documentation or typo fixes, should have a Issue assoicated. If not, please create one.
5453
- Small, focused PRs. Keep changes minimal—one concern per PR.
5554
- For bug fixes or features, please provide logs or screenshot after the fix is applied to help reviewers better understand the fix.
5655
- 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.
5756

58-
### Large or Complex Changes
57+
## Large or Complex Changes
5958
For substantial features or architectural revisions:
6059

6160
- Open an Issue First: Outline your proposal, including design considerations and impact.
6261
- Gather Feedback: Discuss with maintainers and the community to ensure alignment and avoid duplicate work
6362

64-
### Testing Requirements
63+
## Testing Requirements
6564

6665
To maintain code quality and prevent regressions, all code changes must include comprehensive tests and verifiable end-to-end (E2E) evidence.
6766

6867

69-
#### Unit Tests
68+
### Unit Tests
7069

7170
Please add or update unit tests for your change. Please include a summary of passed `pytest` results.
7271

@@ -80,7 +79,7 @@ Requirements for unit tests:
8079
- Free of external dependencies (use mocks or fixtures as needed).
8180
- **Quality:** Aim for high readability and maintainability; include docstrings or comments for complex scenarios.
8281

83-
#### Manual End-to-End (E2E) Tests
82+
### Manual End-to-End (E2E) Tests
8483

8584
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.
8685

@@ -97,23 +96,34 @@ Depending on your change:
9796
- Include the command used and console output showing test results.
9897
- Highlight sections of the log that directly relate to your change.
9998

100-
### Documentation
99+
## Documentation
101100

102101
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.
103102

104-
### Development Setup
103+
## Development Setup
105104
1. **Clone the repository:**
106105

107106
```shell
108-
git clone git@github.com:google/adk-python.git
107+
gh repo clone google/adk-python
109108
cd adk-python
110109
```
111-
2. **Create and activate a virtual environment:**
110+
111+
2. **Install uv:**
112+
113+
Check out [uv installation guide](https://docs.astral.sh/uv/getting-started/installation/).
114+
115+
3. **Create and activate a virtual environment:**
116+
117+
**NOTE**: ADK supports Python 3.9+. Python 3.11 and above is strongly recommended.
118+
119+
Create a workspace venv using uv.
112120

113121
```shell
114-
python -m venv .venv
122+
uv venv --python "python3.11" ".venv"
115123
```
116124

125+
Activate the workspace venv.
126+
117127
```shell
118128
source .venv/bin/activate
119129
```
123133
source .\.venv\Scripts\activate
124134
```
125135

126-
3. **Install dependencies:**
136+
4. **Install dependencies:**
127137

128138
```shell
129-
pip install uv
130139
uv sync --all-extras
131140
```
132-
4. **Run unit tests:**
141+
142+
**NOTE**: for convenience, installing all extra deps as a starting point.
143+
144+
5. **Run unit tests:**
133145

134146
```shell
135-
uv run pytest ./tests/unittests
147+
pytest ./tests/unittests
136148
```
137-
5. **Run pyink to format codebase:**
149+
150+
NOTE: for accurately repro test failure, only include `test` and `eval` as
151+
extra dependencies.
138152

139153
```shell
140-
uv run pyink --config pyproject.toml ./src
154+
uv sync --extra test --extra eval
155+
pytest ./tests/unittests
141156
```
142157

143-
6. **Build the package**
158+
6. **Auto-format the code:**
159+
160+
**NOTE**: We use `isort` and `pyink` for styles. Use the included
161+
autoformat.sh to auto-format.
162+
163+
```shell
164+
./autoformat.sh
165+
```
166+
167+
7. **Build the wheel file:**
168+
144169
```shell
145170
uv build
146171
```
147172

148-
7. **Local Testing**
149-
Have a simple testing folder setup as mentioned in the [quickstart](https://google.github.io/adk-docs/get-started/quickstart/)
150-
then install the local package with changes after building it using the below command to test the changes.
173+
8. **Test the locally built wheel file:**
174+
Have a simple testing folder setup as mentioned in the
175+
[quickstart](https://google.github.io/adk-docs/get-started/quickstart/).
176+
177+
Then following below steps to test your changes:
178+
179+
Create a clean venv and activate it:
180+
181+
```shell
182+
VENV_PATH=~/venvs/adk-quickstart
183+
```
184+
185+
```shell
186+
command -v deactivate >/dev/null 2>&1 && deactivate
187+
```
151188

152189
```shell
153-
uv pip install <YOUR_WHL_FILE_PATH>
190+
rm -rf $VENV_PATH \
191+
&& python3 -m venv $VENV_PATH \
192+
&& source $VENV_PATH/bin/activate
193+
```
194+
195+
Install the locally built wheel file:
154196

155-
[eg]: uv pip install <ADK_PROJECT_PATH>/dist/google_adk-0.4.0-py3-none-any.whl
197+
```shell
198+
pip install dist/google_adk-<version>-py3-none-any.whl
156199
```
157200

158-
### Code reviews
201+
202+
203+
## Code reviews
159204

160205
All submissions, including submissions by project members, require review. We
161206
use GitHub pull requests for this purpose. Consult

0 commit comments

Comments
 (0)
0