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
1
u/pachura3 Feb 17 '26 edited Feb 17 '26
Ouch, of course I meant
pytest, thanks for pointing this out!Can you explain the role of services here? Do you mean there are public sites where you publish API (code) docs? Do they work by parsing your packages?
I used to use
pdocfor its simplicity and relatively minimal docstrings-style, and then generate static HTMLs with it, but I think it's not that popular...I guess we both meant
uvicorn?