From 2358d5f70f4785bf7023210c68738abefba384a6 Mon Sep 17 00:00:00 2001 From: ShaktidharK1997 Date: Sun, 9 Feb 2025 16:42:36 -0500 Subject: [PATCH 1/2] Adding Click command to display configuration details Signed-off-by: ShaktidharK1997 --- sdk/python/feast/cli.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sdk/python/feast/cli.py b/sdk/python/feast/cli.py index 165677a843a..890c79aa856 100644 --- a/sdk/python/feast/cli.py +++ b/sdk/python/feast/cli.py @@ -137,6 +137,24 @@ def version(): print(f'Feast SDK Version: "{importlib_version("feast")}"') +@cli.command() +@click.pass_context +def configuration(ctx: click.Context): + """ + Display Feast configuration + """ + repo = ctx.obj["CHDIR"] + fs_yaml_file = ctx.obj["FS_YAML_FILE"] + cli_check_repo(repo, fs_yaml_file) + repo_config = load_repo_config(repo, fs_yaml_file) + if repo_config: + config_dict = repo_config.model_dump(by_alias=True, exclude_unset=True) + config_dict.pop("repo_path", None) + print(yaml.dump(config_dict, default_flow_style=False, sort_keys=False)) + else: + print("No configuration found.") + + @cli.command() @click.option( "--host", From 9a68d737b48ea3b42e184f7dec30546d640005f4 Mon Sep 17 00:00:00 2001 From: ShaktidharK1997 Date: Mon, 10 Feb 2025 20:16:21 -0500 Subject: [PATCH 2/2] Adding unit test for configuration CLI command and documentation for the same Signed-off-by: ShaktidharK1997 --- docs/reference/feast-cli-commands.md | 23 +++++++++++++++++++++++ sdk/python/tests/unit/cli/test_cli.py | 20 ++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/docs/reference/feast-cli-commands.md b/docs/reference/feast-cli-commands.md index 8f1a7c302e6..712df18a6b6 100644 --- a/docs/reference/feast-cli-commands.md +++ b/docs/reference/feast-cli-commands.md @@ -19,6 +19,7 @@ Options: Commands: apply Create or update a feature store deployment + configuration Display Feast configuration entities Access entities feature-views Access feature views init Create a new Feast repository @@ -61,6 +62,28 @@ feast apply `feast apply` \(when configured to use cloud provider like `gcp` or `aws`\) will create cloud infrastructure. This may incur costs. {% endhint %} +## Configuration + +Display the actual configuration being used by Feast, including both user-provided configurations and default configurations applied by Feast. + +```bash +feast configuration +``` + +```yaml +project: foo +registry: data/registry.db +provider: local +online_store: + type: sqlite + path: data/online_store.db +offline_store: + type: dask +entity_key_serialization_version: 2 +auth: + type: no_auth +``` + ## Entities List all registered entities diff --git a/sdk/python/tests/unit/cli/test_cli.py b/sdk/python/tests/unit/cli/test_cli.py index a286c847dd2..b09eabebb80 100644 --- a/sdk/python/tests/unit/cli/test_cli.py +++ b/sdk/python/tests/unit/cli/test_cli.py @@ -170,3 +170,23 @@ def setup_third_party_registry_store_repo( ) yield repo_path + + +def test_cli_configuration(): + """ + Unit test for the 'feast configuration' command + """ + runner = CliRunner() + + with setup_third_party_provider_repo("local") as repo_path: + # Run the 'feast configuration' command + return_code, output = runner.run_with_output(["configuration"], cwd=repo_path) + + # Assertions + assertpy.assert_that(return_code).is_equal_to(0) + assertpy.assert_that(output).contains(b"project: foo") + assertpy.assert_that(output).contains(b"provider: local") + assertpy.assert_that(output).contains(b"type: sqlite") + assertpy.assert_that(output).contains(b"path: data/online_store.db") + assertpy.assert_that(output).contains(b"type: file") + assertpy.assert_that(output).contains(b"entity_key_serialization_version: 2")