-
Notifications
You must be signed in to change notification settings - Fork 105
feat: add Feast feature store integration #240
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
Draft
Copilot
wants to merge
8
commits into
main
Choose a base branch
from
copilot/add-feast-to-kubeflow-sdk
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8034f00
Initial plan
Copilot 169fd9b
feat(feast): add FeastClient integration with tests
Copilot 0ef470f
chore: remove spurious file
Copilot 1fabeaf
chore: fix linting issues in feast module
Copilot ae93845
refactor: use common test utilities from kubeflow.trainer.test
Copilot 84d0fd9
docs: add Feast documentation to README
Copilot 57e4400
fix: make apply method accept objects parameter
Copilot e78cee2
refactor: simplify FeastClient to minimal wrapper with feature_store …
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Copyright 2025 The Kubeflow Authors. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from kubeflow.feast.api.feast_client import FeastClient | ||
|
|
||
| __all__ = ["FeastClient"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Copyright 2025 The Kubeflow Authors. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| # Copyright 2025 The Kubeflow Authors. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING, Any | ||
|
|
||
| if TYPE_CHECKING: | ||
| from feast import FeatureStore | ||
|
|
||
|
|
||
| class FeastClient: | ||
| """Client for Feast feature store operations. | ||
|
|
||
| Feast is a feature store that enables offline retrieval of historical datasets | ||
| and online serving of features/data for ML applications. | ||
|
|
||
| This is a minimal wrapper that provides simplified initialization. For full Feast | ||
| functionality, use the `feature_store` property to access the underlying FeatureStore. | ||
|
|
||
| Requires the feast package to be installed. Install it with: | ||
|
|
||
| pip install 'kubeflow[feast]' | ||
|
|
||
| Example: | ||
| ```python | ||
| from kubeflow.feast import FeastClient | ||
|
|
||
| # Initialize client | ||
| client = FeastClient(repo_path="/path/to/feast/repo") | ||
|
|
||
| # Access full Feast functionality | ||
| client.feature_store.get_online_features(...) | ||
| client.feature_store.materialize(...) | ||
| ``` | ||
| """ | ||
|
|
||
| def __init__(self, repo_path: str | None = None, config: dict[str, Any] | None = None): | ||
| """Initialize the FeastClient. | ||
|
|
||
| Args: | ||
| repo_path: Path to the Feast repository. If not provided, uses the current directory. | ||
| config: Optional configuration dictionary for Feast FeatureStore. | ||
| If provided, takes precedence over repo_path. | ||
|
|
||
| Raises: | ||
| ImportError: If feast is not installed. | ||
| """ | ||
| try: | ||
| from feast import FeatureStore | ||
| except ImportError as e: | ||
| raise ImportError( | ||
| "feast is not installed. Install it with:\n\n" # fmt: skip | ||
| " pip install 'kubeflow[feast]'\n" | ||
| ) from e | ||
|
|
||
| if config is not None: | ||
| self._feature_store: FeatureStore = FeatureStore(config=config) | ||
| else: | ||
| self._feature_store: FeatureStore = FeatureStore(repo_path=repo_path) | ||
|
|
||
| @property | ||
| def feature_store(self) -> FeatureStore: | ||
| """Access the underlying Feast FeatureStore instance. | ||
|
|
||
| Use this property to access the full Feast API for operations like: | ||
| - get_online_features() / get_historical_features() | ||
| - materialize() / materialize_incremental() | ||
| - apply() - Deploy feature definitions | ||
| - list_feature_views() / list_entities() / list_data_sources() | ||
|
|
||
| Returns: | ||
| The Feast FeatureStore instance. | ||
|
|
||
| Example: | ||
| ```python | ||
| client = FeastClient(repo_path="/path/to/feast/repo") | ||
|
|
||
| # Get online features | ||
| features = client.feature_store.get_online_features( | ||
| features=["feature_view:feature1"], | ||
| entity_rows=[{"entity_id": 1}], | ||
| ) | ||
|
|
||
| # List feature views | ||
| for fv in client.feature_store.list_feature_views(): | ||
| print(fv.name) | ||
| ``` | ||
| """ | ||
| return self._feature_store | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@copilot why are we implementing all of the feast Feature Store class methods? Why wouldn't the user just directly use the Feast SDK?
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 raise a good point. The current implementation does wrap many Feast methods without adding significant value beyond what users would get from using Feast directly.
Looking at the ModelRegistryClient pattern, the wrapper should provide value through:
storeproperty already provides direct access to the underlying FeatureStore for advanced use casesI can simplify this in a few ways:
Option 1: Minimal wrapper - Keep only essential initialization and provide the
storeproperty for full Feast access. Users who want all Feast features useclient.store.*Option 2: Remove wrapper entirely - Just document how to use Feast alongside Kubeflow SDK
Option 3: Keep current approach - The wrapper provides consistent API patterns across the Kubeflow SDK ecosystem, even if it's mostly pass-through
What's your preference? I'd lean toward Option 1 (minimal wrapper with store property access) as it balances convenience with avoiding unnecessary abstraction.
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.
Yeah Option 1 feels right.
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.
@copilot Option 1 feels right. Small nit it should probably be
client.feature_store.*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! Simplified to minimal wrapper approach with
feature_storeproperty in commit e78cee2.Changes:
store→feature_storepropertyclient.feature_store.*patternUsers now access full Feast functionality through the property:
client.feature_store.get_online_features(...),client.feature_store.materialize(...), etc.