AskReference
ConceptIntroductory

What is the minimum Python version required for FastAPI, and why?

The minimum Python version required for FastAPI is 3.7. This version includes type hints and asyncio, which are core requirements for FastAPI. The author recommends using at least Python 3.9 for a longer support lifetime.

The book's chapter on modern Python specifies Python 3.7 as the bare minimum for working with FastAPI. The reason is that Python 3.7 includes features such as type hints and asyncio, and these are core requirements for FastAPI. Type hints play a key role later when FastAPI adapts the Pydantic package to make clever use of type hinting for data definitions. The author further recommends using at least Python 3.9, which will have a longer support lifetime.

Key points

  • FastAPI requires Python 3.7 as the bare minimum.
  • Python 3.7 includes type hints and asyncio, both core requirements for FastAPI.
  • The author recommends at least Python 3.9 for a longer support lifetime.
  • Type hints are important because FastAPI uses Pydantic to take advantage of them.
Source:FastAPI: Modern Python Web Development· Modern Python· p. 33–40

Related questions

Cover of FastAPI: Modern Python Web Development

FastAPI: Modern Python Web Development

Bill Lubanovic;

First Edition · O'Reilly Media, Inc.

View this ebook