Skip to main content

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


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.0a1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

typeapi-0.1.0a1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file typeapi-0.1.0a1.tar.gz.

File metadata

  • Download URL: typeapi-0.1.0a1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.1

File hashes

Hashes for typeapi-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 36320fc814fb87a5c1295b706ecfab7cb7ddb71b8872b8d83fa9b1808cc3e98f
MD5 fd3aa3b22bb0e1c16bccf93d0d36ce10
BLAKE2b-256 8d9d07d339a336cb1baf378bb81a0dd957de68add5932a9f5cd5075d7f2435be

See more details on using hashes here.

File details

Details for the file typeapi-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: typeapi-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.1

File hashes

Hashes for typeapi-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 1e75b3e56ff3fc3e8f435cc2d09c12647b815407b14f859311b2f5c4d8ffc54e
MD5 51f1aaf8cad74a4437f40b775cf49285
BLAKE2b-256 5633d805a578f311741610cc45cd728ee73de8853b8a5735297ba6919905d1d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page