Giter Site home page Giter Site logo

typeddjango / awesome-python-typing Goto Github PK

View Code? Open in Web Editor NEW
1.7K 50.0 68.0 155 KB

Collection of awesome Python types, stubs, plugins, and tools to work with them.

Home Page: https://github.com/typeddjango

License: Creative Commons Attribution Share Alike 4.0 International

python mypy python-stubs mypy-stubs mypy-plugins pyi awesome-list pep484 python-types awesome

awesome-python-typing's Introduction

Awesome Python Typing Awesome Gitter

Collection of awesome Python types, stubs, plugins, and tools to work with them.

Contents

Full list of typed projects on PyPi is here.

Static type checkers

  • basedmypy - Based static typing with baseline functionality.
  • basedpyright - Pyright fork with improvements to VSCode support and various other fixes.
  • mypy - Optional static typing (PEP 484).
  • pyanalyze - Extensible static analyzer and type checker.
  • pycharm - IDE for Professional Developers.
  • pylyzer - A fast static code analyzer & language server for Python, written in Rust.
  • pyre - Performant type-checker.
  • pyright - Fast type checker meant for large Python source bases. It can run in a “watch” mode and performs fast incremental updates when files are modified.
  • pytype - Tool to check and infer types - without requiring type annotations.

Dynamic type checkers

  • beartype - Unbearably fast O(1) runtime type-checking in pure Python.
  • pydantic - Data parsing using Python type hinting. Supports dataclasses.
  • pytypes - Provides a rich set of utilities for runtime typechecking.
  • strongtyping - Decorator which checks whether the function is called with the correct type of parameters.
  • typedpy - Type-safe, strict Python. Works well with standard Python.
  • typeguard - Another one runtime type checker.
  • typical - Data parsing and automatic type-coercion using type hinting. Supports dataclasses, standard classes, function signatures, and more.
  • trycast - Parse JSON-like values whose shape is defined by typed dictionaries (TypedDicts) and other standard Python type hints.

Stub packages

Additional types

  • meiga - Simple, typed and monad-based Result type.
  • option - Rust like Option and Result types.
  • optype - Opinionated collections.abc and operators alternative: Flexible single-method protocols and typed operators with predictable names.
  • phantom-types - Phantom types.
  • returns - Make your functions return something meaningful, typed, and safe.
  • safetywrap - Fully typesafe, Rust-like Result and Option types.
  • typet - Length-bounded types, dynamic object validation.
  • useful-types - Collection of useful protocols and type aliases.

Backports and improvements

  • future-typing - Backport for type hinting generics in standard collections and union types as X | Y.
  • typing-extensions - Backported and experimental type hints.
  • typing-utils - Backport 3.8+ runtime typing utils(for eg: get_origin) & add issubtype & more.

Tools

Linters

  • flake8-annotations-complexity - Plugin for flake8 to validate annotations complexity.
  • flake8-annotations - Plugin for flake8 to check for presence of type annotations in function definitions.
  • flake8-pyi - Plugin for Flake8 that provides specializations for type hinting stub files.
  • flake8-type-checking - Plugin to help you guard any type-annotation-only import correctly.
  • flake8-typing-imports - Plugin which checks that typing imports are properly guarded.
  • flake8-typing-only-imports - flake8 plugin that helps identify which imports to put into type-checking blocks, and how to adjust your type annotations once imports are moved.
  • flake8-type-ignore - flake8 plugin to disallow type: ignore comments in your typed Python code.
  • wemake-python-styleguide - The strictest and most opinionated Python linter ever.
  • Ruff - Extremely fast linter which supports lint rules from many other lint tools, such as flake8.

Testing

Working with types

  • com2ann - Tool for translation of type comments to type annotations.
  • merge-pyi - Part of pytype toolchain, applies stub files onto source code.
  • mypy-baseline - Integrate mypy with existing codebase. A CLI tool that filters out existing type errors and reports only new ones.
  • mypy-protobuf - Tool to generate mypy stubs from protobufs.
  • mypy-silent - Silence mypy by adding or removing code comments.
  • mypyc - Compiles mypy-annotated, statically typed Python modules into CPython C extensions.
  • retype - Another tool to apply stubs to code.
  • typeforce - CLI tool that enriches your Python environment with type annotations, empowering mypy.
  • typesplainer - A Python type explainer.
  • typing-inspect - The typing_inspect module defines experimental API for runtime inspection of types defined in the typing module.
  • typing-json - Lib for working with typed objects and JSON.

Helper tools to add annotations to existing code

  • autotyping - Automatically add simple return type annotations for functions (bool, None, Optional).
  • infer-types - CLI tool to automatically infer and add type annotations into Python code.
  • jsonschema-gentypes - Generate Python types based on TypedDict from a JSON Schema.
  • monkeytype - Collects runtime types of function arguments and return values, and can automatically generate stub files or even add draft type annotations directly to your code based on the types collected at runtime.
  • no_implicit_optional - A codemod to make your implicit optional type hints PEP 484 compliant.
  • pyannotate - Insert annotations into your source code based on call arguments and return types observed at runtime.
  • PyTypes - Infer Types by Python Tracing.
  • pyre infer - Pyre has a powerful feature for migrating codebases to a typed format. The infer command-line option ingests a file or directory, makes educated guesses about the types used, and applies the annotations to the files.
  • pytest-annotate - Pyannotate plugin for pytest.
  • pytest-monkeytype - MonkeyType plugin for pytest.
  • pytype annotate-ast - A work-in-progress tool to annotate the nodes of an AST with their Python types.
  • type4py - Deep Similarity Learning-Based Type Inference.
  • typilus - A deep learning algorithm for predicting types in Python. Also available as a GitHub action
  • auto-optional - Makes typed arguments Optional when the default argument is None.

Mypy plugins

Integrations

Articles

PEPs

  • PEP-3107 - Function Annotations.
  • PEP-482 - Literature Overview for Type Hints.
  • PEP-483 - The Theory of Type Hints.
  • PEP-484 - Type Hints.
  • PEP-526 - Syntax for Variable Annotations.
  • PEP-544 - Protocols: Structural subtyping (static duck typing).
  • PEP-557 - Data Classes.
  • PEP-560 - Core support for typing module and generic types.
  • PEP-561 - Distributing and Packaging Type Information.
  • PEP-563 - Postponed Evaluation of Annotations.
  • PEP-585 - Type Hinting Generics In Standard Collections.
  • PEP-586 - Literal Types.
  • PEP-589 - TypedDict: Type Hints for Dictionaries with a Fixed Set of Keys.
  • PEP-591 - Adding a final qualifier to typing.
  • PEP-593 - Flexible function and variable annotations.
  • PEP-604 - Complementary syntax for Union[].
  • PEP-612 - Parameter Specification Variables.
  • PEP-613 - Explicit Type Aliases.

Third-party articles

Communities

Related

  • awesome-python - Curated list of awesome Python frameworks, libraries, software and resources.
  • python-typecheckers - List of Python type checkers: static and runtime.

awesome-python-typing's People

Contributors

bojiang avatar cleder avatar dependabot[bot] avatar detachhead avatar diceroll123 avatar dmytrolitvinov avatar eliasdorneles avatar estaub avatar gordonbondon avatar hbmartin avatar henryh9n avatar jellezijlstra avatar johnthagen avatar jorenham avatar kornicameister avatar kotlinisland avatar marcogorelli avatar orsinium avatar ramalho avatar sco1 avatar seandstewart avatar shabbyrobe avatar sobolevn avatar sondrelg avatar stlehmann avatar tristancacqueray avatar vemel avatar viicos avatar whtsky avatar wwuck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

awesome-python-typing's Issues

[Request] Please list "beartype" in the "Dynamic type checkers" section

Thanks for all the awesome typing lists, @sobolevn, @orsinium, and other fearless contributors. If someone could find a spare moment to add a terse link to beartype, a recently released constant-time (i.e., O(1) with negligible constants at call time regardless of container size) runtime type checker compliant with Python 3.6—3.9 and PEPs 483, 484, 540, 560, 563, 593 and soon to be compliant with PEP 585 that I personally maintain, that would be... like, super awesome: e.g.,

  • beartype - Constant-time runtime type checker.

...or something. I leave everything to your skilled and talented hands.

Thanks again. This has been an extreme year for humanity, so I humbly appreciate everyone's continued focus on this small (but crucial) slice of the Python pie. You're all awesome!

Curses helper i made, maybe fits.

I got started on so.e curses helper stuff, including a (to be expanded) types module. You can find it on my github. Currently it has a window type.

Add Python-typing-koans when matured

https://github.com/kracekumar/python-typing-koans

Python-typing-koans
A set of examples to learn optional static typing in Python.

One of the best of ways to learn python-typing is to annotate the code. In this repo, koans directory contains a set of files which will teach you python type-hints by fixing errors. The files carry a suffix from 100 in the increasing order. By solving errors in the each file in the increasing suffix order, you will gain knowledge about Python hints. It starts with simple variable annotation and covers topics function annotation, generics, protocols, classes.

How to learn?
The existing files has no annotations or wrong annotation, as a learner, you run one file and fix each errors till there are no type-errors. In the next section, you will learn, how to list all koans and how to run the modified koan file.

The issue is just meant to be a reminder/Note to self, to create a PR once the repo has matured enough to be included

Suggest adding to Articles

Below is a personal document I wrote before, might be useful for people who are new to python typing, feel free to take some into the Articles part.


Python Type Hints

Basic Guides

Advanced Guides

PEP 563 -- Postponed Evaluation of Annotations

https://www.python.org/dev/peps/pep-0563/

This PEP describes the support of referencing a type that is yet to defined in the annotation, and how to enabling it by calling from __future__ import annotations in Python after 3.7

In Python before 3.7 (<= 3.6), same thing can be achieved by adding single quote around the type, this is called Forward references in PEP 484.

Literal

Protocol

Generic

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.