skillfed

typepy

typepy is a Python library for variable type checker/validator/converter at a run time.

typepy v2.0.0 9.7M downloads/30d#1,510 on PyPI17
Permissive license MIT License Active released

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 typepy

uv

uv add typepy

poetry

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 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Information TechnologyLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules

Tags

runtime type checking and validationtype conversion between python typesvalidate variable types at runtimetype checker validator converterpython type validation libraryconvert string to number typescheck if value matches type
type-validationdata-coercioninput-validation

More Libraries packages