Skip to content

AP-856: scaffold a basic flask+celery app - #1

Open
anarchivist wants to merge 7 commits into
mainfrom
AP-856
Open

AP-856: scaffold a basic flask+celery app#1
anarchivist wants to merge 7 commits into
mainfrom
AP-856

Conversation

@anarchivist

@anarchivist anarchivist commented Sep 11, 2026

Copy link
Copy Markdown
Member
  • creates a simple flask app with a 2 routes: / and /health, and integrates celery into it
  • sets up Docker and Compose configuration to spin up the necessary services: db, app, worker, and redis. flower is an optional service run by a profile.
  • adds github actions workflows

@anarchivist
anarchivist force-pushed the AP-856 branch 6 times, most recently from caf0ada to ace4e82 Compare September 11, 2026 03:49
@anarchivist
anarchivist marked this pull request as ready for review September 11, 2026 03:55
@anarchivist
anarchivist force-pushed the AP-856 branch 2 times, most recently from 4986e98 to 312f342 Compare September 11, 2026 04:05
* creates a simple app with a 2 routes: / and /health
* creates a celery app that can be extended further
* sets up Docker and Compose configuration to spin up the necessary services: db, app, worker, and redis
* adds github actions workflows

@awilfox awilfox left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+wc: There's a lot of missing docstrings, but perhaps that's acceptable here. I didn't notate each one. Most of our other Python projects have both module- and function-level docstrings, so it was a bit surprising to have none here. I don't know if we need to manually pull in redis in PyProject. Tiny style nits. Otherwise, this looks good.

Comment thread bin/dbinit
<head><title>quiabo</title></head>
<body>
<img src="{{ url_for('static', filename='quiabo.png') }}" alt="quiabo logo"/>
<h1>Goodbye Doggy!</h1>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A paw waving goodbye

Comment thread quiabo/__init__.py

app = create_app()
celery_app = celery_init_app(app)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra newline.

Comment thread quiabo/__init__.py
app = Flask(__name__)
app.config.from_prefixed_env(prefix="QUIABO")

app.register_blueprint(root.bp)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to call this Root, or possibly Application? Also, I don't know if we want to register this one last, so that other blueprints won't be shadowed by it in case of accidental shadowing. At least, I always felt that was less surprising behaviour - we can leave it in this order, as I doubt that will happen here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's sort of a weird example. we don't have anything else hanging off the / Blueprint, so it's kind of strange.

Comment thread .gitignore

# other stuff
artifacts/*
uv.lock No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing terminating newline.

Comment thread Dockerfile
@@ -0,0 +1,47 @@
FROM python:3.14-slim AS reqs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want Python version to be an ARG?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we haven't yet done that for other python apps but i'm not opposed.

Comment thread pyproject.toml
"flower",
"gunicorn",
"psycopg2",
"redis",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see redis being used by the app itself. celery should pull it in if it's using it itself, right?

@anarchivist anarchivist Sep 12, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

celery has many brokers and result backends, so by default it's light and doesn't pull in any client dependencies. this could be specified as celery[redis,sqlalchemy] instead, but that's ultimately resolving next to kombu[redis] and kombu[sqlalchemy].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense; we can just leave redis and sqlalchemy in the base deps. Maybe add a comment that it's for Celery backends.

@anarchivist

Copy link
Copy Markdown
Member Author

i'll take a pass to add docstrings before merging and make the requested changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants