Skip to content

Commit

Permalink
build(tasks): fix "inv run_api_server_with_poetry --init" path error (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee-W authored Nov 3, 2023
1 parent ee37712 commit 453007a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
from pathlib import Path

from invoke import task
from invoke.context import Context

project_root = Path(__file__).parent.absolute()
api_root = project_root / Path("api")

api_version = "1.0.0-dev"
api_image_name = "ask-astro-api"
api_container_name = "ask-astro-api"
Expand All @@ -9,17 +14,18 @@
@task
def init_api_server_poetry_env(ctx: Context) -> None:
"""Initialize the ask-astro API local poetry environment"""
with ctx.cd("api"):
with ctx.cd(api_root):
print("Initialize ask-astro API local poetry environment")
ctx.run("poetry install")


@task(help={"init": "initialize poetry environment before running server"})
def run_api_server_with_poetry(ctx: Context, init: bool = False) -> None:
"""Run ask-astro API server with poetry"""
with ctx.cd("api"):
with ctx.cd(api_root):
if init:
init_api_server_poetry_env(ctx)
print("Starting ask-astro API local poetry environment")
ctx.run("poetry run python -m ask_astro.app")


Expand Down

0 comments on commit 453007a

Please sign in to comment.