You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.0 KiB
Python

from invoke import task
@task
def serve(c):
"""Serves the speech-collect application locally."""
c.run("LITESTAR_APP=speech_collect.app:app litestar run --port 8888 --host 0.0.0.0 --reload")
@task
def update_deps(c):
"""Updates depenencies"""
c.run("pip-compile requirements.in", pty=True)
c.run("pip-compile dev-requirements.in", pty=True)
@task
def sync_deps(c):
"""Syncs local dependencies"""
c.run("pip-sync requirements.txt dev-requirements.txt")
@task
def build_image(c, dev=True):
"""Builds the speech-collect container image."""
context_dir = c.run("pwd", hide=True).stdout.strip()
commit_sha = c.run("git rev-parse --short HEAD", hide=True).stdout.strip()
c.run(
f"docker build --build-arg='COMMIT_SHA={commit_sha}' -t speech-collect:{commit_sha}{'-dev' if dev else ''} {context_dir}"
)
@task
def delint(c):
"""Applies automated linters to project"""
c.run("isort ./speech_collect ./tests ./tasks.py", pty=True)
c.run("black ./speech_collect ./tests ./tasks.py", pty=True)