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

Uploaded Python 3

File details

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

File metadata

  • Download URL: bearcheck-0.1.0.tar.gz
  • Upload date:
  • Size: 1.3 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.0.tar.gz
Algorithm Hash digest
SHA256 6ae9bede78c2767481ad5349f42a74d125199aae89fbf2aac5721ab9eaaee705
MD5 932bdbe22fb3b7f19018e4fcce01a2a8
BLAKE2b-256 a25ad334c0cabd0106909a3463e6befbe4d3b62ce2752c3725d704c83946133a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bearcheck-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6288466f3e4d5f6dae8a58168b5d489be7308e0ac9f26d5b18640c6f43890a5f
MD5 f6dbd708998b07fa0f9d161d332e1510
BLAKE2b-256 ebfa0ac2fe758f81151ede4accc9e6d4009f9b63caff9a99edb583b105fccf6d

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