skillfed

typeapi

typeapi v2.3.0 260.7K downloads/30d#8,394 on PyPI8
Permissive license MIT Active released

What it is and what it does

typeapi is a reflection library that standardizes how you inspect and work with Python type hints at runtime. It wraps the complexity of Python's typing module across different versions and provides a consistent interface for examining type annotations, whether they're simple types like `int`, generic types like `list[str]`, or union types like `int | str`. The package is particularly useful because it lets you use modern type syntax (PEP 585 and PEP 604) on Python versions that don't natively support them, bridging compatibility gaps.

The library depends only on typing-extensions and targets Python 3.8 and newer. It's actively maintained and carries no known security vulnerabilities. The MIT license places no restrictions on how you use it.

Use it for:

  • Evaluate modern type hint syntax like `list[str]` and `int | str` on Python versions where native support is unavailable.
  • Build type-aware code generation or validation tools that need a consistent API across Python versions.
  • Implement runtime type checking or serialization frameworks that require deep introspection of type annotations.
  • Create documentation or IDE tooling that needs to analyze and display type information uniformly.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a unified API for reflecting and introspecting Python type hints, including support for evaluating modern type syntax (PEP 585, PEP 604) on older Python versions.

Yes, if you need to work with type hints at runtime or support older Python versions while using modern type syntax. The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it a safe choice. Install only if you actually need type introspection; it's a specialized tool, not a general utility.

Install

typeapi on PyPI

pip

pip install typeapi

uv

uv add typeapi

poetry

poetry add typeapi

Installing typeapi

Before you install

Low friction install with a single runtime dependency (typing-extensions). Actively maintained with recent releases; last commit 2026-04-09 and latest release 2025-10-23 indicate ongoing development.

License in practice

MIT license permits unrestricted use, modification, and distribution in both open and closed projects with minimal obligations.

Quickstart

pip install typeapi

from typeapi import TypeHint

hint = TypeHint.from_string('list[str]')
print(hint)

Requires Python 3.8 or newer.

Verify before relying

  • Whether typeapi handles all edge cases in type hint evaluation or has known limitations with complex nested generics.
  • Performance characteristics when evaluating large numbers of type hints or deeply nested type structures.
  • Specific use cases where this unified API provides advantages over direct use of the typing module.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 1 — typing-extensions
Maintenance actively maintained — 295 days since the last release
Last repo commit
First released
Downloads 260,683/month — #8,394 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: typeapi-2.3.0-py3-none-any.whl

Tags

python type hint introspectiontype annotation reflection apipep 585 pep 604 supportruntime type hint evaluationtyping introspection librarytype hint compatibility layerpython type system reflection
type-hintsreflectioncompatibility

More Software Development packages