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.1.tar.gz (1.4 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.1-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bearcheck-0.1.1.tar.gz
  • Upload date:
  • Size: 1.4 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.1.tar.gz
Algorithm Hash digest
SHA256 b2806966113e1e825ef3aab4ffb8800080223de6020ae68342a41f733321ad64
MD5 12b7d875237ce675cea90929f3e70e8b
BLAKE2b-256 bd40e1a34fcb6720609ad0e9978337476b731c277139d9b92eeb8387ebd3d205

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bearcheck-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 12427b5dd3b435d7e6abab1017de949153231da67482051b05de0f9328e286f9
MD5 2d75e673891b132c703b14fdd8609c30
BLAKE2b-256 6f1c5abcbcc1a9278275cfd44fc07aaa423abc79d7935bf3f4921d7667983aed

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