Skip to content

Commit

Permalink
start digifeeds cli
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Sep 25, 2024
1 parent 59e35a5 commit 2f9cc22
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
# Set the working directory to /app
WORKDIR /app

ENV PYTHONPATH="/app"

CMD ["tail", "-f", "/dev/null"]

# Both build and development need poetry, so it is its own step.
Expand Down Expand Up @@ -89,8 +91,7 @@ RUN mkdir -p /venv && chown ${UID}:${GID} /venv
# By adding /venv/bin to the PATH the dependencies in the virtual environment
# are used
ENV VIRTUAL_ENV=/venv \
PATH="/venv/bin:$PATH" \
PYTHONPATH="/app"
PATH="/venv/bin:$PATH"

COPY --chown=${UID}:${GID} . /app
COPY --chown=${UID}:${GID} --from=build "/app/.venv" ${VIRTUAL_ENV}
Expand Down
Empty file added aim/cli/__init__.py
Empty file.
8 changes: 8 additions & 0 deletions aim/cli/digifeeds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import typer

app = typer.Typer()


@app.command()
def add_to_db(barcode: str):
print(f'Adding barcode "{barcode}" to database')
9 changes: 9 additions & 0 deletions aim/cli/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import typer
import aim.cli.digifeeds as digifeeds

app = typer.Typer()
app.add_typer(digifeeds.app, name="digifeeds")


if __name__ == "__main__":
app()
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ authors = ["Monique Rio <[email protected]>", "David Fulmer <[email protected]>"]
readme = "README.md"
packages = [{include = "aim"}]

[tool.poetry.scripts]
aim = "aim.cli.main:app"

[tool.poetry.dependencies]
python = "^3.11"
requests = "^2.31.0"
Expand All @@ -14,6 +17,7 @@ mysqlclient = "^2.2.4"
fastapi = {extras = ["standard"], version = "^0.114.2"}
httpx = "^0.27.2"
alembic = "^1.13.2"
typer = "^0.12.5"


[tool.poetry.group.dev.dependencies]
Expand Down

0 comments on commit 2f9cc22

Please sign in to comment.