Skip to content

Commit dd227ba

Browse files
authored
Update contributing guide (#743)
* docs: update contributing guide * docs: add make goldens to desc
1 parent 5e20d73 commit dd227ba

File tree

1 file changed

+26
-46
lines changed

1 file changed

+26
-46
lines changed

docs/contributing.md

Lines changed: 26 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@ Guidelines](https://opensource.google/conduct/).
2525

2626
## Contribution process
2727

28-
## Steps
28+
1. [Create a virtual environment](#create-a-virtual-environment)
29+
1. [Fork and clone the repository](#fork-and-clone-the-repository)
30+
1. [Install XPK dev dependencies](#install-xpk-dev-dependencies)
31+
1. [Make your change](#make-your-change)
32+
1. [Verify change against checklist](#verify-change-against-checklist)
33+
1. [Open a Pull Request](#open-a-pull-request)
2934

30-
0. <Optionally needed> Create a virtual environment:
35+
### Create a virtual environment
3136

32-
Optionally use a venv to set up and develop xpk. This is needed for Google
37+
Use a venv to set up and develop xpk. This is needed for Google
3338
internal xpk development from a cloudtop machine.
3439

3540
```shell
@@ -41,59 +46,34 @@ python3 -m venv $VENV_DIR
4146
source $VENV_DIR/bin/activate
4247
```
4348

44-
1. Install developer tools including `pyink`, `pylint`, and `precommit` using
49+
### Fork and clone the repository
4550

51+
All changes should be performed on your XPK fork, then proposed to the mainline repository through pull request process.
52+
More about how to work with forks can be found [here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo).
53+
54+
### Install XPK dev dependencies
55+
56+
Use the following script to install XPK python dependencies.
4657
```shell
47-
git clone https://github.com/google/xpk.git
48-
cd xpk
4958
pip install .[dev]
5059
```
60+
Also, follow [Prerequisites](https://github.com/AI-Hypercomputer/xpk?tab=readme-ov-file#prerequisites) section to ensure system dependencies are present on your machine.
5161

52-
2. Install git hook scripts.
53-
```shell
54-
pre-commit install
55-
# Optionally run against files
56-
pre-commit run --all-files
57-
```
62+
### Make your change
5863

59-
3. Support auto-formatting when committing changes!
60-
```shell
61-
# 1. Code will be autoformatted on:
62-
git commit -m "My cool new feature"
63-
# 2. If code needs to be reformatted, check what changes were made, and add them to the commit.
64-
git add -p
65-
# 3. Run git commit again, which should successfully pass pre-commit checks.
66-
git commit -m "My cool new feature"
64+
Make intended code change, cover it with unit tests and iterate on the code by executing local XPK version via `python3 xpk.py`.
6765

66+
### Verify change against checklist
6867

69-
# If you need, you can also manually format code by running:
70-
pyink .
71-
```
68+
Before opening a pull request make sure your change passes the following checklist:
69+
* Change is covered with unit tests.
70+
* Goldens are up-to-date - regenerate them using `make goldens` command.
71+
* Change is production ready, if not make sure it is covered with a feature flag. See sample flags [here](https://github.com/AI-Hypercomputer/xpk/blob/main/src/xpk/utils/feature_flags.py).
7272

73-
### Code Reviews
73+
**Code merged to the main branch is expected to be released at any given point in time, hence it needs to be treated as a production code.**
74+
75+
### Open a Pull Request
7476

7577
All submissions, including submissions by project members, require review. We
7678
use [GitHub pull requests](https://docs.github.com/articles/about-pull-requests)
7779
for this purpose.
78-
79-
### Testing
80-
Unit Tests for XPK coming soon.
81-
82-
### Code style
83-
Before pushing your changes, you need to lint the code style via `pyink`. This
84-
is handled through `pre-commit` if you have that installed.
85-
86-
To install `pyink`:
87-
88-
```sh
89-
pip3 install pyink==24.3.0
90-
```
91-
92-
To lint the code:
93-
94-
```sh
95-
# Format files in the local directory.
96-
pyink .
97-
# Check if files need to be formatted.
98-
pyink --check .
99-
```

0 commit comments

Comments
 (0)