Skip to content

Commit acbd2ab

Browse files
committed
remove required project_path in cli
1 parent 36fe180 commit acbd2ab

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

src/gaiaflow/cli/commands/minikube.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def load_imports():
3131

3232
@app.command(help="Start Gaiaflow production-like services.")
3333
def start(
34-
project_path: Path = typer.Option(..., "--path", "-p", help="Path to your project"),
3534
force_new: bool = typer.Option(
3635
False,
3736
"--force-new",
@@ -42,6 +41,7 @@ def start(
4241
):
4342
""""""
4443
imports = load_imports()
44+
project_path = Path.cwd()
4545
gaiaflow_path, user_project_path = imports.create_gaiaflow_context_path(
4646
project_path
4747
)
@@ -59,9 +59,9 @@ def start(
5959

6060
@app.command(help="Stop Gaiaflow production-like services.")
6161
def stop(
62-
project_path: Path = typer.Option(..., "--path", "-p", help="Path to your project"),
6362
):
6463
imports = load_imports()
64+
project_path = Path.cwd()
6565
gaiaflow_path, user_project_path = imports.create_gaiaflow_context_path(
6666
project_path
6767
)
@@ -78,7 +78,6 @@ def stop(
7878

7979
@app.command(help="Restart Gaiaflow production-like services.")
8080
def restart(
81-
project_path: Path = typer.Option(..., "--path", "-p", help="Path to your project"),
8281
force_new: bool = typer.Option(
8382
False,
8483
"--force-new",
@@ -88,6 +87,7 @@ def restart(
8887
),
8988
):
9089
imports = load_imports()
90+
project_path = Path.cwd()
9191
gaiaflow_path, user_project_path = imports.create_gaiaflow_context_path(
9292
project_path
9393
)
@@ -99,19 +99,20 @@ def restart(
9999
gaiaflow_path=gaiaflow_path,
100100
user_project_path=user_project_path,
101101
action=imports.BaseAction.RESTART,
102+
force_new=force_new
102103
)
103104

104105

105106
@app.command(
106107
help="Containerize your package into a docker image inside the minikube cluster."
107108
)
108109
def dockerize(
109-
project_path: Path = typer.Option(..., "--path", "-p", help="Path to your project"),
110110
image_name: str = typer.Option(
111111
DEFAULT_IMAGE_NAME, "--image-name", "-i", help=("Name of your image.")
112112
),
113113
):
114114
imports = load_imports()
115+
project_path = Path.cwd()
115116
gaiaflow_path, user_project_path = imports.create_gaiaflow_context_path(
116117
project_path
117118
)
@@ -133,9 +134,9 @@ def dockerize(
133134
"cluster. To be used only when debugging required."
134135
)
135136
def create_config(
136-
project_path: Path = typer.Option(..., "--path", "-p", help="Path to your project"),
137137
):
138138
imports = load_imports()
139+
project_path = Path.cwd()
139140
gaiaflow_path, user_project_path = imports.create_gaiaflow_context_path(
140141
project_path
141142
)
@@ -152,13 +153,13 @@ def create_config(
152153

153154
@app.command(help="Create secrets to provide to the production-like environment.")
154155
def create_secret(
155-
project_path: Path = typer.Option(..., "--path", "-p", help="Path to your project"),
156156
name: str = typer.Option(..., "--name", help="Name of the secret"),
157157
data: list[str] = typer.Option(
158158
..., "--data", help="Secret data as key=value pairs"
159159
),
160160
):
161161
imports = load_imports()
162+
project_path = Path.cwd()
162163
secret_data = imports.parse_key_value_pairs(data)
163164
print(secret_data, name)
164165
gaiaflow_path, user_project_path = imports.create_gaiaflow_context_path(
@@ -179,12 +180,11 @@ def create_secret(
179180

180181
@app.command(
181182
help="Clean Gaiaflow production-like services. This will only remove the "
182-
"minikube speicifc things. To remove local docker stuff, use the dev mode."
183+
"minikube specific things. To remove local docker stuff, use the dev mode."
183184
)
184-
def cleanup(
185-
project_path: Path = typer.Option(..., "--path", "-p", help="Path to your project"),
186-
):
185+
def cleanup():
187186
imports = load_imports()
187+
project_path = Path.cwd()
188188
gaiaflow_path, user_project_path = imports.create_gaiaflow_context_path(
189189
project_path
190190
)

src/gaiaflow/cli/commands/mlops.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ def load_imports():
3434

3535
@app.command(help="Start Gaiaflow development services")
3636
def start(
37-
project_path: Path = typer.Option(..., "--path", "-p", help="Path to your project"),
3837
force_new: bool = typer.Option(
3938
False,
4039
"--force-new",
@@ -72,6 +71,7 @@ def start(
7271
),
7372
):
7473
imports = load_imports()
74+
project_path = Path.cwd()
7575
typer.echo(f"Selected Gaiaflow services: {service}")
7676
gaiaflow_path, user_project_path = imports.create_gaiaflow_context_path(
7777
project_path
@@ -118,7 +118,6 @@ def start(
118118

119119
@app.command(help="Stop Gaiaflow development services")
120120
def stop(
121-
project_path: Path = typer.Option(..., "--path", "-p", help="Path to your project"),
122121
service: List[Service] = typer.Option(
123122
["all"],
124123
"--service",
@@ -131,6 +130,7 @@ def stop(
131130
):
132131
""""""
133132
imports = load_imports()
133+
project_path = Path.cwd()
134134
gaiaflow_path, user_project_path = imports.create_gaiaflow_context_path(
135135
project_path
136136
)
@@ -160,7 +160,6 @@ def stop(
160160

161161
@app.command(help="Restart Gaiaflow development services")
162162
def restart(
163-
project_path: Path = typer.Option(..., "--path", "-p", help="Path to your project"),
164163
force_new: bool = typer.Option(
165164
False,
166165
"--force-new",
@@ -189,6 +188,7 @@ def restart(
189188
):
190189
""""""
191190
imports = load_imports()
191+
project_path = Path.cwd()
192192
gaiaflow_path, user_project_path = imports.create_gaiaflow_context_path(
193193
project_path
194194
)
@@ -230,12 +230,12 @@ def restart(
230230
"also remove the state for this project."
231231
)
232232
def cleanup(
233-
project_path: Path = typer.Option(..., "--path", "-p", help="Path to your project"),
234233
prune: bool = typer.Option(
235234
False, "--prune", help="Prune Docker image, network and cache"
236235
),
237236
):
238237
imports = load_imports()
238+
project_path = Path.cwd()
239239
gaiaflow_path, user_project_path = imports.create_gaiaflow_context_path(
240240
project_path
241241
)
@@ -252,15 +252,16 @@ def cleanup(
252252

253253
@app.command(help="Containerize your package into a docker image locally.")
254254
def dockerize(
255-
project_path: Path = typer.Option(..., "--path", "-p", help="Path to your project"),
256255
image_name: str = typer.Option(
257256
DEFAULT_IMAGE_NAME, "--image-name", "-i", help=("Name of your image.")
258257
),
259258
):
260259
imports = load_imports()
260+
project_path = Path.cwd()
261261
gaiaflow_path, user_project_path = imports.create_gaiaflow_context_path(
262262
project_path
263263
)
264+
264265
gaiaflow_path_exists = imports.gaiaflow_path_exists_in_state(gaiaflow_path, True)
265266
if not gaiaflow_path_exists:
266267
imports.save_project_state(user_project_path, gaiaflow_path)
@@ -289,9 +290,9 @@ def dockerize(
289290
"its contents."
290291
)
291292
def update_deps(
292-
project_path: Path = typer.Option(..., "--path", "-p", help="Path to your project"),
293293
):
294294
imports = load_imports()
295+
project_path = Path.cwd()
295296
gaiaflow_path, user_project_path = imports.create_gaiaflow_context_path(
296297
project_path
297298
)

0 commit comments

Comments
 (0)