Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/KotlinIsland/basedmypy
Based Python static type checker with baseline, sane default settings and based typing features
https://github.com/KotlinIsland/basedmypy
based baseline hacktoberfest python typing
Last synced: about 1 month ago
JSON representation
Based Python static type checker with baseline, sane default settings and based typing features
- Host: GitHub
- URL: https://github.com/KotlinIsland/basedmypy
- Owner: KotlinIsland
- License: other
- Fork: true (python/mypy)
- Created: 2021-10-21T21:57:30.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-29T08:39:46.000Z (about 2 months ago)
- Last Synced: 2024-10-29T09:55:23.062Z (about 2 months ago)
- Topics: based, baseline, hacktoberfest, python, typing
- Language: Python
- Homepage: https://kotlinisland.github.io/basedmypy/
- Size: 74.4 MB
- Stars: 143
- Watchers: 2
- Forks: 4
- Open Issues: 394
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-python-typing - basedmypy - Based static typing with baseline functionality. (Static type checkers)
README
[![Discord](https://img.shields.io/discord/948915247073349673?logo=discord)](https://discord.gg/7y9upqPrk2)
[![Playground](https://img.shields.io/badge/🛝%20playground-blue)](https://mypy-play.net/?mypy=basedmypy-latest)
[![Stable Version](https://img.shields.io/pypi/v/basedmypy?color=blue)](https://pypi.org/project/basedmypy/)
[![Downloads](https://img.shields.io/pypi/dm/basedmypy)](https://pypistats.org/packages/basedmypy)
[![Documentation](https://img.shields.io/badge/📚%20docs-blue)](https://KotlinIsland.github.io/basedmypy)
[![Checked with basedmypy](https://img.shields.io/badge/basedmypy-checked-brightgreen?labelColor=orange)](https://github.com/KotlinIsland/basedmypy)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Linting: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)![Amon Gus.](/docs/static/logo-dark.png#gh-dark-mode-only)
![Amon Gus.](/docs/static/logo-light.png#gh-light-mode-only)# Based Static Typing for Python
Basedmypy is a Python type checker that is built on top of the work done by the
[mypy project](https://github.com/python/mypy). It resolves fundamental issues, limitations and compromises
that exist within Mypy and Python's type system.Based features include:
- Typesafe by default (optional and dynamic typing still supported)
- Baseline functionality
- Support for `Intersection` types
- Default return type of `None` instead of `Any`
- Generic `TypeVar` bounds
- Based type-guards
- Infer parameter type from default value
- Infer overload types
- Bare literals
- Tuple literal typesSee the [the docs](https://kotlinisland.github.io/basedmypy/based_features.html) for a comprehensive list.
### BasedPyright
Also, take a look at [BasedPyright](https://github.com/DetachHead/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 compromisesYou can find a comprehensive list of features in [the docs](https://kotlinisland.github.io/basedmypy/based_features.html).
## Integrations
If you are using vscode, we recommend the [mypy extension](https://marketplace.visualstudio.com/items?itemName=ms-python.mypy-type-checker)
If you are using IntelliJ IDEA/PyCharm, we recommend the [basedtyping plugin](https://plugins.jetbrains.com/plugin/23374-basedtyping)
If you are using [Pydantic](https://github.com/pydantic/pydantic), we recommend [pydantic-basedtyping](https://github.com/KotlinIsland/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](https://KotlinIsland.github.io/basedmypy/baseline)