Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6eb90f4
Update CONTRIBUTING.md to use uv
szaher Jul 17, 2025
665f199
remove .flake8 & update .gitignore
szaher Jul 17, 2025
c91307e
Merge branch 'main' into update-contrib
szaher Aug 22, 2025
bffa122
Fix merge conflict
szaher Aug 22, 2025
1c1c886
checkout Makefile, pyproject, lock file from main branch
szaher Aug 22, 2025
1998f0b
update gitignore
szaher Aug 22, 2025
760ae1a
Update CONTRIBUTING.md
szaher Aug 22, 2025
8d88050
Add make install & foramt
szaher Aug 22, 2025
6c4dd97
Merge branch 'update-contrib' of github.com:szaher/sdk into update-co…
szaher Aug 22, 2025
ec4ad5b
Remove uv pip install dev dependencies
szaher Aug 26, 2025
d391711
fix typo in the contributing.md file
szaher Aug 26, 2025
0783b83
Update Makefile
szaher Aug 26, 2025
1a38742
update structure
szaher Sep 7, 2025
7f3458e
Merge branch 'update-contrib' of github.com:szaher/sdk into update-co…
szaher Sep 7, 2025
e00b711
Merge branch 'main' into update-contrib
szaher Sep 7, 2025
4a02853
rephrase uv install
szaher Sep 7, 2025
958d652
update install step at Makefile
szaher Sep 7, 2025
38e3cc7
Update CONTRIBUTING.md
szaher Sep 8, 2025
4c0a097
Apply suggestion from @andreyvelich
szaher Sep 8, 2025
6eb73ed
Apply suggestion from @andreyvelich
szaher Sep 8, 2025
114fec0
update Make target verify to use install
szaher Sep 8, 2025
b9696da
fix formatting in contributing guide
szaher Sep 8, 2025
5077401
remove redundant commands
szaher Sep 8, 2025
3f5bab2
use make install-dev instead of make install
szaher Sep 8, 2025
0ff8e00
update install target reference
szaher Sep 8, 2025
cb35c6c
remove group dev from make install-dev target
szaher Sep 9, 2025
afe4c91
move coding style to dev
szaher Sep 9, 2025
45f4eb0
remove pre-commit stuff from contributing guide
szaher Sep 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 81 additions & 54 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,89 +1,116 @@
# Contributing to the Kubeflow SDK

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

## Getting Started

### Prerequisites
- Python 3.8–3.11
- [pip](https://pip.pypa.io/en/stable/)
## Requirements
- [Supported Python version](./pyproject.toml#L4)
- [pre-commit](https://pre-commit.com/)
- [uv](https://docs.astral.sh/uv/getting-started/installation/)

### Setting Up Your Development Environment
Clone the repository:
```sh
git clone https://github.com/kubeflow/sdk.git
cd sdk
```

Create a virtual environment and activate it:
## Development

The Kubeflow SDK project includes a Makefile with several helpful commands to streamline your development workflow.

To install all dependencies (including dev tools) and create virtual environment, run

```sh
python3 -m venv .venv
source .venv/bin/activate
```
make install

Install dependencies in editable mode:
```sh
pip install -e .
make install
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, clean this up so we just have make install

#### Development Build (Optional)
#### API Models

To install development tools and the latest API modules directly from the master branch:
```sh
uv pip install -e . --group dev
```

## Development Workflow
```shell
uv sync --dev
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this since we have make install


### Pre-commit
We use pre-commit to ensure consistent code formatting. To enable pre-commit hooks, run:
```sh
```shell
pre-commit install
```
To run all hooks manually:
```sh
pre-commit run --all-files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove those sections, since you explain it here: https://github.com/kubeflow/sdk/blob/afe4c9160412090c885e9ab5c214d34c6ea788c3/CONTRIBUTING.md#coding-style

Suggested change
```shell
pre-commit install
```
To run all hooks manually:
```sh
pre-commit run --all-files

```

### Testing
To run the unit tests (if present), execute:
```sh
pytest
```
## Testing

### Code Coverage
To run tests and measure coverage:
```sh
coverage run -m pytest
coverage report -m
The Kubeflow SDK project includes several types of tests to ensure code quality and functionality.

### Unit Testing
To run unit tests locally use the following make command:

```shell
make test-python
```

### Code Formatting
### E2E Tests
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).
Clone the `Kubeflow Trainer` repo and run the provided commands against `Trainer` Makefile.
For more details check [the Kubeflow Trainer Contributing Guide](https://github.com/kubeflow/trainer/blob/master/CONTRIBUTING.md#e2e-tests).

## Coding Style
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.

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.

Specific programmatically generated files listed in the `exclude` field in [.pre-commit-config.yaml](.pre-commit-config.yaml) are deliberately excluded from the hooks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This duplicates https://github.com/szaher/sdk/blob/update-contrib/CONTRIBUTING.md#pre-commit
Could we have one clear section?

Copy link
Member

@andreyvelich andreyvelich Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, maybe we can keep Coding Style as a subsection under Development, e.g.

## Development
...
### Coding Style

Info about pre-commit + `make verify` to check formatting.

## Testing

## Best Practices

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, sounds great to me

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

To check formatting:
```sh
black --check .

```shell
make verify
```
To auto-format all files:
```sh
black .

### Using Ruff

You can use ruff directly to check the linting issues before commiting your code

```shell
uv run ruff check --show-fixes
```
To sort imports:
```sh
isort .

To fix all lint issues automatically using ruff append `--fix` to your ruff check command.

```shell
uv run ruff check --fix .
```
To lint:
```sh
flake8 --exclude .venv

To auto-format, lint all files

```shell
uv run ruff format .
Copy link
Contributor

@kramaranya kramaranya Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like a lot of commands, shall we maybe add make fix or make format instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would really recommend we keep like that for now.

  • We can add that later in the ruff pr
  • we need to support fix, format specific files or files if provided by the user
  • uv run ruff check --fix /PATH/TO/FILE

It could be also a separate issue to support individual components, we can create a tracking issue for it.

```

## Continuous Integration
All PRs are automatically checked by CI. Please ensure all checks pass before requesting review.
## Best Practices

### Pull Request Title Conventions

We enforce a pull request (PR) title convention to quickly indicate the type and scope of a PR.
The PR titles are used to generated changelog for releases.

PR titles must:

- Follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/).
- Have an appropriate [type and scope](./.github/workflows/check-pr-title.yaml)

Examples:

- fix: Check empty value for ml_policy
- chore(ci): Remove unused scripts
- feat(docs): Create guide for LLM Fine-Tuning

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

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

---
If you want to submit a significant change to the Kubeflow Trainer, please submit a new KEP under
[./docs/proposals](./docs/proposals/) directory.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ruff: ## Install Ruff
@uvx ruff --help &> /dev/null || uv tool install ruff

.PHONY: verify
verify: uv uv-venv ruff ## install all required tools
verify: install ## install all required tools
@uv lock --check
@uvx ruff check --show-fixes

Expand All @@ -75,3 +75,11 @@ ifeq ($(report),xml)
else
@uv run coverage html
endif


.PHONY: install
install: uv uv-venv ruff ## Install uv, create .venv, sync deps; DEV=1 to include dev group; EXTRAS=comma,list for extras
@echo "Using virtual environment at: $(VENV_DIR)"
@echo "Syncing dependencies with uv..."
@uv sync --group dev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uv sync already includes dev group

Suggested change
@uv sync --group dev
@uv sync

Copy link
Member

@andreyvelich andreyvelich Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kramaranya Is that true ?
IIUC, by default it will use the default installation (e.g. pip install kubeflow), however in make install we should install dev version.
So we should it to uv sync --group dev as @szaher proposed.

@szaher Maybe we should rename this script to make it more explicit:

make install-dev

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, uv sync installs dev group by default https://docs.astral.sh/uv/concepts/projects/dependencies/#default-groups

We should remove --group dev from uv sync. The default installation (similar to pip install kubeflow) with no dev tools would be uv sync --no-dev.
@szaher could you update it accordingly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kramaranya since uv sync and uv sync --dev has the same effect. dev is a default group in the uv dependency groups so both have the same effect.

keeping --group dev isn't harmful and is more explicit.

Copy link
Member

@andreyvelich andreyvelich Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks for letting us know @kramaranya!
Actually, I might agree with @szaher to use uv sync --group dev since it makes more explicit for the developers that we use dev installation, but I am fine with any.
@astefanutti @Electronic-Waste Any thoughts ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine either way, but I think --group dev just makes the command a bit noisier

@echo "Environment is ready."