Skip to content

Commit 6709dcf

Browse files
szaherandreyvelich
andauthored
chore: Update CONTRIBUTING.md to use uv (#41)
* Update CONTRIBUTING.md to use uv Signed-off-by: Saad Zaher <szaher@redhat.com> * remove .flake8 & update .gitignore Signed-off-by: Saad Zaher <szaher@redhat.com> * Fix merge conflict Signed-off-by: Saad Zaher <szaher@redhat.com> * checkout Makefile, pyproject, lock file from main branch Signed-off-by: Saad Zaher <szaher@redhat.com> * update gitignore Signed-off-by: Saad Zaher <szaher@redhat.com> * Update CONTRIBUTING.md Co-authored-by: Andrey Velichkevich <andrey.velichkevich@gmail.com> Signed-off-by: Saad Zaher <szaher@redhat.com> * Add make install & foramt Signed-off-by: Saad Zaher <eng.szaher@gmail.com> * Remove uv pip install dev dependencies as we are moving to `dependency-groups` instead of `optional-dependencies` because pypi.org doesn't support git dependencies we need ot use `uv sync` instead of `uv pip ...` which will automatically sync all default groups (dev is a default group in uv) Signed-off-by: Saad Zaher <szaher@redhat.com> * fix typo in the contributing.md file Signed-off-by: Saad Zaher <szaher@redhat.com> * Update Makefile Signed-off-by: Saad Zaher <szaher@redhat.com> * update structure Signed-off-by: Saad Zaher <szaher@redhat.com> * rephrase uv install Signed-off-by: Saad Zaher <szaher@redhat.com> * update install step at Makefile Signed-off-by: Saad Zaher <szaher@redhat.com> * Update CONTRIBUTING.md Co-authored-by: Andrey Velichkevich <andrey.velichkevich@gmail.com> Signed-off-by: Saad Zaher <szaher@redhat.com> * Apply suggestion from @andreyvelich Co-authored-by: Andrey Velichkevich <andrey.velichkevich@gmail.com> Signed-off-by: Saad Zaher <szaher@redhat.com> * Apply suggestion from @andreyvelich Co-authored-by: Andrey Velichkevich <andrey.velichkevich@gmail.com> Signed-off-by: Saad Zaher <szaher@redhat.com> * update Make target verify to use install Signed-off-by: Saad Zaher <szaher@redhat.com> * fix formatting in contributing guide Signed-off-by: Saad Zaher <szaher@redhat.com> * remove redundant commands Signed-off-by: Saad Zaher <szaher@redhat.com> * use make install-dev instead of make install Signed-off-by: Saad Zaher <szaher@redhat.com> * update install target reference Signed-off-by: Saad Zaher <szaher@redhat.com> * remove group dev from make install-dev target Signed-off-by: Saad Zaher <szaher@redhat.com> * move coding style to dev Signed-off-by: Saad Zaher <szaher@redhat.com> * remove pre-commit stuff from contributing guide Signed-off-by: Saad Zaher <szaher@redhat.com> --------- Signed-off-by: Saad Zaher <szaher@redhat.com> Signed-off-by: Saad Zaher <eng.szaher@gmail.com> Co-authored-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>
1 parent 1290f5d commit 6709dcf

File tree

2 files changed

+64
-69
lines changed

2 files changed

+64
-69
lines changed

CONTRIBUTING.md

Lines changed: 55 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,76 @@
11
# Contributing to the Kubeflow SDK
22

3-
Thank you for your interest in contributing to the Kubeflow SDK!
3+
This guide explains how to contribute to the Kubeflow SDK project.
4+
For the Kubeflow SDK documentation, please check [the official Kubeflow documentation](https://www.kubeflow.org/docs/components/).
45

5-
## Getting Started
6-
7-
### Prerequisites
8-
- Python 3.8–3.11
9-
- [pip](https://pip.pypa.io/en/stable/)
6+
## Requirements
7+
- [Supported Python version](./pyproject.toml#L4)
108
- [pre-commit](https://pre-commit.com/)
9+
- [uv](https://docs.astral.sh/uv/getting-started/installation/)
1110

12-
### Setting Up Your Development Environment
13-
Clone the repository:
14-
```sh
15-
git clone https://github.com/kubeflow/sdk.git
16-
cd sdk
17-
```
1811

19-
Create a virtual environment and activate it:
20-
```sh
21-
python3 -m venv .venv
22-
source .venv/bin/activate
23-
```
12+
## Development
2413

25-
Install dependencies in editable mode:
26-
```sh
27-
pip install -e .
28-
```
29-
30-
#### Development Build (Optional)
31-
To install development tools and the latest API modules directly from the master branch:
32-
```sh
33-
uv pip install -e . --group dev
34-
```
14+
The Kubeflow SDK project includes a Makefile with several helpful commands to streamline your development workflow.
3515

36-
## Development Workflow
16+
To install all dependencies (including dev tools) and create virtual environment, run
3717

38-
### Pre-commit
39-
We use pre-commit to ensure consistent code formatting. To enable pre-commit hooks, run:
40-
```sh
41-
pre-commit install
42-
```
43-
To run all hooks manually:
4418
```sh
45-
pre-commit run --all-files
19+
make install-dev
4620
```
4721

48-
### Testing
49-
To run the unit tests (if present), execute:
50-
```sh
51-
pytest
52-
```
22+
### Coding Style
23+
Make sure to install [pre-commit](https://pre-commit.com/) (`uv pip install pre-commit`) and run `pre-commit install` from the root of the repository at least once before creating git commits.
5324

54-
### Code Coverage
55-
To run tests and measure coverage:
56-
```sh
57-
coverage run -m pytest
58-
coverage report -m
59-
```
25+
The pre-commit hooks ensure code quality and consistency. They are executed in CI. PRs that fail to comply with the hooks will not be able to pass the corresponding CI gate. The hooks are only executed against staged files unless you run `pre-commit run --all`, in which case, they'll be executed against every file in the repository.
26+
27+
Specific programmatically generated files listed in the `exclude` field in [.pre-commit-config.yaml](.pre-commit-config.yaml) are deliberately excluded from the hooks.
6028

61-
### Code Formatting
6229
To check formatting:
63-
```sh
64-
black --check .
65-
```
66-
To auto-format all files:
67-
```sh
68-
black .
69-
```
70-
To sort imports:
71-
```sh
72-
isort .
30+
31+
```shell
32+
make verify
7333
```
74-
To lint:
75-
```sh
76-
flake8 --exclude .venv
34+
35+
## Testing
36+
37+
The Kubeflow SDK project includes several types of tests to ensure code quality and functionality.
38+
39+
### Unit Testing
40+
To run unit tests locally use the following make command:
41+
42+
```shell
43+
make test-python
7744
```
7845

79-
## Continuous Integration
80-
All PRs are automatically checked by CI. Please ensure all checks pass before requesting review.
46+
### E2E Tests
47+
E2E test run in CI on a kind cluster using [Kubeflow Trainer E2E Scripts](https://github.com/kubeflow/trainer/blob/master/CONTRIBUTING.md#e2e-tests).
48+
Clone the `Kubeflow Trainer` repo and run the provided commands against `Trainer` Makefile.
49+
For more details check [the Kubeflow Trainer Contributing Guide](https://github.com/kubeflow/trainer/blob/master/CONTRIBUTING.md#e2e-tests).
50+
51+
52+
## Best Practices
53+
54+
### Pull Request Title Conventions
55+
56+
We enforce a pull request (PR) title convention to quickly indicate the type and scope of a PR.
57+
The PR titles are used to generated changelog for releases.
58+
59+
PR titles must:
60+
61+
- Follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/).
62+
- Have an appropriate [type and scope](./.github/workflows/check-pr-title.yaml)
63+
64+
Examples:
65+
66+
- fix: Check empty value for ml_policy
67+
- chore(ci): Remove unused scripts
68+
- feat(docs): Create guide for LLM Fine-Tuning
8169

82-
## Getting Help
83-
For questions, open an issue or contact a maintainer listed in `OWNERS`.
70+
### Kubeflow Enhancement Proposal (KEP)
8471

85-
## Resources
86-
- [Kubeflow Trainer Docs](https://www.kubeflow.org/docs/components/trainer/)
87-
- [Source Code](https://github.com/kubeflow/trainer)
72+
For any significant features or enhancement for Kubeflow SDK project we follow the
73+
[Kubeflow Enhancement Proposal process](https://github.com/kubeflow/community/tree/master/proposals).
8874

89-
---
75+
If you want to submit a significant change to the Kubeflow Trainer, please submit a new KEP under
76+
[./docs/proposals](./docs/proposals/) directory.

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ ruff: ## Install Ruff
5151
@uvx ruff --help &> /dev/null || uv tool install ruff
5252

5353
.PHONY: verify
54-
verify: uv uv-venv ruff ## install all required tools
54+
verify: install-dev ## install all required tools
5555
@uv lock --check
5656
@uvx ruff check --show-fixes
5757

@@ -75,3 +75,11 @@ ifeq ($(report),xml)
7575
else
7676
@uv run coverage html
7777
endif
78+
79+
80+
.PHONY: install-dev
81+
install-dev: uv uv-venv ruff ## Install uv, create .venv, sync deps; DEV=1 to include dev group; EXTRAS=comma,list for extras
82+
@echo "Using virtual environment at: $(VENV_DIR)"
83+
@echo "Syncing dependencies with uv..."
84+
@uv sync
85+
@echo "Environment is ready."

0 commit comments

Comments
 (0)