Consider improvements from Python 3.15
Author: Liam-DeVoeCreated May 21, 2026Updated Jul 25, 2026
Labelsinternals
Python 3.15 is now in feature freeze (whatsnew), though it won't come out for another 5 months. Once it does, here are the features we should consider for Hypothesis:
- Replace our usage of
bytes(bytearray(...))withbytearray.take_bytes, where appropriate - Replace
UniqueIdentifierwithsentinel.- This will resolve a long-standing pain point with type narrowing a
UniqueIdentifier, because you cannot narrow against a specific instance of aUniqueIdentifier(but can against asentinel).
- This will resolve a long-standing pain point with type narrowing a
- Investigate lazy imports (https://peps.python.org/pep-0810/)
- I need to read the lazy imports PEP more. Is there any downside if we move all of Hypothesis to lazy imports? The upside of faster import time is clear.
-bbis now deprecated. Should we remove it from all of our CI?- Can we use the new
math.issubnormal,math.fmax, ormath.signbitfunctions?
Source: HypothesisWorks/hypothesis