beartype
Unbearably fast near-real-time pure-Python runtime-static type-checker.
Decision gist · record as of 2026-08-14
Yes. Beartype is actively maintained, has no dependencies, and offers a practical way to catch type errors at runtime with minimal setup overhead. Install it if you want runtime type safety for your annotated code or need to validate type hints on third-party packages. The MIT license poses no restrictions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >=3.10.
- Installation is straightforward with no runtime dependencies.
- The package is actively maintained with a recent release and a stable codebase, making it a low-friction addition to existing projects.
License · maintenance · safety
permissive license (permissive) — MIT License permits unrestricted use, modification, and distribution with minimal obligations—suitable for both open-source and commercial projects.
last release 2025-12-13 (244 days) · last repo commit 2026-08-13 · 3,483 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 99,103,337 downloads/mo, #349 on PyPI
Alternatives
Verify before relying
pip install beartype
from beartype import beartype
@beartype
def greet(name: str) -> str:
return f"Hello, {name}!"
greet("Alice") # Works
greet(["invalid"]) # Raises BeartypeCallHintParamViolation- Performance overhead of runtime type checking on typical application workloads compared to static type checkers
- Compatibility with complex type hints (e.g., Protocol, TypeVar, forward references) beyond standard generic types
- Whether the 1µs type-checking performance claim in the description holds for real-world use cases
What it is and what it does
Beartype is a pure-Python runtime type checker that validates type hints at function call time, catching violations when they occur rather than at static analysis time. It works by decorating functions or entire packages to intercept calls and verify that arguments and return values match their annotated types. The package supports both granular control via the @beartype decorator on individual functions and whole-package instrumentation via beartype_this_package() or beartype_all(), allowing you to type-check your own code strictly while emitting warnings for violations in third-party dependencies.
The package emphasizes efficiency by generating optimized type-checking code at decoration time rather than performing expensive checks at runtime. It supports PEP-compliant type hints including generic types, Annotated validators, and custom type constraints. Beartype requires Python >=3.10 and has no external runtime dependencies, making it portable and easy to integrate into existing codebases.
Use it for
- Catch type mismatches in function calls during development and testing before they propagate to production
- Validate user input or API parameters against declared type hints to enforce data contracts
- Debug type-related issues in large codebases by enabling type checking on entire packages at startup
- Emit warnings for type violations in third-party dependencies without breaking the application
- Implement custom type constraints using Annotated validators to enforce domain-specific rules beyond basic type safety
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Beartype is actively maintained, has no dependencies, and offers a practical way to catch type errors at runtime with minimal setup overhead. Install it if you want runtime type safety for your annotated code or need to validate type hints on third-party packages. The MIT license poses no restrictions.
Install
beartype on PyPI
Before you install
Installation is straightforward with no runtime dependencies. The package is actively maintained with a recent release and a stable codebase, making it a low-friction addition to existing projects.
Requires Python >=3.10.
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal obligations—suitable for both open-source and commercial projects.
Quickstart
pip install beartype
from beartype import beartype
@beartype
def greet(name: str) -> str:
return f"Hello, {name}!"
greet("Alice") # Works
greet(["invalid"]) # Raises BeartypeCallHintParamViolation
Verify before relying
- Performance overhead of runtime type checking on typical application workloads compared to static type checkers
- Compatibility with complex type hints (e.g., Protocol, TypeVar, forward references) beyond standard generic types
- Whether the 1µs type-checking performance claim in the description holds for real-world use cases
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 244 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 99,103,337 / month, #349 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyTopic :: Software Development :: Code GeneratorsTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality AssuranceTyping :: Typed |
Evidence: beartype-0.22.9-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “annotated function validation”
- beartypeBeartype is a runtime type checker that validates Python type hints…
- annotated-typesProvides reusable metadata objects for use with PEP-593…
- annotated-docProvides a way to document function parameters, class attributes,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also pytest-beartype-tests · phantom-types · typeguard · nptyping · pytype · type-enforced · jaxtyping · typeapi · typish