Python Typing

Open-source Python projects categorized as Typing

Top 23 Python Typing Projects

  • mypy

    Optional static typing for Python

    Project mention: CS176a and Research Advice | | 2023-03-24

    I'll try to address both of your replies, sorry for the wait. You should be comfortable with The Python Tutorial -- everything through Chapter 9 is really useful. Python is a good language to know for rapidly getting your ideas into the computer, for programming interviews and festive things like Advent of Code. I really recommend getting comfortable with Python's type annotations and a type checker like mypy. It will save you a lot of headache.

  • pytype

    A static type analyzer for Python code

    Project mention: The Python Paradox | | 2023-01-26

    Check out

  • InfluxDB

    Access the most powerful time series database as a service. Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression.

  • typeshed

    Collection of library stubs for Python, with static types

    Project mention: Ask HN: Will we see a TypeScript for Python? | | 2023-02-26 is Python's equivalent of DefinitelyTyped. I'm not 100% sure why it's not more of a popular thing the way DefinitelyTyped is; I think there might, to some extent, be different attitudes around the appropriateness of having third-party typings for packages, when the actual maintainer of the package isn't interested in providing first-party ones.

  • pytermgui

    Python TUI framework with mouse support, modular widget system, customizable and rapid terminal markup language and more!

    Project mention: Any Good Recommendations for a Tutorial on PyTermGUI? | | 2022-09-24

    Talking about resources, their docs are pretty good and contains some examples too. Documentation:

  • typing

    Python static typing home. Hosts the documentation and a user help forum.

    Project mention: Library for single dispatch on Generic subscript | | 2023-02-09
  • torchtyping

    Type annotations and dynamic checking for a tensor's shape, dtype, names, etc.

    Project mention: [D] Have their been any attempts to create a programming language specifically for machine learning? | | 2023-02-11

    Not really an answer to your question, but there are Python packages that try to solve the problem of tensor shapes that you mentioned, e.g. or

  • prisma-client-py

    Prisma Client Python is an auto-generated and fully type-safe database client designed for ease of use

    Project mention: Alternatives to SQLAlchemy for your project - Prisma case | | 2022-08-08

    Anyway, prisma is a relatively new project, and it is very pleasant to use. I encourage you to give it a try and support the python client (at least a star on GitHub). For me who doesn't like SQL, being able to retrieve models from the database and make queries with prisma is a breath of fresh air. 🤣

  • Sonar

    Write Clean Python Code. Always.. Sonar helps you commit clean code every time. With over 225 unique rules to find Python bugs, code smells & vulnerabilities, Sonar finds the issues while you focus on the work.

  • termtyper

    A typing application to level up your fingers!

    Project mention: how to fix settings button missing from top bar drop-down | | 2022-08-03
  • enforce

    Python 3.5+ runtime type checking for integration testing and data validation

    Project mention: Python’s “Type Hints” are a bit of a disappointment to me | | 2022-04-21

    Every point in this blog post strikes me as either (1) unaware of the tooling around python typing other than mypy, or (2) a criticism of static-typing-bolted-on-to-a-dynamically-typed-language, rather than Python's hints. Regarding (1), my advise to OP is to try out Pyright, Pydantic, and Typeguard. Pyright, especailly, is amazing and makes the process of working with type hints 2 or 3 times smoother IMO. And, I don't think points that fall under (2) are fair criticisms of type *hints*. They are called hints for a reason.

    Otherwise, here's a point-by-point response, either recommending OP checks out tooling, or showing that the point being made is not specific to Python.

    > type hints are not binding.

    There are projects [0][1] that allow you to enforce type hints at runtime if you so choose.

    It's worth mentioning that this is very analogous to how Typescript does it, in that type info is erased completely at runtime.

    > Type checking is your job after all, ...[and that] requires maintenance.

    There are LSPs like Pyright[2] (pyright specifically is the absolute best, IMO) that report type errors as you code. Again, this is very very similar to typescript.

    > There is an Any type and it renders everything useless

    I have never seen a static-typing tool that was bolted on to a dynamically typed language, without an `Any` type, including typescript.

    > Duck type compatibility of int and float

    The author admits that they cannot state why this behavior is problematic, except for saying that it's "ambiguous".

    > Most projects need third-party type hints

    Again, this is a criticism of all cases where static types are bolted on dynamically typed languages, not Python's implementation specifically.

    > Sadly, dataclasses ignore type hints as well

    Pydantic[3] is an amazing data parsing library that takes advantage of type hints, and it's interface is a superset of that of dataclasses. What's more, it underpins FastAPI[4], an amazing API-backend framework (with 44K Github stars).

    > Type inference and lazy programmers

    The argument of this section boils down to using `Any` as a generic argument not being an error by default. This is configurable to be an error both in Pyright[5], and mypy[6].

    > Exceptions are not covered [like Java]

    I can't find the interview/presentation, but Guido Van Rossum specifically calls out Java's implementation of "exception annotations" as a demonstration of why that is a bad idea, and that it would never happen in Python. I'm not saying Guido's opinion is the absolute truth, but just letting you know that this is an explicit decision, not an unwanted shortcoming.








  • sqlalchemy-stubs

    Mypy plugin and stubs for SQLAlchemy

    Project mention: Welcome to hassle free coding | | 2022-05-28

    SQL Alchemy:

  • Deal

    Design by contract for Python. Write bug-free code. Add a few decorators, get static analysis and tests for free.

    Project mention: What features would you want in a new programming language? | | 2023-01-03

    I started using a design by contract library for a Python project this year and it made my code safer and easier to use.

  • jaxtyping

    Type annotations and runtime checking for shape and dtype of JAX arrays, and PyTrees.

    Project mention: [D] Have their been any attempts to create a programming language specifically for machine learning? | | 2023-02-11

    Heads-up that my newer jaxtyping project now exists.

  • mltype

    Command line tool for improving typing skills (programmers friendly)

    Project mention: Practice typing by retyping ENTIRE novels | | 2023-01-01 is something like this. It is tuned for programmers though. And the quality of generated text might vary a lot. But it gives reasonable char sequences.

  • typed-argument-parser

    Typed argument parser for Python

    Project mention: I am sick of writing argparse boilerplate code, so I made "duckargs" to do it for me | | 2023-03-03

    Hmm… did you try such approaches, as [click]( or[tap](

  • typing_inspect

    Runtime inspection utilities for Python typing module

  • typedload

    Python library to load dynamically typed data into statically typed data structures

    Project mention: Show HN: Up to 100x Faster FastAPI with simdjson and io_uring on Linux 5.19 | | 2023-03-06

    Author of typedload here!

    FastAPI relies on (not so fast) pydantic, which is one of the slowest libraries in that category.

    Don't expect to find such benchmarks on the pydantic documentation itself, but the competing libraries will have them.


  • runtype

    Utilities for run-time type validation and multiple dispatch

  • phantom-types

    Phantom types for Python.

    Project mention: Sunday Daily Thread: What's everyone working on this week? | | 2022-10-09

    I've written and published about a static type checking technique and a library of mine that implements it: phantom-types.

  • streamlit-pydantic

    🪄 Auto-generate Streamlit UI from Pydantic Models and Dataclasses.

  • flake8-type-checking

    Flake8 plugin for managing type-checking imports & forward references.

  • infer-types

    A CLI tool to automatically add type annotations into Python code. Must have tool for annotating existing code.

    Project mention: infer-types: A CLI tool to automatically add type annotations into Python code. Must have tool for annotating existing code. | | 2023-02-07
  • flake8-typing-imports

    flake8 plugin which checks that typing imports are properly guarded

  • option

    Rust like Option and Result types in Python (by MaT1g3R)

    Project mention: Personally I have to go with nil | | 2023-02-06

    Should be pretty straightforward to implement.

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020). The latest post mention was on 2023-03-24.

Python Typing related posts


What are some of the best open-source Typing projects in Python? This list will help you:

Project Stars
1 mypy 15,051
2 pytype 4,159
3 typeshed 3,490
4 pytermgui 1,545
5 typing 1,379
6 torchtyping 1,212
7 prisma-client-py 1,038
8 termtyper 872
9 enforce 542
10 sqlalchemy-stubs 534
11 Deal 512
12 jaxtyping 441
13 mltype 402
14 typed-argument-parser 319
15 typing_inspect 292
16 typedload 180
17 runtype 141
18 phantom-types 137
19 streamlit-pydantic 113
20 flake8-type-checking 87
21 infer-types 56
22 flake8-typing-imports 50
23 option 50
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives