--- id: typepy version: "2.0.0" license: MIT License license_treatment: permissive maintenance: active --- # typepy — typepy is a Python library for variable type checker/validator/converter at a run time. License: permissive · Maintenance: active · Downloads: 9.7M/mo ## 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 above — 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 pip install typepy uv add typepy poetry add typepy ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 9.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags runtime type checking and validation, type conversion between python types, validate variable types at runtime, type checker validator converter, python type validation library, convert string to number types, check if value matches type, type-validation, data-coercion, input-validation [View on SkillFed](https://skillfed.io/packages/typepy) · [View on PyPI](https://pypi.org/project/typepy/)