eval-type-backport
Like `typing._eval_type`, but lets older Python versions use newer typing features.
Install
eval-type-backport on PyPI
pip
pip install eval-type-backportuv
uv add eval-type-backportpoetry
poetry add eval-type-backportPackage facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 72 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: eval_type_backport-0.4.0-py3-none-any.whl
About eval-type-backport
from the package's own PyPI description — quoted content, verbatim
eval_type_backport
Build Status (image) Coverage Status (image) Supports Python versions 3.7+, including PyPy (image) Anaconda (image)
This package makes runtime typing inspection with the typing module possible with newer syntax in older Python versions.
Specifically, this transforms X | Y into typing.Union[X, Y]
and list[X] into typing.List[X] etc. (for all the types made generic in PEP 585)
if the original syntax is not supported in the current Python version.
For users of Pydantic, merely having this package installed should make Pydantic models with newer syntax work in older Python versions.
Here's an example of how to use it...
Read as markdown · JSON record · Source repository · Homepage
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
eval_type_backport enables runtime type inspection with modern Python typing syntax (like `X | Y` and `list[X]`) on older Python versions by transforming them into their `typing` module equivalents. It works transparently with Pydantic and other libraries that rely on `typing._eval_type`.
Installation is straightforward with no runtime dependencies and low friction. The package is actively maintained with a recent release (72 days ago) and has been stable since its initial release in November 2023.
Licensed under MIT (permissive), so there are no restrictions on commercial or proprietary use, and the license imposes minimal obligations beyond attribution.
Usage
pip install eval-type-backport
import typing
from eval_type_backport import install_patch
install_patch()
class Foo:
a: 'int | str'
print(typing.get_type_hints(Foo))
Requires Python 3.7 or later; the package is designed to backport syntax from newer Python versions, so it is most useful on Python 3.9 and earlier where the native `|` union operator and generic built-in types are not yet supported.
Verdict: eval_type_backport is a lightweight, actively maintained utility that solves a real compatibility problem for projects using modern typing syntax on older Python versions. With no dependencies, permissive licensing, and clean API design, it is a low-risk addition for anyone supporting Python 3.7–3.9 alongside newer versions.
Needs verification
- Whether the package is widely adopted in production (popularity tier 'top_1000' is relative; absolute download volume unknown)
- Performance overhead of the monkey-patching approach in large applications
- Completeness of backport coverage for all PEP 585 generic types and edge cases
Similar packages
permissive · top 100 on PyPI
typing-inspectpermissive · top 1,000 on PyPI
executingpermissive · top 1,000 on PyPI
pure-evalpermissive · top 1,000 on PyPI
stack-datapermissive · top 1,000 on PyPI
pydantic-extra-typespermissive · top 1,000 on PyPI
pathlib-abcpermissive · top 1,000 on PyPI
pytest-mockpermissive · top 1,000 on PyPI
exceptiongrouppermissive · top 1,000 on PyPI
backports.zstdpermissive · top 1,000 on PyPI