An enhanced version of the Python typing library.

Overview

typingplus

PyPI Python Versions Build Status Coverage Status Code Quality

An enhanced version of the Python typing library that always uses the latest version of typing available, regardless of which version of Python is in use.

Installation

Install it using pip:

pip install typingplus

Features

  • Contains all of the typing library, and is guaranteed to use the latest installed version of the typing library, even if the version of Python in use has an older version of typing.
  • typing_extensions is integrated to be as compatible with the future of the typing module as possible.
  • Support for comment type hints.
  • A functional cast function, including to the abstract types defined in the typing module.
  • An is_instance function that works with the abstract types defined in the typing module.
  • An upgrade_typing function that will replace the stdlib version of typing with the latest version from either the stdlib or the backport.

Usage

See PEP 484.

You might also like...
Flake8 extension for checking quotes in python

Flake8 Extension to lint for quotes. Major update in 2.0.0 We automatically encourage avoiding escaping quotes as per PEP 8. To disable this, use --no

Check for python builtins being used as variables or parameters

Flake8 Builtins plugin Check for python builtins being used as variables or parameters. Imagine some code like this: def max_values(list, list2):

flake8 plugin to run black for checking Python coding style

flake8-black Introduction This is an MIT licensed flake8 plugin for validating Python code style with the command line code formatting tool black. It

Custom Python linting through AST expressions
Custom Python linting through AST expressions

bellybutton bellybutton is a customizable, easy-to-configure linting engine for Python. What is this good for? Tools like pylint and flake8 provide, o

Unbearably fast O(1) runtime type-checking in pure Python.
Unbearably fast O(1) runtime type-checking in pure Python.

Look for the bare necessities, the simple bare necessities. Forget about your worries and your strife. — The Jungle Book.

Naming Convention checker for Python

PEP 8 Naming Conventions Check your code against PEP 8 naming conventions. This module provides a plugin for flake8, the Python code checker. (It repl

Code audit tool for python.

Pylama Code audit tool for Python and JavaScript. Pylama wraps these tools: pycodestyle (formerly pep8) © 2012-2013, Florent Xicluna; pydocstyle (form

Flake8 extension for enforcing trailing commas in python

Flake8 Extension to enforce better comma placement. Usage If you are using flake8 it's as easy as: pip install flake8-commas Now you can avoid those a

Tool for pinpointing circular imports in Python. Find cyclic imports in any project
Tool for pinpointing circular imports in Python. Find cyclic imports in any project

Pycycle: Find and fix circular imports in python projects Pycycle is an experimental project that aims to help python developers fix their circular de

Comments
  • Type comments with named default values are not returned.

    Type comments with named default values are not returned.

        def test_long_form():
            """Test type hinting with long-form comments."""
            zzz ='dswsd'
            def func(arg1,
                     arg2,  # type: int
                     arg3 = zzz,  # type: str
                     arg4 = None  # type: str
                     ):
                # type: (...) -> bool
                pass
        
    >       assert get_type_hints(func, globals(), locals()) == {
                'return': bool,
                'arg2': int,
                'arg3': str,
                'arg4': str
            }
    E       AssertionError: assert {'arg2': <cla...class 'bool'>} == {'arg2': <clas...class 'bool'>}
    E         Common items:
    E         {'arg2': <class 'int'>, 'return': <class 'bool'>}
    E         Right contains more items:
    E         {'arg3': <class 'str'>, 'arg4': <class 'str'>}
    E         Full diff:
    E         - {'arg2': <class 'int'>, 'return': <class 'bool'>}
    E         + {'arg2': <class 'int'>,
    E         +  'arg3': <class 'str'>,
    E         +  'arg4': <class 'str'>,
    E         +  'return': <class 'bool'>}
    
    bug 
    opened by dangle 1
  • Add classes that enforce types of subclasses.

    Add classes that enforce types of subclasses.

    Create two classes that read annotated class attributes and generate properties for each attribute that will enforce the type of the values that can be set on the class.

    One class should strictly enforce the type with _is_instance checks and the other should attempt to coerce the value to the expected type.

    enhancement 
    opened by dangle 1
  • Class type hint comments.

    Class type hint comments.

    Currently, type hint comments are not supported for classes. The logic for following the MRO already exists in the base typing library, but must be adapted for comment support.

    enhancement 
    opened by dangle 0
Owner
Contains
Contains
MonkeyType as a pytest plugin.

MonkeyType as a pytest plugin.

Marius van Niekerk 36 Nov 24, 2022
Naming Convention checker for Python

PEP 8 Naming Conventions Check your code against PEP 8 naming conventions. This module provides a plugin for flake8, the Python code checker. (It repl

Python Code Quality Authority 411 Dec 23, 2022
Unbearably fast O(1) runtime type-checking in pure Python.

Look for the bare necessities, the simple bare necessities. Forget about your worries and your strife. — The Jungle Book.

beartype 1.4k Jan 01, 2023
A Pylint plugin to analyze Flask applications.

pylint-flask About pylint-flask is Pylint plugin for improving code analysis when editing code using Flask. Inspired by pylint-django. Problems pylint

Joe Schafer 62 Sep 18, 2022
A plugin for flake8 integrating Mypy.

flake8-mypy NOTE: THIS PROJECT IS DEAD It was created in early 2017 when Mypy performance was often insufficient for in-editor linting. The Flake8 plu

Łukasz Langa 103 Jun 23, 2022
👻 Phantom types for Python

phantom-types Phantom types for Python will help you make illegal states unrepresentable and avoid shotgun parsing by enabling you to practice "Parse,

Anton Agestam 118 Dec 22, 2022
flake8 plugin that integrates isort

Flake8 meet isort Use isort to check if the imports on your python files are sorted the way you expect. Add an .isort.cfg to define how you want your

Gil Forcada Codinachs 139 Nov 08, 2022
Collection of awesome Python types, stubs, plugins, and tools to work with them.

Awesome Python Typing Collection of awesome Python types, stubs, plugins, and tools to work with them. Contents Static type checkers Dynamic type chec

TypedDjango 1.2k Jan 04, 2023
docstring style checker

pydocstyle - docstring style checker pydocstyle is a static analysis tool for checking compliance with Python docstring conventions. pydocstyle suppor

Python Code Quality Authority 982 Jan 03, 2023
Stubs with type annotations for ordered-set Python library

ordered-set-stubs - stubs with type annotations for ordered-set Python library Archived - now type annotations are the part of the ordered-set library

Roman Inflianskas 2 Feb 06, 2020
flake8 plugin to run black for checking Python coding style

flake8-black Introduction This is an MIT licensed flake8 plugin for validating Python code style with the command line code formatting tool black. It

Peter Cock 146 Dec 15, 2022
flake8 plugin to catch useless `assert` statements

flake8-useless-assert flake8 plugin to catch useless assert statements Download or install on the PyPI page Violations Code Description Example ULA001

1 Feb 12, 2022
Tool to check the completeness of MANIFEST.in for Python packages

check-manifest Are you a Python developer? Have you uploaded packages to the Python Package Index? Have you accidentally uploaded broken packages with

Marius Gedminas 270 Dec 26, 2022
Flake8 extension for enforcing trailing commas in python

Flake8 Extension to enforce better comma placement. Usage If you are using flake8 it's as easy as: pip install flake8-commas Now you can avoid those a

Python Code Quality Authority 127 Sep 03, 2022
A static type analyzer for Python code

pytype - 🦆 ✔ Pytype checks and infers types for your Python code - without requiring type annotations. Pytype can: Lint plain Python code, flagging c

Google 4k Dec 31, 2022
Flake8 extension to provide force-check option

flake8-force Flake8 extension to provide force-check option. When this option is enabled, flake8 performs all checks even if the target file cannot be

Kenichi Maehashi 9 Oct 29, 2022
Convert relative imports to absolute

absolufy-imports A tool and pre-commit hook to automatically convert relative imports to absolute. Installation $ pip install absolufy-imports Usage a

Marco Gorelli 130 Dec 30, 2022
Performant type-checking for python.

Pyre is a performant type checker for Python compliant with PEP 484. Pyre can analyze codebases with millions of lines of code incrementally – providi

Facebook 6.2k Jan 04, 2023
It's not just a linter that annoys you!

README for Pylint - https://pylint.pycqa.org/ Professional support for pylint is available as part of the Tidelift Subscription. Tidelift gives softwa

Python Code Quality Authority 4.4k Jan 04, 2023
Flashcards - A flash card application with 2 optional command line arguments

Flashcards A flash card application with 2 optional command line arguments impor

Özgür Yildirim 2 Jul 15, 2022