Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add beartype checking #153

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

feat: add beartype checking #153

wants to merge 5 commits into from

Conversation

lu-pl
Copy link
Contributor

@lu-pl lu-pl commented Nov 30, 2024

Closes #152

@lu-pl lu-pl changed the title lupl/beartype feat: add beartype checking Nov 30, 2024
lu-pl added 4 commits December 1, 2024 06:40
beartype offers high performance runtime type checking based on type annotations.
Runtime checking can contribute to a healthier code base (see fixes)
and also allows fast failures with meaningful exceptions for library users.

Closes #152.
beartype revealed several incorrect typed annotations which lead to
failing tests.
Runtime checking mock objects is an interesting case!
Mock objects rightfully get rejected by runtime type checking,
the solution is to point the mock object's __class__ to the class of
the mocked object.

See beartype/beartype#92.
Package-wide beartype runtime checking requires
'beartype_this_package' to run *before* all other __init__ imports.

This is not PEP-8 compliant, see https://peps.python.org/pep-0008/#imports.
@lu-pl lu-pl requested a review from b1rger December 1, 2024 19:34
@b1rger b1rger removed their request for review December 3, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Runtime checking with beartype
1 participant