annotated-types
Reusable constraint types to use with typing.Annotated
Install
annotated-types on PyPI
pip
pip install annotated-typesuv
uv add annotated-typespoetry
poetry add annotated-typesPackage facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 21 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the 100 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: annotated_types-0.8.0-py3-none-any.whl
About annotated-types
from the package's own PyPI description — quoted content, verbatim
annotated-types
CI (image) pypi (image) versions (image) license (image)
PEP-593 added typing.Annotated as a way of
adding context-specific metadata to existing types, and specifies that
Annotated[T, x] should be treated as T by any tool or library without special
logic for x.
This package provides metadata objects which can be used to represent common
constraints such as upper and lower bounds on scalar values and collection sizes,
a Predicate marker for runtime checks, and
descriptions of how we intend these metadata to be interpreted. In some cases,
we also note alternative representations which...
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
Provides reusable metadata objects for use with `typing.Annotated` to express common constraints like bounds, lengths, and predicates on values without requiring runtime checks.
Installs with zero runtime dependencies and low friction; actively maintained with recent releases and a healthy repository signal.
MIT license permits unrestricted use, modification, and distribution in both open and closed projects.
Usage
pip install annotated-types
from typing import Annotated
from annotated_types import Gt, Len
age: Annotated[int, Gt(18)]
my_list: Annotated[list[int], Len(0, 10)]
Requires Python 3.10 or later.
Verdict: A lightweight, zero-dependency library for expressing type constraints via PEP 593 annotations. Active maintenance, MIT license, and top-100 popularity make it a safe choice for projects needing declarative constraint metadata without runtime overhead.
Needs verification
- Whether downstream libraries actually interpret these metadata objects or if they are purely informational.
- Performance characteristics when used with large-scale type checking or validation frameworks.
Similar packages
permissive · top 1,000 on PyPI
typing-inspectpermissive · top 1,000 on PyPI
tzlocalpermissive · top 1,000 on PyPI
typing-inspectionpermissive · top 100 on PyPI
StrEnumpermissive · top 1,000 on PyPI
pytzpermissive · top 100 on PyPI
MarkupSafepermissive · top 100 on PyPI
cyclerpermissive · top 1,000 on PyPI
kiwisolverpermissive · top 1,000 on PyPI
python-slugifypermissive · top 1,000 on PyPI