Skip to content

Conversation

@jskswamy
Copy link

Purpose

Add support for uv dependency management to the Kubeflow SDK.

Background

This addresses the following feedback from PR #31:

"Please can we add support for uv in the separate PR ?
We have an open issue for it: #20"

Changes

  • Add test dependencies: pytest>=7.0.0, pytest-mock>=3.10.0 in pyproject.toml
  • Configure pytest with appropriate settings (import mode, verbose output, test discovery)
  • Set testpaths = ["kubeflow"] to support co-located tests
  • Add uv.lock file with locked dependency versions

Related

This commit introduces optional dependencies specifically for testing
purposes. The `pytest` and `pytest-mock` packages are added to the
`pyproject.toml` file under the `optional-dependencies` section,
allowing developers to easily install testing tools when needed.

Additionally, a new `pytest.ini` configuration section is created to
standardize test settings, including options for verbosity and test
discovery patterns.

Signed-off-by: Krishnaswamy Subramanian <subramk@thoughtworks.com>
@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign tenzen-y for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@andreyvelich
Copy link
Member

Fixes: #20

Copy link
Member

@andreyvelich andreyvelich left a comment

Choose a reason for hiding this comment

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

@google-oss-prow
Copy link

@andreyvelich: GitHub didn't allow me to assign the following users: briangallagher, szaher.

Note that only kubeflow members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

Thank you for this @jskswamy!
/assign @szaher @franciscojavierarceo @astefanutti @Electronic-Waste @briangallagher

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@astefanutti
Copy link
Contributor

/lgtm

Thanks

@google-oss-prow google-oss-prow bot added the lgtm label Jun 30, 2025

[tool.pytest.ini_options]
addopts = [
"--import-mode=importlib",
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need it ?

"-v",
"--tb=short",
]
testpaths = ["kubeflow"]
Copy link
Member

Choose a reason for hiding this comment

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

should we create a dedicated directory for tests? i.e. kubeflow/tests ?

Copy link
Member

Choose a reason for hiding this comment

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

I think, for unit tests, we agreed previously to store test files alongside the actual files.
That will make it easier to find unit tests, and make it consistent with Go best practices.
KFP also does it: https://github.com/kubeflow/pipelines/tree/master/sdk/python/kfp/client


[project.optional-dependencies]
test = [
"pytest>=7.0.0",
Copy link
Member

Choose a reason for hiding this comment

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

since we are going to use uv let's use ruff as well with uv?

Choose a reason for hiding this comment

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

+1

@@ -0,0 +1,438 @@
version = 1
revision = 2
requires-python = ">=3.12"
Copy link
Member

Choose a reason for hiding this comment

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

are we dropping old python versions? I think we still need to support 3.10 and 3.11

3.9 version will be dropped in October this year https://devguide.python.org/versions/

@szaher
Copy link
Member

szaher commented Jun 30, 2025

Let's split this PR into two as there are two things happening here. pytest and uv dependency management and we need to check if we are creating workspaces or not and some other directives for uv we need to decide on if this is Ok

cc: @andreyvelich

@szaher
Copy link
Member

szaher commented Jul 4, 2025

@jskswamy Can we update this PR to only focus on pytest and unit testing and rebase it on top of this PR which adds uv and ruff support + CI job for linting? #38
cc: @andreyvelich

@andreyvelich
Copy link
Member

This has been resolved in: #38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants