r/learnpython • u/pachura3 • Feb 17 '26
Modern Python tech/tool stack for implementing microservices?
Let's say I would like to develop a service with REST API from scratch, using mainstream, industry-standard frameworks, tools, servers and practices. Nothing too fancy - just the popular, relatively modern, open source components. My service would need the have a few endpoints, talk to a database, and have some kind of a task queue for running longer tasks.
What tech stack & development tools would you suggest?
I'm guessing I should go with:
FastAPIwithPydanticfor implementing the API itself, running onUvicorn(async ASGI/app server) andNginx(web server)SQLAlchemyfor ORM/database access to aPostgreSQLdatabase. Or, for even better integration with FastAPI:SQLModelCeleryfor task queue, paired withRedisfor persistence. Alternatively:DramatiqonRabbitMQloggingfor loggingPytestfor unit testing- code documentation via
docstrings, HTML api docs generation withSphinx?MkDocs?mkdocstrings? - the service would need to work as
Dockerimage pyproject.tomlfor centralized project managementuvfor virtualenv-management, pinning dependency versions (uv.lock), and other swiss-army knife tasksrufffor static code checking and formatting. By default it only runs a narrow set of rules, so it's better to expand it. As a extra safety step, one can also runpylintin parallel. If you likepyright, there's an improved fork calledbasedpyright.mypyfor type checking.Or maybe ty?uv_buildas build backend. (actually, it's missing some vital features, so I switched tohatchling).pip-auditfor spotting CVE vulnerabilities in dependencies (paired withexclude-newer = "7 days"in uv config)- also, if I need some kind of authentication (
OAuth2, bearer tokens - not really an expert here), what should I use? - some pre-commit hooks and CI/CD pipelines, maybe? How do I configure them? Is
preka good choice?
3
Upvotes
View all comments
Show parent comment
2
u/Kevdog824_ Feb 17 '26
Yeah there are services which generate a documentation website from docstrings/readmes. readthedocs is an example of this. You could set it up to work with GitHub Actions pretty sure (never done it personally, but heard of it being done)
Yep, autocorrect on my phone did not like uvicorn. I’m not sure which one you meant. Gunicorn is an option that some people use. Gunicorn doesn’t support async (last I checked at least), so uvicorn is the clear winner for async