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.3.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.3-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bearcheck-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 e60bfde8dae0f78fa1cad33a32944cd7ca87bbe54430d96dc0d635d6d1fb8f08
MD5 856c39e2161e68a25cf6b363f8de3d8a
BLAKE2b-256 2fd63592b30a3152d4cd9c976356790d48c18a9b94b9b1eedfc2140d78c3ec65

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bearcheck-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d922f0aff51e193763ccd3e25836c40893d0d91c613238d89d0bb0a7eb01026f
MD5 02c6ad7d8d1af80f128453da10df81fc
BLAKE2b-256 f22e8782e9c7ceb1642b58357394176060dde50ed2ece85440676a16241272df

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