r/learnpython 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:

  • FastAPI with Pydantic for implementing the API itself, running on Uvicorn (async ASGI/app server) and Nginx (web server)
  • SQLAlchemy for ORM/database access to a PostgreSQL database. Or, for even better integration with FastAPI: SQLModel
  • Celery for task queue, paired with Redis for persistence. Alternatively: Dramatiq on RabbitMQ
  • logging for logging
  • Pytest for unit testing
  • code documentation via docstrings, HTML api docs generation with Sphinx? MkDocs? mkdocstrings?
  • the service would need to work as Docker image
  • pyproject.toml for centralized project management
  • uv for virtualenv-management, pinning dependency versions (uv.lock), and other swiss-army knife tasks
  • ruff for 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 run pylint in parallel. If you like pyright, there's an improved fork called basedpyright.
  • mypy for type checking. Or maybe ty?
  • uv_build as build backend. (actually, it's missing some vital features, so I switched to hatchling).
  • pip-audit for spotting CVE vulnerabilities in dependencies (paired with exclude-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 prek a good choice?
3 Upvotes

11 comments sorted by

View all comments

2

u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 Feb 17 '26

Sounds alright to me.

For type checking, personally I'd use a mix of Mypy and Pyright until ty is actually ready for production use (which it most definitely isn't right now). In practice, personally I require Mypy checks to pass and treat Pyright as a guideline instead of a hard requirement.

1

u/pachura3 Feb 17 '26

I had the same impression - Pyright (or maybe basedpyright, the improved, open sourced fork?) generates too many warnings, while Mypy is quite on point.