undictify
Type-checked function calls at runtime
What it is and what it does
Undictify is a runtime type-checking library that automatically validates function arguments and constructor parameters against their type annotations. It solves the problem of untyped or loosely-typed data (from JSON, external APIs, or dynamic sources) flowing into functions that expect specific types—catching type mismatches at runtime rather than letting them propagate as silent bugs or cryptic errors downstream.
The library provides two main decorators: `@type_checked_call()` for functions and `@type_checked_constructor()` for class constructors. It's particularly useful for deserializing JSON into typed dataclasses or NamedTuples, where you can unpack a dictionary directly into a constructor and let undictify validate all fields match their declared types. It supports optional parameters, type conversions, and selective field skipping, making it practical for web handlers and data ingestion pipelines.
Use it for:
- Safely deserialize JSON responses into typed dataclasses without manual validation boilerplate
- Validate HTTP request arguments in Flask/FastAPI handlers where query params arrive as strings
- Catch type mismatches early when integrating with untyped or dynamically-typed libraries
- Enforce type contracts on constructor calls when unpacking dictionaries from external sources
- Reduce repetitive isinstance() checks in data validation code by deriving checks from annotations
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Enforces type annotations at runtime by wrapping function calls and constructors with automatic type-checking, raising TypeError when arguments don't match their declared types.
Yes, if you work with untyped data sources (JSON, APIs, user input) and want runtime type safety without manual validation code. The low install friction and permissive license make it a low-risk addition. However, note that maintenance is dormant (last release 2022-08-12); verify compatibility with your Python version and consider whether the package's scope matches your needs before adopting it for new projects.
Install
undictify on PyPI
pip
pip install undictifyuv
uv add undictifypoetry
poetry add undictifyInstalling undictify
Before you install
Low install friction; pure Python wheel with no runtime dependencies. Maintenance is dormant—last release was 2022-08-12, over 1463 days ago, though the repository remains active and unarchived.
License in practice
MIT license (permissive); you can use, modify, and distribute this package freely with minimal restrictions.
Quickstart
from undictify import type_checked_call
@type_checked_call()
def times_two(value: int) -> int:
return 2 * value
result = times_two(3) # works
times_two('3') # raises TypeError at runtime
Verify before relying
- Whether the package works correctly with Python versions beyond 3.9 (classifiers list only 3.7, 3.8, 3.9)
- Current compatibility with modern type annotation syntax (e.g., PEP 604 union syntax, PEP 585 generics)
- Performance overhead of runtime type-checking on high-frequency function calls
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 1,463 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 89,815/month — #13,634 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: undictify-0.11.3-py3-none-any.whl
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
runtypeRuntype provides runtime type validation,…
permissive · top 15,000 on PyPI
typing-jsonProvides type-aware JSON serialization and…
permissive · top 15,000 on PyPI
typed-json-dataclassAdds JSON serialization and type validation to…
permissive · top 15,000 on PyPI
decopatchDecopatch simplifies writing decorators in…
permissive · top 5,000 on PyPI
databind.jsonDeserializes and serializes Python dataclasses…
permissive · top 15,000 on PyPI
typedloadLoads and dumps JSON-like data into typed…
copyleft · top 1,000 on PyPI
wrapsProvides type-safe wrapper types for…
permissive · top 15,000 on PyPI
vkbottle-typesProvides type definitions and API method…
permissive · top 15,000 on PyPI
datetypeDateType provides type-checking-time wrapper…
unclear · top 15,000 on PyPI
empty-filesCreates minimal valid empty files of various…
permissive · top 15,000 on PyPI