Home

Awesome

Discord Playground Stable Version Downloads Documentation Checked with basedmypy Code style: black Linting: Ruff

<!-- can't use a <picture> because it doesn't work in the app -->

Amon Gus. Amon Gus.

Based Static Typing for Python

Basedmypy is a Python type checker that is built on top of the work done by the mypy project. It resolves fundamental issues, limitations and compromises that exist within Mypy and Python's type system.

Based features include:

See the the docs for a comprehensive list.

BasedPyright

Also, take a look at BasedPyright, a based type checker and language server based on Pyright!

Usage

Basedmypy is installed as an alternative to, and in place of, the mypy installation:

mypy test.py

python -m mypy test.py

Why?

basedmypy was created to attempt to resolve two issues within Python and Mypy's typing ecosystem and to demonstrate new typing concepts:

  1. Mypy is lacking numerous pieces of functionality
  2. Pythons type system is full of deeply concerning compromises

You can find a comprehensive list of features in the docs.

Integrations

If you are using vscode, we recommend the mypy extension

If you are using IntelliJ IDEA/PyCharm, we recommend the basedtyping plugin

If you are using Pydantic, we recommend pydantic-basedtyping

Baseline

Basedmypy supports a feature called baseline. It allows you to adopt new strictness or features without the burden of refactoring and fixing every new error, just save all current errors to the baseline file and resolve them at what ever pace you want. Only new code will report new errors.

Read more and see examples in the docs