{"slug": "beartype", "name": "beartype", "category": "dev-libs", "category_name": "Libraries and frameworks", "description": "", "recommenders": 4, "commenters": 4, "warners": 0, "score": 3.385, "rising": -1.31, "first": "2025-11-05", "latest": "2026-03-16", "why": "My main use of beartype is `is_bearable` for runtime checking", "why_is_quote": true, "has_verdict": false, "sentiment": {"recommend": 4, "neutral": 1, "compare": 0, "warn": 0}, "spark": [1, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0], "listed": true, "loved": [], "caveat": "", "short_quote": "My main use of beartype is `is_bearable` for runtime checking", "kind": "", "icon": true, "domain": null, "github_repo": "github.com/beartype/beartype", "official_url": "https://beartype.readthedocs.io", "pricing": "", "aliases": ["beartype", "Beartype"], "verdict": null, "praise": [{"label": "", "summary": "", "quotes": [{"id": 758424288, "item_id": 47401518, "url": "https://news.ycombinator.com/item?id=47401518", "by": "westurner", "date": "2026-03-16", "stance": "recommend", "quote": "Or beartype.", "excerpt": "- /?hnlog pycontract icontract https://westurner.github.io/hnlog/ : From https://news.ycombinator.com/item?id=14246095 (2017) : > PyContracts supports runtime type-checking and value constraints/assertions (as @contract decorators, annotations, and docstrings). > Unfortunately, there's yet no unifying syntax between PyContracts and the newer python type annotations which MyPy checks at compile-type. Or beartype. Pyco", "context": "", "use_case": "", "switched_from": "", "story": "Comparing Python Type Checkers: Typing Spec Conformance"}, {"id": 758410450, "item_id": 47400653, "url": "https://news.ycombinator.com/item?id=47400653", "by": "dcreager", "date": "2026-03-16", "stance": "recommend", "quote": "you can opt in to that using something like beartype", "excerpt": "Can you elaborate what you mean by decorative? If you run a type checker like ty or pyright they're not decorative \u2014 you'll get clear diagnostics for that particular example [1], and any other type errors you might have. You can set up CI so that e.g. blocks PRs from being merged, just like any other test failure. If you mean types not being checked at runtime, the consensus is that most users don't want to pay the c", "context": "", "use_case": "Runtime type checking", "switched_from": "", "story": "Comparing Python Type Checkers: Typing Spec Conformance"}, {"id": 755707984, "item_id": 47231749, "url": "https://news.ycombinator.com/item?id=47231749", "by": "maleldil", "date": "2026-03-03", "stance": "recommend", "quote": "My main use of beartype is `is_bearable` for runtime checking", "excerpt": "Me neither! I was just mentioning it as a possibility. My main use of beartype is `is_bearable` for runtime checking of specific data structures, in cases where `isinstance` isn't quite enough. I would still explore turning full checks during tests, though [1]. [1] https://github.com/beartype/pytest-beartype", "context": "", "use_case": "Runtime type checking", "switched_from": "", "story": "Python Type Checker Comparison: Empty Container Inference"}, {"id": 744793616, "item_id": 46549601, "url": "https://news.ycombinator.com/item?id=46549601", "by": "westurner", "date": "2026-01-08", "stance": "recommend", "quote": "Welcome to the Bearpedia", "excerpt": "Oh my! beartype docs: https://beartype.readthedocs.io/en/latest/ : > Welcome to the Bearpedia trycast: https://github.com/davidfstr/trycast : from typing import TypedDict, Literal", "context": "", "use_case": "Runtime type checking", "switched_from": "", "story": "Why AI is pushing developers toward typed languages"}, {"id": 733229008, "item_id": 45826813, "url": "https://news.ycombinator.com/item?id=45826813", "by": "setopt", "date": "2025-11-05", "stance": "recommend", "quote": "I use Beartype to get runtime type checks", "excerpt": "I agree. I use Beartype to get runtime type checks, but it shouldn\u2019t be necessary. Some support for type checking, whether at byte compile time or runtime, should land upstream.", "context": "", "use_case": "", "switched_from": "", "story": "SPy: An interpreter and compiler for a fast statically typed variant of Python"}]}], "caveats": [], "who": [], "tags": [], "use_cases": ["runtime type checking"], "compared": [{"slug": "pydantic", "name": "Pydantic", "co": 2, "switched_from": 0, "switched_to": 0}], "makers": [], "threads": [{"url": "https://news.ycombinator.com/item?id=47398023", "title": "Comparing Python Type Checkers: Typing Spec Conformance", "mentions": 2}, {"url": "https://news.ycombinator.com/item?id=47151367", "title": "Python Type Checker Comparison: Empty Container Inference", "mentions": 2}, {"url": "https://news.ycombinator.com/item?id=46547981", "title": "Why AI is pushing developers toward typed languages", "mentions": 1}, {"url": "https://news.ycombinator.com/item?id=45761594", "title": "SPy: An interpreter and compiler for a fast statically typed variant of Python", "mentions": 1}], "sentiment_by_month": {"2025-11": {"recommend": 1}, "2025-12": {}, "2026-01": {"recommend": 1}, "2026-02": {}, "2026-03": {"neutral": 1, "recommend": 2}, "2026-04": {}, "2026-05": {}, "2026-06": {}, "2026-07": {}, "2026-08": {}, "2026-09": {}, "2026-10": {}}, "quotes": [{"id": 758424288, "item_id": 47401518, "url": "https://news.ycombinator.com/item?id=47401518", "by": "westurner", "date": "2026-03-16", "stance": "recommend", "quote": "Or beartype.", "excerpt": "- /?hnlog pycontract icontract https://westurner.github.io/hnlog/ : From https://news.ycombinator.com/item?id=14246095 (2017) : > PyContracts supports runtime type-checking and value constraints/assertions (as @contract decorators, annotations, and docstrings). > Unfortunately, there's yet no unifying syntax between PyContracts and the newer python type annotations which MyPy checks at compile-type. Or beartype. Pyco", "context": "", "use_case": "", "switched_from": "", "story": "Comparing Python Type Checkers: Typing Spec Conformance"}, {"id": 758410450, "item_id": 47400653, "url": "https://news.ycombinator.com/item?id=47400653", "by": "dcreager", "date": "2026-03-16", "stance": "recommend", "quote": "you can opt in to that using something like beartype", "excerpt": "Can you elaborate what you mean by decorative? If you run a type checker like ty or pyright they're not decorative \u2014 you'll get clear diagnostics for that particular example [1], and any other type errors you might have. You can set up CI so that e.g. blocks PRs from being merged, just like any other test failure. If you mean types not being checked at runtime, the consensus is that most users don't want to pay the c", "context": "", "use_case": "Runtime type checking", "switched_from": "", "story": "Comparing Python Type Checkers: Typing Spec Conformance"}, {"id": 755707984, "item_id": 47231749, "url": "https://news.ycombinator.com/item?id=47231749", "by": "maleldil", "date": "2026-03-03", "stance": "recommend", "quote": "My main use of beartype is `is_bearable` for runtime checking", "excerpt": "Me neither! I was just mentioning it as a possibility. My main use of beartype is `is_bearable` for runtime checking of specific data structures, in cases where `isinstance` isn't quite enough. I would still explore turning full checks during tests, though [1]. [1] https://github.com/beartype/pytest-beartype", "context": "", "use_case": "Runtime type checking", "switched_from": "", "story": "Python Type Checker Comparison: Empty Container Inference"}, {"id": 755595873, "item_id": 47224742, "url": "https://news.ycombinator.com/item?id=47224742", "by": "maleldil", "date": "2026-03-02", "stance": "neutral", "quote": "such as beartype", "excerpt": "That depends on what you're using. If you're using Pydantic, which lets you define a struct-like data type with validation, you can tell it to validate assignments as well [1]. Or you can set the class as frozen and forbid assignment entirely [2]. However, if you mean annotating a local variable with a type, then no, nothing will stop it at runtime. If you use a type checker, though, it will tell you that statically.", "context": "", "use_case": "runtime type checking", "switched_from": "", "story": "Python Type Checker Comparison: Empty Container Inference"}, {"id": 744793616, "item_id": 46549601, "url": "https://news.ycombinator.com/item?id=46549601", "by": "westurner", "date": "2026-01-08", "stance": "recommend", "quote": "Welcome to the Bearpedia", "excerpt": "Oh my! beartype docs: https://beartype.readthedocs.io/en/latest/ : > Welcome to the Bearpedia trycast: https://github.com/davidfstr/trycast : from typing import TypedDict, Literal", "context": "", "use_case": "Runtime type checking", "switched_from": "", "story": "Why AI is pushing developers toward typed languages"}, {"id": 733229008, "item_id": 45826813, "url": "https://news.ycombinator.com/item?id=45826813", "by": "setopt", "date": "2025-11-05", "stance": "recommend", "quote": "I use Beartype to get runtime type checks", "excerpt": "I agree. I use Beartype to get runtime type checks, but it shouldn\u2019t be necessary. Some support for type checking, whether at byte compile time or runtime, should land upstream.", "context": "", "use_case": "", "switched_from": "", "story": "SPy: An interpreter and compiler for a fast statically typed variant of Python"}]}