typepy
typepy is a Python library for variable type checker/validator/converter at a run time.
What it is and what it does
Typepy is a runtime type-checking and conversion library that wraps Python's built-in types and adds specialized validators for domains like IP addresses and null strings. It provides three main operations: is_type() to check if a value matches a type class, validate() to raise an exception on mismatch, and convert()/try_convert()/force_convert() to coerce values between types with varying strictness.
The library is useful when you need to enforce or transform types in data pipelines, user input validation, or configuration parsing. It depends only on mbstrdecoder and works across Python 3.9 through 3.14, making it a lightweight addition to projects that handle mixed or uncertain input types.
Use it for:
- Validate user input in web forms or APIs before processing (e.g., ensure a field is a valid integer or IP address).
- Convert CSV or JSON data fields to the correct Python type with clear error handling.
- Check and coerce configuration values at application startup.
- Build data pipelines that need to handle heterogeneous input types safely.
- Implement strict type contracts in data validation layers without external schema libraries.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Typepy checks, validates, and converts Python variable types at runtime, supporting built-in types like bool, int, float, str, list, dict, datetime, and specialized types like IP addresses and null strings.
Yes. Typepy is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and installs with minimal friction. It's a focused tool for a common problem—runtime type validation and conversion—and ranks in the top 5000 PyPI packages by download volume. Install it if your code needs to safely check or coerce types at runtime.
Install
typepy on PyPI
pip
pip install typepyuv
uv add typepypoetry
poetry add typepyInstalling typepy
Before you install
Low friction: pure Python wheel with a single runtime dependency (mbstrdecoder). Actively maintained with a recent release and current Python version support through 3.14.
License in practice
MIT License permits unrestricted use, modification, and distribution with only attribution required—no restrictions on commercial or proprietary use.
Quickstart
pip install typepy
from typepy import Integer, String
# Type check
print(Integer(1).is_type()) # True
print(Integer(1.1).is_type()) # False
# Type conversion
print(Integer("1").convert()) # 1
Requires Python 3.9 or later. Optional: install typepy[datetime] for DateTime class support.
Verify before relying
- Whether the package handles edge cases in type coercion (e.g., leading/trailing whitespace in string conversions).
- Performance characteristics when validating large collections or nested structures.
- Behavior of strict_level parameter and how it affects validation across different type classes.
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — mbstrdecoder |
| Maintenance | actively maintained — 97 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 9,663,651/month — #1,510 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: typepy-2.0.0-py3-none-any.whl
Keywords: library, type-checking, type-conversion, validator
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
DataPropertyExtracts and classifies properties from…
permissive · top 5,000 on PyPI
fastnumbersConverts strings and other inputs to numbers…
permissive · top 15,000 on PyPI
typing-validationRuntime validation of Python objects against…
copyleft · top 15,000 on PyPI
validator-collectionProvides 60+ validator functions for checking…
permissive · top 15,000 on PyPI
phantom-typesPhantom types enable you to create type-safe…
permissive · top 15,000 on PyPI
msgfyConverts Python Exception instances into…
permissive · top 15,000 on PyPI
infinityProvides an Infinity class that can be compared…
permissive · top 15,000 on PyPI
type-enforcedEnforces Python type annotations at runtime…
permissive · top 15,000 on PyPI
types-ipaddressProvides type stubs for Python's standard…
permissive · top 15,000 on PyPI
strongtypingA runtime type-checking decorator that…
permissive · top 15,000 on PyPI