Skip to main content

Add your description here

Project description

bearcheck

Tiny extension to beartype, which allows inline type assertion and narrowing similar to check_type from typeguard.

Using bearcheck() is faster and safer than check_type(), since it leverages the incredibly fast beartype library for type checking, and allows specifying the exact return type.

Usage

from bearcheck import bearcheck, Check

var = bearcheck("a", Check[Literal["a", "b"]])
reveal_type(var)  # Type of "var" is "Literal['a', 'b']"

.. as opposed to ..

from typeguard import check_type

var = check_type("a", Literal["a", "b"])
reveal_type(var)  # Type of "var" is "Any"

type_check() returns Any if the type hint is not primitive, a common pitfall!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bearcheck-0.1.2.tar.gz (1.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bearcheck-0.1.2-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file bearcheck-0.1.2.tar.gz.

File metadata

  • Download URL: bearcheck-0.1.2.tar.gz
  • Upload date:
  • Size: 1.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for bearcheck-0.1.2.tar.gz
Algorithm Hash digest
SHA256 821effcfb5505776fc9e309f0f6982f14cfda0afc87f39993c2ce9f6900dcb06
MD5 8b360f5ac7f00897e4b2899b830e0d2b
BLAKE2b-256 3ce3d0a7fd279bc9690345b402bbabff53c33e87c7be7a764fe56d9d029c5b22

See more details on using hashes here.

File details

Details for the file bearcheck-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: bearcheck-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 2.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for bearcheck-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 861b6e3a4da9c2de98dc08f6120d795871644c8eafaca92a5923430a17c7bb12
MD5 c6ddb25197970ee6a4ea46aaf0000de2
BLAKE2b-256 a90f8e226f9de6196b71506c57b8a98f25ac669a0b8d7ba3fc1a63df26404fdb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page