pypi / hypothesis
hypothesis
What changed in hypothesis 6, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-19.
7 breaking8 new APIs and options8 performance20 behavior and defaults7 tooling45 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli inithypothesis 695 changes
Breaking changes 7
Support for Python 3.10 is dropped because it reached end of life in October 2026.
hypothesis.extra.pandas series(), indexes(), and column() accept timezone-aware dtypes, including coarser resolutions; generated values cover the representable range and include NaT unless the elements strategy excludes it. Requires pandas >= 2.1.
Building Hypothesis from source now requires a Rust toolchain unless installing from a native wheel.
dates() now raises InvalidArgument when a datetime is passed as min_value or max_value, instead of accepting the bounds and later failing with TypeError while generating examples.
Passing a dtype class where a dtype instance is expected now raises a clear error instead of a confusing message or silent coercion to the object dtype in arrays().
Generated dicts now vary iteration order instead of always placing required keys first, helping find code sensitive to key order. Use map(stable_sort_function) or similar for stable order.
The source code directory was renamed from hypothesis-python to hypothesis, which may affect tooling that relies on the directory name.
New APIs and options 8
Adds support for Python 3.16, which is still in alpha.
The .seed() method of randoms() accepts the same arguments as random.Random.seed(), including a= and version=. Calling it without a seed now raises a clearer error.
Test case observations now include a filename and line number for the status_reason, when known.
Values recorded with note() are now included as an ordered list of strings in each test-case observation's metadata.notes.
Adds efficient filtering that composes with consumes() in either order; filtered draws select among matching values and consume only the value actually drawn.
Adds an efficient mapping method that composes with consumes() in either order.
abi3 wheels are now published for 32-bit Linux and 32-bit Windows, making those distributions available for these platforms.
Hypothesis now publishes abi3 wheels built against the Python 3.10 stable ABI, in addition to version-specific wheels.
Performance 8
Generating unique collections, such as sets() or lists() with unique=True, is considerably more efficient because Hypothesis avoids draws that would be rejected.
Statistics summarisation no longer has quadratic-time behaviour, avoiding an apparent hang after the last test case when running under pytest with more than 100k test cases.
Rejected drawn elements are marked as discarded, allowing the shrinker to delete them wholesale and generation to avoid revisiting choices that would be rejected again.
Improves performance when one_of() can be simplified to a single real strategy, such as st.integers() | st.nothing().
Improves performance for unique collections drawn from a fixed pool of elements under symbolic-execution backends such as hypothesis-crosshair.
Shrinking large floats, strings, and bytestrings is now much faster in some cases.
from_type() resolves each type only once for hierarchies of abstract classes whose subclasses refer back to the base class in their annotations, improving performance from cubic time in the number of subclasses.
Performance improved for stateful testing of state machines with a large number of rules.
Behavior and default changes 20
Adds support for running Hypothesis on PyPy 3.12.
datetimes() now generates tricky datetimes more often, including values near offset transitions, leap seconds, and well-known dates.
The explain phase now varies interactive draws from data(), annotating freely-variable draws with a comment like @given arguments.
For max_examples budgets above 1000, optimisation starts earlier and alternates with generation while scores improve, rather than running one pass halfway through the run.
Values from specific branches of unions can now be re-encoded and shrunk as if generated by wider branches for more strategy combinations.
characters() now warns when the codec can generate characters that encode successfully but do not decode back to the same character. Use include_characters to generate them without the warning, or exclude_characters to generate only round-tripping characters.
Generated async functions follow Trio-style checkpoint semantics.
functions() generates functions of the same kind as like=, supporting async functions, generator functions, and async generator functions as well as plain functions.
pure=True is supported only for plain functions.
Generated generator functions yield values drawn from returns; return-type annotations such as Iterator[int] or AsyncIterator[int] can infer the returns strategy.
Constants collection now also collects the float components of complex literals like "3.5j".
The vendored top-level-domain list used by the provisional domains() strategy was updated.
When the returns= strategy can produce only one value, generated functions are displayed as a constant lambda instead of listing each call separately.
Accepts timezone-aware min_value and max_value bounds, treated as moments in time; timezones defaults to timezones(), and mixing an aware and naive bound raises an error.
When annotated-types has been imported, overloaded type hints distinguish naive from aware datetimes using Timezone metadata.
Now supports the annotated-types Timezone constraint on datetime and time.
Under symbolic backends, observability output now displays arguments generated by data as data(...).
from_dtype() supports numpy.dtypes.StringDType and generates arbitrary strings via text().
The mapping and optional arguments can have different key and value types, which are unioned in the inferred result.
The error message now describes what differed between generation runs and the strategy stack; in stateful tests, it also reports the steps leading up to the error.
Tooling 7
The conformance test can test providers with required constructor arguments, runs many test cases per provider, treats entropy exhaustion as expected control flow, and checks that providers generate a representative range of values.
abi3 wheels are now published for Linux s390x (manylinux) and Linux i686 (musllinux), making those platform-specific wheels available to developers.
abi3 wheels are now published for Linux armv7l on both manylinux and musllinux.
Hypothesis publishes native wheels for a range of Python versions and platforms, allowing installation without building from source.
Hypothesis publishes wheels for Pyodide on wasm32-unknown-emscripten for Python 3.13.
Its type annotations now accept a Mapping instead of requiring an invariant dict, allowing type-checkers to infer generated types for heterogeneous strategies.
The canonical git tag scheme changed from hypothesis-python-X.Y.Z to vX.Y.Z; distributions and build scripts relying on the old scheme should update.
Fixes and other changes 45
Integer draws can now generate negative values, and string draws from an empty alphabet return the empty string instead of consuming the whole buffer.
Verbose output for stateful tests now reads "Test case: <state machine>" rather than trailing off after the colon.
Fixes an error on Python 3.14 when applying @given with explicit strategies to functions whose annotations refer to types available only during type checking.
Ghostwriter now raises a helpful error for functions with no arguments instead of writing a test with an invalid empty @given() decorator.
Calling .map() or .flatmap() on data() with a keyword argument now raises the intended unsupported-operation error instead of a generic unexpected-keyword error.
Corrects the type annotation to indicate that from_field() returns a strategy for values of the field, not instances of the field type.
Writes to the cache of constants collected from local source files are now atomic, preventing concurrent processes from reading partially written files and silently changing data generated for a given seed.
An error during an internal cache update no longer leaves the cache corrupted.
Test cases that exceed the maximum allowed size now report a nonempty status_reason.
Failing cases found when possible inputs were fully enumerated now run the shrink and explain phases.
The explain phase now reports that commented parts can be varied together when the failing example ends with an uncommented part.
Fixes the shrink pass's type check, preventing incorrect handling of float precision loss above MAX_PRECISE_INTEGER.
Character classes combining a negative category with other members now match the union of their members.
Subpatterns that cannot be generated from the alphabet no longer raise an error when they may be repeated zero times.
Patterns compiled with re.ASCII now handle inverted categories, explicit characters and ranges, and casefolding correctly.
Provides a better error message when the passed pattern and alphabet are incompatible.
from_type() can now resolve the new sentinel builtin.
Hypothesis adds support for Python 3.15.
abi3 wheels are now published for Windows arm64 and Linux ppc64le (manylinux and musllinux), making these distributions available for installation on those platforms.
Fixes float generation so negative floats can be produced for a 65-bit float index format.
The explain phase no longer reports lines inside the standard library, avoiding misleading explanations.
The alphabet argument now accepts any collection of length-one strings, including tuples and lists of characters, matching the existing behavior of text().
Objects' _repr_pretty_() methods are respected in additional places, including the arguments of a failing example.
Fixes lambda display so it no longer shows the definition of an unrelated lambda with the same arguments, such as a function generated by functions() in a failing example.
Hypothesis now publishes abi3 wheels for Linux riscv64 with both manylinux and musllinux tags, enabling wheel installation on those platforms.
Terminal strategies now generate only strings that the lexer matches in their entirety, avoiding strings that fail to parse.
User-facing documentation, log messages, and error messages now call a single execution a “test case” instead of an “example”; some observability fields may change format.
Simple comparison filters are rewritten into efficient bounds, including bounds inferred from annotated types; contradictory filters produce an empty strategy instead of failing health checks.
Simple comparison filters are rewritten into efficient bounds, including bounds inferred from annotated types; contradictory filters produce an empty strategy instead of failing health checks.
Now resolves the typing-extensions TypeAliasType backport as well as the native form from Python 3.12+.
Suggests subscripting generic aliases such as annotated_types.LowerCase when they are mistakenly passed as Annotated metadata.
Calling flatmap on a consumes() bundle no longer raises an error.
Fixes artifact downloads failing because of a colliding Authorization header.
Source distributions are now uploaded to PyPI, allowing developers to obtain the package in source-distribution form.
Fixes a KeyError when reading artifacts whose zip files contain no explicit directory entries, including zips produced by actions/upload-artifact.
Concurrent use of the same strategy instance no longer errors in rare cases due to a thread-safety bug.
Rewriting a dates filter no longer triggers a stray print().
Hypothesis no longer emits a test_case observation when an alternative backend aborts an iteration with BackendCannotProceed before the test body runs, preventing spurious passed observations.
Fixes from_type() resolution to defer recursive forward references eagerly, avoiding recursion-limit failures and using a small, constant amount of stack.
The report now accounts for the Phase.explain phase separately instead of including its runtime and test cases in the Phase.shrink phase.
fuzz_one_input now tracks interesting_origin, so the database saves the smallest example of each distinct failure and observability reports include the origin.
Fixes decimals() generating values outside min_value and max_value when those bounds have more fractional digits than places.
Fixes incorrect git patch files when a file does not have a trailing newline.
event()'s payload is now typed as accepting Any, matching its runtime behavior of accepting any string-coercible object.
from_type() now resolves recursive forward references by looking them up in the caller's namespace, including references inside type[...].