Python typing 2020

Attrs, Dataclasses and Pydantic, Posted on Friday, May 29, 2020

I only learned about pydantic when I started to work with FastAPI.

FastAPI is a fast, asynchronous web framework specifically designed for building REST APIs. It uses pydantic for schema definition and data validation.

Since then, I asked myself: Why not attrs? What’s the benefit of pydantic over the widely used and mature attrs? Can or should it replace attrs?

As I begin to write this article, I still don’t know the answer to these questions. So lets explore attrs, data classes and pydantic !

New features of sphinx.ext.autodoc in sphinx 2.4.0 !

Until now, autodoc did not document type annotations for variables even if annotated in source code.

But, since 2.4, it goes to document now .

Nowadays, it becomes important to annotate type hints to make large programs.

With this change, type hints help not only you and your team, but also the reader of document for your library or framework.

Hypermodern Python Chapter 4: Typing by https://fediverse.org/cjolowicz/

In this fourth installment of the Hypermodern Python series, I’m going to discuss how to add type annotations and type checking to your project.

Previously, we discussed how to add linting, static analysis, and code formatting .