Skip to content

Commit 9f45a4b

Browse files
mailtoboggavarapu-coderntkathole
authored andcommitted
fix(cli): align project_list and project_current with master implementation
Addresses Devin Review findings: - Fix project_list: use utils.tags_list_to_dict() instead of manual tag.split(), and print tabulated output matching master - Fix project_current: call store.get_project(name=None) with error handling instead of store.project Both functions now match master branch exactly. Only project_delete is new code from this PR. Signed-off-by: Venkateswarlu Boggavarapu <mailtoboggavarapu@gmail.com>
1 parent 7657e07 commit 9f45a4b

1 file changed

Lines changed: 28 additions & 11 deletions

File tree

sdk/python/feast/cli/projects.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
@click.group(name="projects")
1111
def projects_cmd():
1212
"""
13-
Access and manage projects
13+
Access projects
1414
"""
15+
pass
1516

1617

1718
@projects_cmd.command("describe")
@@ -26,8 +27,8 @@ def project_describe(ctx: click.Context, name: str):
2627
try:
2728
project = store.get_project(name)
2829
except FeastObjectNotFoundException as e:
29-
print(str(e))
30-
raise SystemExit(1)
30+
print(e)
31+
exit(1)
3132

3233
print(
3334
yaml.dump(
@@ -40,27 +41,43 @@ def project_describe(ctx: click.Context, name: str):
4041
@click.pass_context
4142
def project_current(ctx: click.Context):
4243
"""
43-
Returns the current project configured with FeatureStore
44+
Returns the current project configured with FeatureStore object
4445
"""
4546
store = create_feature_store(ctx)
46-
print(store.project)
4747

48+
try:
49+
project = store.get_project(name=None)
50+
except FeastObjectNotFoundException as e:
51+
print(e)
52+
exit(1)
4853

49-
@projects_cmd.command("list")
54+
print(
55+
yaml.dump(
56+
yaml.safe_load(str(project)), default_flow_style=False, sort_keys=False
57+
)
58+
)
59+
60+
61+
@projects_cmd.command(name="list")
5062
@tagsOption
5163
@click.pass_context
5264
def project_list(ctx: click.Context, tags: list[str]):
5365
"""
5466
List all projects
5567
"""
5668
store = create_feature_store(ctx)
69+
table = []
70+
tags_filter = utils.tags_list_to_dict(tags)
71+
for project in store.list_projects(tags=tags_filter):
72+
table.append([project.name, project.description, project.tags, project.owner])
5773

58-
projects = store.list_projects(
59-
tags=dict(tag.split(":", 1) for tag in tags),
60-
)
74+
from tabulate import tabulate
6175

62-
for project in projects:
63-
print(utils.py_object_to_proto(project).name)
76+
print(
77+
tabulate(
78+
table, headers=["NAME", "DESCRIPTION", "TAGS", "OWNER"], tablefmt="plain"
79+
)
80+
)
6481

6582

6683
@projects_cmd.command("delete")

0 commit comments

Comments
 (0)