Skip to main content

Python typing compatibility library

Project description

typing-compat

Python typing compatibility library


In Python >=3.8 the typing.get_origin and typing.get_args functions are provided. This library aims to bring the identical behaviour of these functions to other versions of Python.

Getting started

pip install typing-compat

Usage

>>> from typing import List, Tuple, TypeVar
>>> from typing_compat import get_args, get_origin
>>> T = TypeVar('T')

>>> tp = List[Tuple[T, T]][int]

>>> get_args(tp)
(typing.Tuple[int, int],)

>>> get_origin(tp)
<class 'list'>

License

This library is licensed under either of

at your option.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for typing-compat, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size typing_compat-0.1.0-py2.py3-none-any.whl (7.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size typing-compat-0.1.0.tar.gz (3.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page