This article lives in:

In very short

This is because we all, as the Python community, define their future. To help us and to help others. From the Core Developers making Python itself to the new developers that started learning Python this month.

And as long as these tools are helping us all solve problems, help ourselves, help others, and be more efficient and productive, we all will keep them working and improving.

And that’s what we are all doing. 🤓🚀

Intro


This article lives in:

Intro

Now let’s say it all works well locally, on your machine.

But in most cases, the purpose of these web apps is to be available on the real web (not only on your machine), so that others can actually access them.

So you need to “deploy” them somewhere, on a…


This article lives in:

Intro

As well as top-level dependencies, tags, and other parameters for APIRouters, that before were available only on app.include_router().

This makes it easier to put configurations and dependencies (e.g. for authentication) related to a group of path operations more closely together. 🔒

Let’s start by checking APIRouter...

Include a router

from fastapi import APIRouterrouter = APIRouter()
@router.get("/users/")
def read_users():
return ["rick", "morty"]

And now let’s say you want to include it in the main.py


This article lives in:

Intro

Here’s a friendly and not very technical explanation to give some intuition about all that, including asynchronous code, concurrency, and parallelism.

This is taken from the docs for FastAPI, a modern framework for building APIs in Python.

Although this was written for Python and FastAPI, all the story and information is relevant for other languages that also have async and await, like JavaScript and Rust.


This article lives in:

The first FastAPI workshop at PyCon Belarus

I gave a talk there:

And a workshop with about 60 people:

Creating the workshop

The final app ended up having basic OAuth2 authentication, authorization handling with dependencies, tests with full coverage, etc.

I “gave” a test trial of the full workshop to Camila and the total time was about 9…


Here’s a tip to help you get started contributing to open source (if you haven’t started yet).

This article lives in:

TL;DR

Newbies are great at docs, better than maintainers. Start with that.

Find a problem

If you see you can solve it easily without technology, cool, go and do that. And come back with a new problem ;)

Then find how technology could help to solve it, what kind of app or system would help.

Find a project


FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.

This article lives in:

Intro

But at some point, there was no other option than creating something that provided all these features, taking the best ideas from previous tools, and combining them in the best way possible, using language features that weren’t even available before…


This article lives in:

Intro

Here’s how you can set up Swarmprom to monitor your cluster.

It will allow you to:

  • Monitor CPU, disk, memory usage, etc.
  • Monitor it all per node, per service, per container, etc.
  • Have a nice, interactive, real-time dashboard with all the data nicely plotted.
  • Trigger alerts (for example, in Slack, Rocket.chat, etc) when your services/nodes pass certain thresholds.
  • And more…

Swarmprom is actually just a set of tools pre-configured in a smart…


This article lives in:

Intro

Now you can add a main, distributed, Traefik load balancer/proxy to:

  • Handle connections.
  • Expose specific services and applications based on their domain names.
  • Handle multiple domains (if you need to). Similar to “virtual hosts”.
  • Handle HTTPS.
  • Acquire (generate) HTTPS certificates automatically (including renewals) with Let’s Encrypt.
  • Add HTTP Basic Auth for any service that you need to protect and doesn’t have its own security, etc.
  • Get all its configurations automatically from Docker labels set in your stacks (you don’t…


This article lives in:

Update

And there’s an updated version of this article, with distributed Traefik and Consul (this article is for a single node Traefik, even when running in a cluster):

Note

This is the old version, having a Traefik instance on a single node. …

Sebastián Ramírez

Creator of FastAPI and Typer. Dev at Exposion AI. APIs, Deep Learning/Machine Learning, full-stack distributed systems, SQL/NoSQL, Python, Docker, JS, TS, etc.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store