{"id":4831,"library":"typing-utils","title":"Typing Utils","description":"typing-utils is a Python library providing utilities to inspect Python type annotations. It backports features found in Python 3.8+ for type inspection, including `issubtype`, `get_origin`, `get_args`, and `get_type_hints`. The current version is 0.1.0, released in May 2021, suggesting a maintenance release cadence.","status":"maintenance","version":"0.1.0","language":"python","source_language":"en","source_url":"https://github.com/bojiang/typing_utils","tags":["typing","type hints","reflection","metaprogramming","type checking"],"install":[{"cmd":"pip install typing-utils","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"symbol":"issubtype","correct":"from typing_utils import issubtype"},{"symbol":"get_origin","correct":"from typing_utils import get_origin"},{"symbol":"get_args","correct":"from typing_utils import get_args"},{"symbol":"get_type_hints","correct":"from typing_utils import get_type_hints"}],"quickstart":{"code":"import typing\nfrom typing_utils import issubtype, get_origin, get_args\n\n# Using issubtype\nassert issubtype(list, typing.Sequence) == True\nassert issubtype(typing.List[int], list) == True\nassert issubtype(list, typing.List[int]) == False\n\n# Using get_origin\nassert get_origin(typing.List[int]) == list\nassert get_origin(list) == list\n\n# Using get_args\nassert get_args(typing.List[int]) == (int,)\nassert get_args(typing.Dict[str, float]) == (str, float)\n\nprint(\"Typing utilities working correctly!\")","lang":"python","description":"This quickstart demonstrates the core functionality of `typing-utils` by checking subtype relationships and extracting origin and arguments from type annotations."},"warnings":[{"fix":"Review type comparison logic if upgrading from versions prior to 0.1.0 to ensure intended behavior, especially for complex or union types.","message":"The 0.1.0 release introduced several fixes and behavior changes for `issubtype`, particularly concerning `Union`, `None` (as `type(None)`), `TypeVar` checking, and `Callable`. Users upgrading from pre-0.1.0 versions might observe different results for type comparisons that previously exhibited buggy behavior.","severity":"breaking","affected_versions":"<0.1.0"},{"fix":"Carefully consult the official documentation for `get_type_hints` when using `globalns` and `localns` to understand their scope and interaction with forward references.","message":"The `get_type_hints` function, while powerful, has 'counterintuitive' behavior regarding its `globalns` and `localns` parameters, similar to how `eval()` and `exec()` work. Incorrect usage can lead to unexpected results, especially with forward references.","severity":"gotcha","affected_versions":"All"},{"fix":"For new code and when refactoring, prefer native type hints like `list[str]` over `typing.List[str]` when defining your type annotations.","message":"Starting with Python 3.9, many common types from the standard `typing` module (e.g., `List`, `Dict`, `Set`, `Tuple`) are deprecated in favor of using native collection types directly (e.g., `list[str]`, `dict[str, int]`). While `typing-utils` can inspect these types, relying on the deprecated `typing` forms in your codebase might lead to linting warnings or compatibility issues with future Python versions or type checkers.","severity":"deprecated","affected_versions":"Python 3.9+"}],"env_vars":null,"search_vec":"'0.1.0':41 '2021':45 '3.8':23 'annot':16 'arg':32 'backport':18 'cadenc':50 'check':57 'current':38 'featur':19 'found':20 'get':29,31,34 'hint':36,53 'includ':27 'inspect':13,26 'issubtyp':28 'librari':9 'mainten':48 'may':44 'metaprogram':55 'origin':30 'provid':10 'python':8,14,22 'reflect':54 'releas':42,49 'suggest':46 'type':1,4,15,25,35,51,52,56 'typing-util':3 'util':2,5,11 'version':39","created_at":"2026-04-12T14:09:27.413867+00:00","updated_at":"2026-04-12T14:09:27.413867+00:00","problems":[],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.1.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/bojiang/typing_utils","docs":null,"changelog":null,"pypi":"https://pypi.org/project/typing-utils/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["type-stubs"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-30","next_check":"2026-07-28","install_tag":null}}