NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI, #384 most downloaded on PyPI
The property-based testing library for Python
Latest stable
6.170.15
Last release 12 days ago
06 Nov 2026
Ships on a steady schedule
a new release about every 9 days
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
1594 releases · first in 2013
Drag across the ruler to compare, or tap a release to open it.
This patch fixes an overly strict internal type assertion.
This patch fixes an overly strict internal type assertion.
This release improves our support for the annotated-types iterable GroupedMetadata protocol. In order to treat the elements "as if they had been unpac
This release improves our support for the annotated-types iterable GroupedMetadata protocol. In order to treat the elements "as if they had been unpacked", if one such element is a ~hypothesis.strategies.SearchStrategy we now resolve to that strategy. Previously, we treated this as an unknown filter predicate.
We expect this to be useful for libraries implementing custom metadata - instead of requiring downstream integration, they can implement the protocol and yield a lazily-created strategy. Doing so only if Hypothesis is in sys.modules gives powerful integration with no runtime overhead or extra dependencies.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
The ~hypothesis.extra.django.from_model function currently tries to create a strategy for ~django:django.db.models.AutoField fields if they don't have
The ~hypothesis.extra.django.from_model function currently tries to create a strategy for ~django:django.db.models.AutoField fields if they don't have ~django:django.db.models.Field.auto_created set to True. The docs say it's supposed to skip all ~django:django.db.models.AutoField fields, so this patch updates the code to do what the docs say (3978).
The from_model() function currently tries to create a strategy for AutoField fields if they don’t have auto_created set to True . The docs say it’s supposed to skip all AutoField fields, so this patch updates the code to do what the docs say ( issue #3978 ).
This patch adds some internal type annotations (3074). Thanks to Andrew Sansom for his contribution!
This patch adds some internal type annotations (3074). Thanks to Andrew Sansom for his contribution!
This patch fixes a rare internal error when using ~hypothesis.strategies.integers with a high max_examples setting (3974).
This patch fixes a rare internal error when using ~hypothesis.strategies.integers with a high max_examples setting (3974).
This patch fixes a rare internal error when using integers() with a high max_examples setting ( issue #3974 ).
This patch improves our internal caching logic. We don't expect it to result in any performance improvements (yet!).
This patch improves our internal caching logic. We don't expect it to result in any performance improvements (yet!).
This patch turns off a check in ~hypothesis.register_random for possibly unreferenced RNG instances on the free-threaded build of CPython 3.13 because
This patch turns off a check in ~hypothesis.register_random for possibly unreferenced RNG instances on the free-threaded build of CPython 3.13 because this check has a much higher false positive rate in the free-threaded build (3965).
Thanks to Nathan Goldbaum for this patch.
This patch turns off a warning for functions decorated with typing.overload and then ~hypothesis.strategies.composite, although only in that order (39
This patch turns off a warning for functions decorated with typing.overload and then ~hypothesis.strategies.composite, although only in that order (3970).
This patch turns off a warning for functions decorated with typing.overload() and then composite() , although only in that order ( issue #3970 ).
This patch fixes a significant slowdown when using the ~hypothesis.stateful.precondition decorator in some cases, due to expensive repr formatting int
This patch fixes a significant slowdown when using the ~hypothesis.stateful.precondition decorator in some cases, due to expensive repr formatting internally (3963).
This patch fixes a significant slowdown when using the precondition() decorator in some cases, due to expensive repr formatting internally ( issue #3963 ).
Explicitly cast numpy.finfo.smallest_normal to builtin float in preparation for the numpy==2.0 release (3950)
Explicitly cast numpy.finfo.smallest_normal to builtin float in preparation for the numpy==2.0 release (3950)
This patch improve a rare error message for flaky tests (3940).
This patch improve a rare error message for flaky tests (3940).
The ~hypothesis.extra.numpy.from_dtype function no longer generates NaT ("not-a-time") values for the datetime64 or timedelta64 dtypes if passed allow
The ~hypothesis.extra.numpy.from_dtype function no longer generates NaT ("not-a-time") values for the datetime64 or timedelta64 dtypes if passed allow_nan=False (3943).
This patch includes the ~hypothesis.settings.backend setting in the how_generated field of our observability output .
This patch includes the ~hypothesis.settings.backend setting in the how_generated field of our observability output.
This patch includes the backend setting in the how_generated field of our observability output .
If you were running Python 3.13 (currently in alpha) with pytest-xdist and then attempted to pretty-print a lambda functions which was created using t
If you were running Python 3.13 (currently in alpha) with pytest-xdist and then attempted to pretty-print a lambda functions which was created using the eval builtin, it would have raised an AssertionError. Now you'll get "lambda ...: <unknown>", as expected.
This release improves an internal invariant.
This release improves an internal invariant.
This patch fixes Hypothesis sometimes raising a Flaky error when generating collections of unique floats containing nan. See 3926 for more details.
This patch fixes Hypothesis sometimes raising a Flaky error when generating collections of unique floats containing nan. See 3926 for more details.
This patch continues our work on refactoring the shrinker (3921).
This patch continues our work on refactoring the shrinker (3921).
This patch continues our work on refactoring shrinker internals (3921).
This patch continues our work on refactoring shrinker internals (3921).
This release resolves exc:PermissionError that come from creating databases on inaccessible paths.
This release resolves PermissionError that come from creating databases on inaccessible paths.
This patch starts work on refactoring our shrinker internals. There is no user-visible change.
This patch starts work on refactoring our shrinker internals. There is no user-visible change.
This patch fixes a longstanding performance problem in stateful testing (3618), where state machines which generated a substantial amount of input for
This patch fixes a longstanding performance problem in stateful testing (3618), where state machines which generated a substantial amount of input for each step would hit the maximum amount of entropy and then fail with an Unsatisfiable error.
We now stop taking additional steps when we're approaching the entropy limit, which neatly resolves the problem without touching unaffected tests.
Fix regression caused by using 696 default in TypeVar with Python 3.13.0a3.
Fix regression caused by using 696 default in TypeVar with Python 3.13.0a3.
Fix regression caused by using PEP 696 default in TypeVar with Python 3.13.0a3.
This patch further improves the type annotations in hypothesis.extra.numpy.
This patch further improves the type annotations in hypothesis.extra.numpy.
Simplify the type annotation of ~hypothesis.extra.pandas.column and ~hypothesis.extra.pandas.columns by using 696 to avoid overloading.
Simplify the type annotation of ~hypothesis.extra.pandas.column and ~hypothesis.extra.pandas.columns by using 696 to avoid overloading.
Simplify the type annotation of column() and columns() by using PEP 696 to avoid overloading.
This patch implements type annotations for ~hypothesis.extra.pandas.column.
This patch implements type annotations for ~hypothesis.extra.pandas.column.
This release adds the experimental and unstable ~hypothesis.settings.backend setting. See alternative-backends for details.
This release adds the experimental and unstable ~hypothesis.settings.backend setting. See alternative-backends for details.
This release adds the experimental and unstable backend setting. See Alternative backends for Hypothesis for details.
This patch fixes 3900, a performance regression for ~hypothesis.extra.numpy.arrays due to the interaction of v6.98.12 and v6.97.1.
This patch fixes 3900, a performance regression for ~hypothesis.extra.numpy.arrays due to the interaction of v6.98.12 and v6.97.1.
This patch fixes issue #3900 , a performance regression for arrays() due to the interaction of 6.98.12 - 2024-02-25 and 6.97.1 - 2024-01-27 .
This patch improves the type annotations in hypothesis.extra.numpy, which makes inferred types more precise for both mypy and pyright, and fixes some
This patch improves the type annotations in hypothesis.extra.numpy, which makes inferred types more precise for both mypy and pyright, and fixes some strict-mode errors on the latter.
Thanks to Jonathan Plasse for reporting and fixing this in 3889!
This patch paves the way for future shrinker improvements. There is no user-visible change.
This patch paves the way for future shrinker improvements. There is no user-visible change.
This release adds support for the Array API's 2023.12 release _ via the api_version argument in ~hypothesis.extra.array_api.make_strategies_namespace.
This release adds support for the Array API's 2023.12 release via the api_version argument in ~hypothesis.extra.array_api.make_strategies_namespace. The API additions and modifications in the 2023.12 spec do not necessitate any changes in the Hypothesis strategies, hence there is no distinction between a 2022.12 and 2023.12 strategies namespace.
This patch adjusts the printing of bundle values to correspond with their names when using stateful testing.
This patch adjusts the printing of bundle values to correspond with their names when using stateful testing.
This patch implements filter-rewriting for ~hypothesis.strategies.text and ~hypothesis.strategies.binary with the ~re.Pattern.search, ~re.Pattern.matc
This patch implements filter-rewriting for ~hypothesis.strategies.text and ~hypothesis.strategies.binary with the ~re.Pattern.search, ~re.Pattern.match, or ~re.Pattern.fullmatch method of a re.compiled regex.
This patch implements filter-rewriting for text() and binary() with the search() , match() , or fullmatch() method of a re.compile() d regex.
This patch implements filter-rewriting for most length filters on some additional collection types (3795), and fixes several latent bugs where unsatis
This patch implements filter-rewriting for most length filters on some additional collection types (3795), and fixes several latent bugs where unsatisfiable or partially-infeasible rewrites could trigger internal errors.
This patch makes stateful testing somewhat less likely to get stuck when there are only a few possible rules.
This patch makes stateful testing somewhat less likely to get stuck when there are only a few possible rules.
This patch adds a note <678> to errors which occur while drawing from a strategy, to make it easier to tell why your test failed in such cases.
This patch adds a note to errors which occur while drawing from a strategy, to make it easier to tell why your test failed in such cases.
This patch ensures that observability outputs include an informative repr for ~hypothesis.stateful.RuleBasedStateMachine stateful tests, along with mo
This patch ensures that observability outputs include an informative repr for ~hypothesis.stateful.RuleBasedStateMachine stateful tests, along with more detailed timing information.
This patch ensures that observability outputs include an informative repr for RuleBasedStateMachine stateful tests, along with more detailed timing information.
This patch improves the Ghostwriter for binary operators.
This patch improves the Ghostwriter for binary operators.
This patch improves import-detection in the Ghostwriter (3884), particularly for ~hypothesis.strategies.from_type and strategies from hypothesis.extra
This patch improves import-detection in the Ghostwriter (3884), particularly for ~hypothesis.strategies.from_type and strategies from hypothesis.extra.*.
This patch improves import-detection in the Ghostwriter ( issue #3884 ), particularly for from_type() and strategies from hypothesis.extra.* .
This patch clarifies the documentation on stateful testing (3511).
This patch clarifies the documentation on stateful testing (3511).
This patch improves argument-to-json conversion for observability output. Checking for a .to_json() method on the object *before* a few other options
This patch improves argument-to-json conversion for observability output. Checking for a .to_json() method on the object before a few other options like dataclass support allows better user control of the process (3880).
This patch updates our vendored list of top-level domains __, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch updates our vendored list of top-level domains, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch fixes an error when generating observability reports involving large (n > 1e308) integers.
This patch fixes an error when generating observability reports involving large (n > 1e308) integers.
This patch refactors some internals. There is no user-visible change.
This patch refactors some internals. There is no user-visible change.
This release improves our distribution of generated values for all strategies, by doing a better job of tracking which values we have generated before
This release improves our distribution of generated values for all strategies, by doing a better job of tracking which values we have generated before and avoiding generating them again.
For example, st.lists(st.integers()) previously generated ~5 each of [] [0] in 100 examples. In this release, each of [] and [0] are generated ~1-2 times each.
This release deprecates use of the global random number generator while drawing from a strategy, because this makes test cases less diverse and preven…
This release deprecates use of the global random number generator while drawing from a strategy, because this makes test cases less diverse and prevents us from reporting minimal counterexamples (3810).
If you see this new warning, you can get a quick fix by using ~hypothesis.strategies.randoms; or use more idiomatic strategies ~hypothesis.strategies.sampled_from, ~hypothesis.strategies.floats, ~hypothesis.strategies.integers, and so on.
Note that the same problem applies to e.g. numpy.random, but for performance reasons we only check the stdlib random module - ignoring even other sources passed to ~hypothesis.register_random.
This patch updates our vendored list of top-level domains __, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch updates our vendored list of top-level domains, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch adds some observability information about how many times predicates in ~hypothesis.assume or ~hypothesis.stateful.precondition were satisfi
This patch adds some observability information about how many times predicates in ~hypothesis.assume or ~hypothesis.stateful.precondition were satisfied, so that downstream tools can warn you if some were never satisfied by any test case.
This patch adds some observability information about how many times predicates in assume() or precondition() were satisfied, so that downstream tools can warn you if some were never satisfied by any test case.
This patch improves formatting and adds some cross-references to our docs.
This patch improves formatting and adds some cross-references to our docs.
Internal test refactoring. .. _v6.97.2: -------------------
This patch slightly changes how we replay examples from the database : if the behavior of the saved example has changed, we now keep running the test
This patch slightly changes how we replay examples from the database: if the behavior of the saved example has changed, we now keep running the test case instead of aborting at the size of the saved example. While we know it's not the same example, we might as well continue running the test!
Because we now finish running a few more examples for affected tests, this might be a slight slowdown - but correspondingly more likely to find a bug.
We've also applied similar tricks to the |Phase.target| phase, where they are a pure performance improvement for affected tests.
Improves the performance of the ~hypothesis.extra.numpy.arrays strategy when generating unique values.
Improves the performance of the ~hypothesis.extra.numpy.arrays strategy when generating unique values.
Improves the performance of the arrays() strategy when generating unique values.
Changes the distribution of ~hypothesis.strategies.sampled_from when sampling from a ~python:enum.Flag. Previously, no-flags-set values would never be
Changes the distribution of ~hypothesis.strategies.sampled_from when sampling from a ~python:enum.Flag. Previously, no-flags-set values would never be generated, and all-flags-set values would be unlikely for large enums. With this change, the distribution is more uniform in the number of flags set.
This patch slightly refactors some internals. There is no user-visible change.
This patch slightly refactors some internals. There is no user-visible change.
This patch fixes a spurious warning about slow imports when HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY was set.
This patch fixes a spurious warning about slow imports when HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY was set.
This patch refactors some more internals, continuing our work on supporting alternative backends (3086). There is no user-visible change.
This patch refactors some more internals, continuing our work on supporting alternative backends (3086). There is no user-visible change.
Fix a spurious warning seen when running pytest's test suite, caused by never realizing we got out of initialization due to imbalanced hook calls.
Fix a spurious warning seen when running pytest's test suite, caused by never realizing we got out of initialization due to imbalanced hook calls.
Warns when constructing a repr that is overly long. This can happen by accident if stringifying arbitrary strategies, and is expensive in time and mem
Warns when constructing a repr that is overly long. This can happen by accident if stringifying arbitrary strategies, and is expensive in time and memory. The associated deferring of these long strings in ~hypothesis.strategies.sampled_from should also lead to improved performance.
This release adds the ability to pass any object to ~hypothesis.note, instead of just strings. The pretty-printed representation of the object will be
This release adds the ability to pass any object to ~hypothesis.note, instead of just strings. The pretty-printed representation of the object will be used.
See also 3843.
This release avoids creating a .hypothesis directory when using ~hypothesis.strategies.register_type_strategy (3836), and adds warnings for plugins wh
This release avoids creating a .hypothesis directory when using ~hypothesis.strategies.register_type_strategy (3836), and adds warnings for plugins which do so by other means or have other unintended side-effects.
This patch improves observability reports by moving timing information from metadata to a new timing key, and supporting conversion of additional argu
This patch improves observability reports by moving timing information from metadata to a new timing key, and supporting conversion of additional argument types to json rather than string reprs via a .to_json() method (including e.g. Pandas dataframes).
Additionally, the ~hypothesis.HealthCheck.too_slow health check will now report which strategies were slow, e.g. for strategies a, b, c, ...:
count | fraction | slowest draws (seconds) a | 3 | 65% | -- -- -- 0.357, 2.000 b | 8 | 16% | 0.100, 0.100, 0.100, 0.111, 0.123 c | 3 | 8% | -- -- 0.030, 0.050, 0.200 (skipped 2 rows of fast draws)
One column per quarter.