Skip to main content

Introspect Python type annotation, with ease.

Project description

header.png

Introspect Python type annotation, with ease.

GitHub Workflow Status PyPI Codecov

Modern Python libraries often use type annotations, this library is intended to help "de/serialize" Python type hints to something you can work with.

Sample Usage:

from typingref import TypeHinter
from typing import Union


class MyType:
    ...


def foo(p: Union[int, str, float]) -> MyType:
    ...


p_type = TypeHinter.from_annotation(foo.__annotations__['p'])

if p_type.is_union():
    for t in p_type.of_type:
        ...

assert Union[int, str, float] == p_type.as_annotation()

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

typingref-0.103.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

typingref-0.103.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file typingref-0.103.1.tar.gz.

File metadata

  • Download URL: typingref-0.103.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.0 Linux/6.2.0-1016-azure

File hashes

Hashes for typingref-0.103.1.tar.gz
Algorithm Hash digest
SHA256 1ae22efc6ce0b5331801b9fd89a3e2a0777c074bb497c55af6ee58d3cf291754
MD5 d6d28764a88ac779ca8493f143182df8
BLAKE2b-256 486f7331e48f951e4e5c926965063534b0aa1c6290d4a8a68056c0841cd60256

See more details on using hashes here.

File details

Details for the file typingref-0.103.1-py3-none-any.whl.

File metadata

  • Download URL: typingref-0.103.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.0 Linux/6.2.0-1016-azure

File hashes

Hashes for typingref-0.103.1-py3-none-any.whl
Algorithm Hash digest
SHA256 59d2aa97a097dc3384bc575123682d9fc469e9b52c90baa3624bb4d3958ad9d9
MD5 1f504c281aad838e8b4d809f59b66325
BLAKE2b-256 7f8e6c90808ddc5bb9185191bf5e4de7e3a825efea3069f157b81e31c2386a1d

See more details on using hashes here.

Supported by

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