Welcome to Typefit’s documentation!

Typefit is a Retrofit-inspired library for Python that helps you fitting decoded JSON data into Python type-annotated structures.

from typefit import api
from typing import NamedTuple, Text

class Item(NamedTuple):
    id: int
    title: Text

class HackerNews(api.SyncClient):
    BASE_URL = "https://hacker-news.firebaseio.com/v0/"

    def get_item(self, item_id: int) -> Item:

story = HackerNews().get_item(42)
# An alternative to VC: "Selling In"


Using this approach, you describe API objects to your typing annotations processor and thus make your API client type-safe. The auto-completion of your editor starts working and you know exactly what should expect from your data.


Typefit provides several modules to help you.

Indices and tables