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
Simple Python style checker in one Python file

pycodestyle (formerly called pep8) - Python style guide checker pycodestyle is a tool to check your Python code against some of the style conventions

Python Code Quality Authority 4.7k Jan 1, 2023
A Python Parser

parso - A Python Parser Parso is a Python parser that supports error recovery and round-trip parsing for different Python versions (in multiple Python

Dave Halter 520 Dec 26, 2022
A simple program which checks Python source files for errors

Pyflakes A simple program which checks Python source files for errors. Pyflakes analyzes programs and detects various errors. It works by parsing the

Python Code Quality Authority 1.2k 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 4, 2023
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
The strictest and most opinionated python linter ever!

wemake-python-styleguide Welcome to the strictest and most opinionated python linter ever. wemake-python-styleguide is actually a flake8 plugin with s

wemake.services 2.1k Jan 1, 2023
Static type checker for Python

Static type checker for Python Speed Pyright is a fast type checker meant for large Python source bases. It can run in a “watch” mode and performs fas

Microsoft 9.2k Jan 3, 2023
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
A python documentation linter which checks that the docstring description matches the definition.

Darglint A functional docstring linter which checks whether a docstring's description matches the actual function/method implementation. Darglint expe

Terrence Reilly 463 Dec 31, 2022
Flake8 plugin that checks import order against various Python Style Guides

flake8-import-order A flake8 and Pylama plugin that checks the ordering of your imports. It does not check anything else about the imports. Merely tha

Python Code Quality Authority 270 Nov 24, 2022