-
Notifications
You must be signed in to change notification settings - Fork 41
chore: Update CONTRIBUTING.md to use uv #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Saad Zaher <szaher@redhat.com>
Signed-off-by: Saad Zaher <szaher@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I added some comments and suggestions.
|
Thank you @szaher! |
Signed-off-by: Saad Zaher <szaher@redhat.com>
Signed-off-by: Saad Zaher <szaher@redhat.com>
Signed-off-by: Saad Zaher <szaher@redhat.com>
Pull Request Test Coverage Report for Build 17142997184Details
💛 - Coveralls |
1 similar comment
Pull Request Test Coverage Report for Build 17142997184Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 17582757769Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
|
@andreyvelich can we get this one reviewed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @szaher, I've added some thoughts.
/assign @astefanutti @Electronic-Waste @kramaranya
Co-authored-by: Andrey Velichkevich <andrey.velichkevich@gmail.com> Signed-off-by: Saad Zaher <szaher@redhat.com>
Signed-off-by: Saad Zaher <eng.szaher@gmail.com>
Signed-off-by: Saad Zaher <szaher@redhat.com>
CONTRIBUTING.md
Outdated
| Install uv if not installed [Official Docs](https://docs.astral.sh/uv/getting-started/installation/) or using the following command: | ||
| ```shell | ||
| make uv | ||
| ``` | ||
| ### Install SDK & Dependencies | ||
|
|
||
| Create a virtual environment and install all dependencies (including dev tools): | ||
|
|
||
| Install dependencies in editable mode: | ||
| ```sh | ||
| pip install -e . | ||
| 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 | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you delete all of these and just run make verify in the Development section ?
Similar to Trainer: https://github.com/kubeflow/trainer/blob/master/CONTRIBUTING.md#development
That should install all required tools and configure uv environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually this one is very specific to installing api modules from master branch but the actual installation of dependencies and app is a couple of lines up.
I added make install
Co-authored-by: Andrey Velichkevich <andrey.velichkevich@gmail.com> Signed-off-by: Saad Zaher <szaher@redhat.com>
CONTRIBUTING.md
Outdated
| The Kubeflow SDK project includes a Makefile with several helpful commands to streamline your development workflow. | ||
|
|
||
| Install uv if not installed [Official Docs](https://docs.astral.sh/uv/getting-started/installation/) or using the following command: | ||
| ```shell | ||
| make uv | ||
| ``` | ||
| ### Install SDK & Dependencies | ||
|
|
||
| Create a virtual environment and install all dependencies (including dev tools): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we need separate section for installing uv and sync API modules, since it is included in the make install command.
| The Kubeflow SDK project includes a Makefile with several helpful commands to streamline your development workflow. | |
| Install uv if not installed [Official Docs](https://docs.astral.sh/uv/getting-started/installation/) or using the following command: | |
| ```shell | |
| make uv | |
| ``` | |
| ### Install SDK & Dependencies | |
| Create a virtual environment and install all dependencies (including dev tools): | |
| 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 | |
| make install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@szaher Can you fix formatting please: https://github.com/kubeflow/sdk/blob/114fec00669263b6f6302519cd90c570ad8fe4ed/CONTRIBUTING.md#development ?
API Models section also can be removed, since uv sync --dev is part of make install script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, uv sync or make install will install the default sdk packages with api models == specific version.
the dev group should install api models == master branch
do we need to remove it give that this guide is for people to contribute so they should use the latest api models?
Co-authored-by: Andrey Velichkevich <andrey.velichkevich@gmail.com> Signed-off-by: Saad Zaher <szaher@redhat.com>
Co-authored-by: Andrey Velichkevich <andrey.velichkevich@gmail.com> Signed-off-by: Saad Zaher <szaher@redhat.com>
Signed-off-by: Saad Zaher <szaher@redhat.com>
Signed-off-by: Saad Zaher <szaher@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @szaher
|
|
||
| ```sh | ||
| python3 -m venv .venv | ||
| source .venv/bin/activate | ||
| ``` | ||
| make install | ||
|
|
||
| Install dependencies in editable mode: | ||
| ```sh | ||
| pip install -e . | ||
| make install | ||
| ``` | ||
|
|
There was a problem hiding this comment.
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
CONTRIBUTING.md
Outdated
| ```shell | ||
| uv sync --dev | ||
| ``` |
There was a problem hiding this comment.
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
Makefile
Outdated
| 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 |
There was a problem hiding this comment.
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
| @uv sync --group dev | |
| @uv sync |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
CONTRIBUTING.md
Outdated
| 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 . |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Signed-off-by: Saad Zaher <szaher@redhat.com>
Signed-off-by: Saad Zaher <szaher@redhat.com>
Signed-off-by: Saad Zaher <szaher@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @szaher!
/lgtm
/assign @kramaranya
CONTRIBUTING.md
Outdated
| ## 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. | ||
|
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: Saad Zaher <szaher@redhat.com>
Signed-off-by: Saad Zaher <szaher@redhat.com>
CONTRIBUTING.md
Outdated
| ```shell | ||
| pre-commit install | ||
| ``` | ||
| To run all hooks manually: | ||
| ```sh | ||
| pre-commit run --all-files |
There was a problem hiding this comment.
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
| ```shell | |
| pre-commit install | |
| ``` | |
| To run all hooks manually: | |
| ```sh | |
| pre-commit run --all-files |
CONTRIBUTING.md
Outdated
| #### Pre-commit | ||
| We use pre-commit to ensure consistent code formatting. To enable pre-commit hooks, run: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #### Pre-commit | |
| We use pre-commit to ensure consistent code formatting. To enable pre-commit hooks, run: |
Signed-off-by: Saad Zaher <szaher@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @szaher!
/lgtm
/assign @kramaranya
|
Awesome, thank you @szaher! |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andreyvelich The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
* 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>
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
Fixes #<issue number>, #<issue number>, ...format, will close the issue(s) when PR gets merged):Fixes #
Checklist: