eval-type-backport
Like `typing._eval_type`, but lets older Python versions use newer typing features.
Decision gist · record as of 2026-08-14
Yes, if you need to support older Python versions (3.7–3.9) while using modern typing syntax. The package is lightweight, actively maintained, has no dependencies, and solves a real compatibility gap—especially valuable for Pydantic users. No security issues reported. Install it if your project's Python support matrix spans pre-3.10 versions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.7 or later; the patch is most useful on Python 3.9 and earlier where the native `|` union syntax and generic built-in types are not yet supported.
- Low friction: pure Python wheel with no runtime dependencies.
- Repository is active with a recent commit on 2026-06-02, though the project is small (19 stars).
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use this package freely in commercial and private projects with minimal restrictions.
last release 2026-06-02 (73 days) · last repo commit 2026-06-02 · 19 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 36,627,057 downloads/mo, #732 on PyPI
Alternatives
Verify before relying
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))- Whether the patch affects performance or has measurable overhead in type hint evaluation.
- Compatibility edge cases with complex nested generic types or forward references beyond the documented examples.
- Full scope of PEP standards addressed beyond PEP 585 mentioned in the description.
What it is and what it does
eval_type_backport solves the problem of using modern Python typing syntax in codebases that must support older Python versions. It monkey-patches the `typing` module to transform newer syntax like `X | Y` (union) and `list[X]` (generic built-in types) into their `typing.Union` and `typing.List` equivalents at runtime, allowing code written with newer syntax to evaluate correctly on Python 3.7–3.9.
The package is designed primarily to support Pydantic models, which use the protected `typing._eval_type` function internally. You can either call `install_patch()` globally to make the transformation automatic everywhere, or use `eval_type_backport.eval_type_backport` directly as a drop-in replacement for `typing._eval_type` where you need it. It has no runtime dependencies and installs as a pure Python wheel.
Use it for
- Maintain Pydantic models with modern type hints while supporting Python 3.7–3.9 in production.
- Backport newer typing syntax to older Python versions without rewriting type annotations.
- Enable `typing.get_type_hints()` to work on classes using `|` unions and generic built-ins in Python 3.9.
- Patch typing globally in a library to ensure all downstream code benefits from syntax compatibility.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to support older Python versions (3.7–3.9) while using modern typing syntax.
The package is lightweight, actively maintained, has no dependencies, and solves a real compatibility gap—especially valuable for Pydantic users. No security issues reported. Install it if your project's Python support matrix spans pre-3.10 versions.
Install
eval-type-backport on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Repository is active with a recent commit on 2026-06-02, though the project is small (19 stars).
Requires Python 3.7 or later; the patch is most useful on Python 3.9 and earlier where the native `|` union syntax and generic built-in types are not yet supported.
License in practice
MIT license is permissive; you can use this package freely in commercial and private projects with minimal restrictions.
Quickstart
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))
Verify before relying
- Whether the patch affects performance or has measurable overhead in type hint evaluation.
- Compatibility edge cases with complex nested generic types or forward references beyond the documented examples.
- Full scope of PEP standards addressed beyond PEP 585 mentioned in the description.
Package 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 73 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 36,627,057 / month, #732 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: eval_type_backport-0.4.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “python typing backport”
- eval-type-backportEnables newer Python typing syntax (like `X | Y` and `list[X]`) to…
- typingProvides type hints and annotations for Python 2.7 and Python 3.4,…
- typing-extensionsProvides backported and experimental type hints for Python 3.9+,…
Give your agent the search over MCP, or paste the wish link into any chat.
Similar packages
Provides utilities to inspect and validate Python type annotations, including functions to check subtype relationships, extract type origins and arguments, and resolve forward references in type hints.
Provides type hints and annotations for Python 2.7 and Python 3.4, backporting the standard library typing module to versions before 3.5.
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.
Install only if you actually need type introspection; it's a specialized tool, not a general utility.
Provides a backport of Python 3.9's pkgutil.resolve_name function, allowing you to resolve a dotted name string to the actual object it refers to on older Python versions.
Provides the Python 3.4 ssl module API on older Python versions (2.6, 2.7, 3.2, 3.3) by wrapping pyOpenSSL, enabling modern SSL/TLS socket operations on legacy interpreters.
A flake8 plugin that detects and flags deprecated type imports from the `typing` module that should be replaced with standard library equivalents under PEP 585.
However, note that the project is abandoned (last release February 2023) and may not be updated for future flake8 or Python releases, so verify compatibility with…
See also qualname · typing-extensions · exceptiongroup · pathlib3x