No project description provided
Project description
typeapi
Typeapi provides a sane and stable API to introspect Python type hints.
Installation
$ pip install typeapi
Quickstart
import typing
from typeapi import parse_type_hint
print(parse_type_hint(typing.Any)) # Type(object)
print(parse_type_hint(typing.List)) # Type(list)
print(parse_type_hint(typing.Mapping[str, int])) # Type(collections.abc.Mapping, (Type(str), Type(int)))
print(parse_type_hint(typing.Union[str, int])) # Union(int, str)
print(parse_type_hint(str | int)) # Union(int, str)
print(parse_type_hint(str | int | None)) # Optional(Union[int, str])
print(parse_type_hint(typing.Annotated[int, 42])) # Annotated(int, 42)
print(parse_type_hint(typing.Annotated[int, 42])) # Annotated(int, 42)
print(parse_type_hint('str', __name__)) # Type(str)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
typeapi-0.1.0a2.tar.gz
(7.6 kB
view hashes)
Built Distribution
Close
Hashes for typeapi-0.1.0a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c77880aa19ebfe488cea160fab67b4722a050756b9be57f09ec471a2b07d75b5 |
|
MD5 | 755bc1cc5fae01f69eb07e3ba71ac4f3 |
|
BLAKE2b-256 | 5b04ef6c0ebaf4adcb3f3873f9c40f4084ee6693897ac0e69ec5fcd58f06e2bb |