PEP 827 type manipulation library for Python 3.14+
pip install typemapThis repository contains the typemap package, which provides utilities for working with PEP 827 type manipulation operators.
| Operator | TypeScript | Description |
|---|---|---|
eval_typing |
- | Evaluate type expressions at runtime |
Member |
MemberType |
Access type members by name |
Attrs |
- | Get class attributes |
Iter |
- | Iterate over type contents |
Param |
Parameter |
Define callable parameters |
UpdateClass |
- | Generate class modifications |
NewProtocol |
interface |
Create protocols dynamically |
IsAssignable |
extends |
Check type assignability |
KeyOf |
keyof |
Get all member names as tuple of Literals |
Template |
template literals | Build template literal strings |
DeepPartial |
DeepPartial |
Make all fields recursively optional |
Partial |
Partial |
Make all fields optional (non-recursive) |
Required |
Required |
Remove Optional from all fields |
Pick |
Pick |
Pick specific fields from a type |
Omit |
Omit |
Omit specific fields from a type |
See packages/typemap/README.md for detailed usage.
- Python 3.14+
- typing_extensions >= 4.0
This project is 100% inspired by vercel/python-typemap. All the credit and work goes to them - they are the real creators of this implementation.
This repository is simply a packaged version of the original work by Vercel. The goal is to make this PEP 827 implementation available on PyPI for easier installation and distribution.
All the intellectual work, research, and implementation was done by the Vercel team. They are the ones who wrote the PEP draft, created the prototype, and demonstrated what's possible with type manipulation in Python.
We hope with all our hearts that PEP 827 will be accepted. This PEP represents a major step forward for Python's type system and would enable powerful type-level computations that are currently only possible in TypeScript.
If you appreciate this work, please star and support the original vercel/python-typemap repository!