-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
[Feature Request] Add a new BeartypeConf.strategy_O1_check_sequence_index
option enabling callers to deterministically type-check sequences
#385
Comments
Superb request! Yes. So much yes. You're right, of course. This is an excellent feature request. Deterministic CI is a lofty goal. @beartype should support you in that goal, @avolchek. You literally already resolved super-nasty issue #382 for us. Quid pro quo and my genteel nature demands I do this for you and your justifiably frustrated colleague. When colleagues are frustrated with @beartype, only one of us can be right – and it's probably not @beartype. Bad bear. 🐻 😠 🐻 This Plan: It Is a Good PlanLet's add a new # In your "{your_package}.__init__" submodule:
from beartype import BeartypeConf
from beartype.claw import beartype_this_package
beartype_this_package(conf=BeartypeConf(strategy_O1_check_sequence_index=0)) The idea here is pretty simple.
This is (...probably) trivial stuff. So, this will (...probably) make it into our upcoming @beartype 0.19.0 release. Let's see if @leycec does anything at all! So sleepy. 🥱 |
Discussed in #383
Originally posted by avolchek May 23, 2024
Hi!
The documentation states that for the O1 strategy, only one element of the container is selected, and the selection is random. Is it possible to replace random selection with a more deterministic approach (e.g., selecting the first element)?
The problem with random selection is that it makes tests in CI less robust. For example, I enabled type-checking in some tests in my codebase, and they passed successfully. However, this was only because the random selection chose a "good" element from the container. The next day, my colleague changed an unrelated piece of code, altering the RNG state. As a result, a "bad" element was selected, causing Beartype to complain, and the test failed, leading to my colleague's frustration.
My codebase is large, with many people working on it. It would be great to be able to disable randomness via configuration to avoid situations like the one mentioned above :)
The text was updated successfully, but these errors were encountered: