NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #407 most downloaded on PyPI
The property-based testing library for Python
Last release 7 days ago
28 Sep 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
1571 releases · first in 2013
This patch adds flake8-comprehensions to our linter suite. There is no user-visible change - expect perhaps via some strange microbenchmarks - but cer
This patch adds flake8-comprehensions to our linter suite. There is no user-visible change - expect perhaps via some strange microbenchmarks - but certain parts of the code now have a clear and more consistent style.
This release fixes some cases where we might previously have failed to run the validation logic for some strategies. As a result tests which would pre
This release fixes some cases where we might previously have failed to run the validation logic for some strategies. As a result tests which would previously have been silently testing significantly less than they should may now start to raise InvalidArgument now that these errors are caught.
One column per quarter.
This release significantly improves the data distribution in rule based stateful testing , by using a technique called Swarm Testing (Groce, Alex, et
This release significantly improves the data distribution in rule based stateful testing, by using a technique called Swarm Testing (Groce, Alex, et al. "Swarm testing." Proceedings of the 2012 International Symposium on Software Testing and Analysis. ACM, 2012.) to select which rules are run in any given test case. This should allow it to find many issues that it would previously have missed.
This change is likely to be especially beneficial for stateful tests with large numbers of rules.
This release adds some heuristics to test case generation that try to ensure that test cases generated early on will be relatively small.
This release adds some heuristics to test case generation that try to ensure that test cases generated early on will be relatively small.
This fixes a bug introduced in Hypothesis 4.42.0 which would cause occasional ~hypothesis.HealthCheck.too_slow failures on some tests.
This release revokes the deprecation of find, as we've now rebuilt it on top of @given, which means it has minimal maintenance burden and we're happy…
This release revokes the deprecation of find, as we've now rebuilt it on top of @given, which means it has minimal maintenance burden and we're happy to support it.
This release rebuilds find() on top of @given in order to have more code in common. It should have minimal user visible effect.
This release rebuilds find() on top of @given in order to have more code in common. It should have minimal user visible effect.
This patch removes an internal compatibility shim that we no longer need.
This patch removes an internal compatibility shim that we no longer need.
This patch fixes several typos in our docstrings and comments, with no change in behaviour. Thanks to Dmitry Dygalo for identifying and fixing them!
This patch fixes several typos in our docstrings and comments, with no change in behaviour. Thanks to Dmitry Dygalo for identifying and fixing them!
This release fixes an internal issue where Hypothesis would sometimes generate test cases that were above its intended maximum size. This would only h
This release fixes an internal issue where Hypothesis would sometimes generate test cases that were above its intended maximum size. This would only have happened rarely and probably would not have caused major problems when it did.
Users of the new targeted property-based testing might see minor impact (possibly slightly faster tests and slightly worse target scores), but only in the unlikely event that they were hitting this problem. Other users should not see any effect at all.
This release removes some unused code from the core engine. There is no user-visible change.
This release removes some unused code from the core engine. There is no user-visible change.
This release commonizes some code between running explicit examples and normal test execution. The main user visible impact of this is that deadlines
This release commonizes some code between running explicit examples and normal test execution. The main user visible impact of this is that deadlines are now enforced when running explicit examples.
This patch ensures that a KeyboardInterrupt received during example generation is not treated as a mystery test failure but instead propagates to the
This patch ensures that a KeyboardInterrupt received during example generation is not treated as a mystery test failure but instead propagates to the top level, not recording the interrupted generation in the conjecture data tree. Thanks to Anne Archibald for identifying and fixing the problem.
This release changes the behaviour of ~hypothesis.strategies.floats when excluding signed zeros - floats(max_value=0.0, exclude_max=True) can no longe
This release changes the behaviour of ~hypothesis.strategies.floats when excluding signed zeros - floats(max_value=0.0, exclude_max=True) can no longer generate -0.0 nor the much rarer floats(min_value=-0.0, exclude_min=True) generate +0.0.
The correct interaction between signed zeros and exclusive endpoints was unclear; we now enforce the invariant that ~hypothesis.strategies.floats will never generate a value equal to an excluded endpoint (2201).
If you prefer the old behaviour, you can pass floats(max_value=-0.0) or floats(min_value=0.0) which is exactly equivalent and has not changed. If you had two endpoints equal to zero, we recommend clarifying your tests by using ~hypothesis.strategies.just or ~hypothesis.strategies.sampled_from instead of ~hypothesis.strategies.floats.
This patch improves the error message when invalid arguments are passed to ~hypothesis.stateful.rule or ~hypothesis.stateful.invariant (2149).
This patch improves the error message when invalid arguments are passed to ~hypothesis.stateful.rule or ~hypothesis.stateful.invariant (2149).
Thanks to Benjamin Palmer for this bugfix!
This patch improves the error message when invalid arguments are passed to rule() or invariant() ( issue #2149 ).
Thanks to Benjamin Palmer for this bugfix!
This release supports python:typing.Final and python:typing.TypedDict in ~hypothesis.strategies.from_type.
This release supports python:typing.Final and python:typing.TypedDict in ~hypothesis.strategies.from_type.
This release supports typing.Final and typing.TypedDict in from_type() .
This patch disables our pytest plugin when running on versions of pytest before 4.3, the oldest our plugin supports. Note that at time of writing the
This patch disables our pytest plugin when running on versions of pytest before 4.3, the oldest our plugin supports. Note that at time of writing the Pytest developers only support 4.6 and later!
Hypothesis tests using @given() work on any test runner, but our integrations to e.g. avoid example database collisions when combined with @pytest.mark.parametrize eventually drop support for obsolete versions.
This patch adds some internal comments and clarifications to the Hypothesis implementation. There is no user-visible change.
This patch adds some internal comments and clarifications to the Hypothesis implementation. There is no user-visible change.
This patch avoids importing test runners such as pytest, unittest2, or nose solely to access their special "skip test" exception types - if the module
This patch avoids importing test runners such as pytest, unittest2, or nose solely to access their special "skip test" exception types - if the module is not in sys.modules, the exception can't be raised anyway.
This fixes a problem where importing an otherwise unused module could cause spurious errors due to import-time side effects (and possibly -Werror).
This release fixes @given to only complain about missing keyword-only arguments if the associated test function is actually called.
This release fixes @given to only complain about missing keyword-only arguments if the associated test function is actually called.
This matches the behaviour of other InvalidArgument errors produced by @given.
This patch allows Hypothesis to run in environments that do not specify a __file__, such as a python:zipapp (2196).
This patch allows Hypothesis to run in environments that do not specify a __file__, such as a python:zipapp (2196).
This patch allows Hypothesis to run in environments that do not specify a file , such as a zipapp ( issue #2196 ).
This release adds a signature argument to ~hypothesis.extra.numpy.mutually_broadcastable_shapes (2174), which allows us to generate shapes which are v
This release adds a signature argument to ~hypothesis.extra.numpy.mutually_broadcastable_shapes (2174), which allows us to generate shapes which are valid for functions like np.matmul() that require shapes which are not simply broadcastable.
Thanks to everyone who has contributed to this feature over the last year, and a particular shout-out to Zac Hatfield-Dodds and Ryan Soklaski for ~hypothesis.extra.numpy.mutually_broadcastable_shapes and to Ryan Turner for the downstream hypothesis-gufunc project.
This patch fixes 2108, where the first test using ~hypothesis.strategies.data to draw from ~hypothesis.strategies.characters or ~hypothesis.strategies
This patch fixes 2108, where the first test using ~hypothesis.strategies.data to draw from ~hypothesis.strategies.characters or ~hypothesis.strategies.text would be flaky due to unreliable test timings.
Time taken by lazy instantiation of strategies is now counted towards drawing from the strategy, rather than towards the deadline for the test function.
This patch fixes issue #2108 , where the first test using data() to draw from characters() or text() would be flaky due to unreliable test timings.
Time taken by lazy instantiation of strategies is now counted towards drawing from the strategy, rather than towards the deadline for the test function.
This release ensures that the strategies passed to @given are properly validated when applied to a test method inside a test class.
This release ensures that the strategies passed to @given are properly validated when applied to a test method inside a test class.
This should result in clearer error messages when some of those strategies are invalid.
This release changes how Hypothesis manages its search space in cases where it generates redundant data. This should cause it to generate significantl
This release changes how Hypothesis manages its search space in cases where it generates redundant data. This should cause it to generate significantly fewer duplicated examples (especially with short integer ranges), and may cause it to produce more useful examples in some cases (especially ones where there is a significant amount of filtering).
This patch refactors width handling in ~hypothesis.strategies.floats; you may notice small performance improvements but the main purpose is to enable
This patch refactors width handling in ~hypothesis.strategies.floats; you may notice small performance improvements but the main purpose is to enable work on 1704 (improving shrinking of bounded floats).
This patch removes an unused internal flag. There is no user-visible change.
This patch removes an unused internal flag. There is no user-visible change.
This patch corrects the exception type and error message you get if you attempt to use ~hypothesis.strategies.data to draw from something which is not
This patch corrects the exception type and error message you get if you attempt to use ~hypothesis.strategies.data to draw from something which is not a strategy. This never worked, but the error is more helpful now.
We've adopted flake8-bugbear to check for a few more style issues, and this patch implements the minor internal cleanups it suggested. There is no use
We've adopted flake8-bugbear to check for a few more style issues, and this patch implements the minor internal cleanups it suggested. There is no user-visible change.
This patch fixes the formatting of some documentation, but there is no change to any executed code.
This patch fixes the formatting of some documentation, but there is no change to any executed code.
Python 3.8's new python:typing.Literal type - see 586 for details - is now supported in ~hypothesis.strategies.from_type.
Python 3.8's new python:typing.Literal type - see 586 for details - is now supported in ~hypothesis.strategies.from_type.
Python 3.8’s new typing.Literal type - see PEP 586 for details - is now supported in from_type() .
This release adds the strategy ~hypothesis.extra.numpy.mutually_broadcastable_shapes, which generates multiple array shapes that are mutually broadcas
This release adds the strategy ~hypothesis.extra.numpy.mutually_broadcastable_shapes, which generates multiple array shapes that are mutually broadcast-compatible with an optional user-specified base-shape.
This is a generalisation of ~hypothesis.extra.numpy.broadcastable_shapes. It relies heavily on non-public internals for performance when generating and shrinking examples. We intend to support generating shapes matching a ufunc signature in a future version (2174).
Thanks to Ryan Soklaski, Zac Hatfield-Dodds, and @rdturnermtl who contributed to this new feature.
This release fixes ~hypothesis.strategies.from_type when used with bounded or constrained python:typing.TypeVar objects (2094).
This release fixes ~hypothesis.strategies.from_type when used with bounded or constrained python:typing.TypeVar objects (2094).
Previously, distinct typevars with the same constraints would be treated as all single typevar, and in cases where a typevar bound was resolved to a union of subclasses this could result in mixed types being generated for that typevar.
This patch ensures that the default value ~hypothesis.extra.numpy.broadcastable_shapes chooses for max_dims is always valid (at most 32), even if you
This patch ensures that the default value ~hypothesis.extra.numpy.broadcastable_shapes chooses for max_dims is always valid (at most 32), even if you pass min_dims=32.
This patch ensures that we only add profile information to the pytest header if running either pytest or Hypothesis in verbose mode, matching the buil
This patch ensures that we only add profile information to the pytest header if running either pytest or Hypothesis in verbose mode, matching the builtin cache plugin (2155).
This patch makes stateful step printing expand the result of a step into multiple variables when you return ~hypothesis.stateful.multiple (2139). Than
This patch makes stateful step printing expand the result of a step into multiple variables when you return ~hypothesis.stateful.multiple (2139). Thanks to Joseph Weston for reporting and fixing this bug!
This release fixes a bug (2166) where a Unicode character info cache file was generated but never used on subsequent test runs, causing tests to run m
This release fixes a bug (2166) where a Unicode character info cache file was generated but never used on subsequent test runs, causing tests to run more slowly than they should have.
Thanks to Robert Knight for this bugfix!
This patch corrects some internal documentation. There is no user-visible change.
This patch corrects some internal documentation. There is no user-visible change.
This release fixes a bug (2160) where decorators applied after @settings and before @given were ignored.
This release fixes a bug (2160) where decorators applied after @settings and before @given were ignored.
Thanks to Tom Milligan for this bugfix!
This release updates Hypothesis's formatting to the new version of black, and has absolutely no user visible effect.
This release updates Hypothesis's formatting to the new version of black, and has absolutely no user visible effect.
This release fixes a bug in ~hypothesis.strategies.recursive which would have meant that in practice max_leaves was treated as if it was lower than it
This release fixes a bug in ~hypothesis.strategies.recursive which would have meant that in practice max_leaves was treated as if it was lower than it actually is - specifically it would be capped at the largest power of two smaller than it. It is now handled correctly.
Python 3.8's new python:typing.SupportsIndex type - see 357 for details - is now supported in ~hypothesis.strategies.from_type.
Python 3.8's new python:typing.SupportsIndex type - see 357 for details - is now supported in ~hypothesis.strategies.from_type.
Thanks to Grigorios Giannakopoulos for the patch!
Python 3.8’s new typing.SupportsIndex type - see PEP 357 for details - is now supported in from_type() .
Thanks to Grigorios Giannakopoulos for the patch!
This release significantly simplifies Hypothesis's internal logic for data generation, by removing a number of heuristics of questionable or unproven
This release significantly simplifies Hypothesis's internal logic for data generation, by removing a number of heuristics of questionable or unproven value.
The results of this change will vary significantly from test to test. Most test suites will see significantly faster data generation and lower memory usage. The "quality" of the generated data may go up or down depending on your particular test suites.
If you see any significant regressions in Hypothesis's ability to find bugs in your code as a result of this release, please file an issue to let us know.
Users of the new targeted property-based testing functionality are reasonably likely to see improvements in data generation, as this release changes the search algorithm for targeted property based testing to one that is more likely to be productive than the existing approach.
This patch is to ensure that our internals remain comprehensible to mypy 0.740 - there is no user-visible change.
This patch is to ensure that our internals remain comprehensible to mypy 0.740 - there is no user-visible change.
This patch changes some internal hashes to SHA384, to better support users subject to FIPS-140. There is no user-visible API change.
This patch changes some internal hashes to SHA384, to better support users subject to FIPS-140. There is no user-visible API change.
Thanks to Paul Kehrer for this contribution!
This release makes --hypothesis-show-statistics much more useful for tests using a ~hypothesis.stateful.RuleBasedStateMachine, by simplifying the repr
This release makes --hypothesis-show-statistics much more useful for tests using a ~hypothesis.stateful.RuleBasedStateMachine, by simplifying the reprs so that events are aggregated correctly.
This release upgrades the ~hypothesis.strategies.fixed_dictionaries strategy to support optional keys (1913).
This release upgrades the ~hypothesis.strategies.fixed_dictionaries strategy to support optional keys (1913).
This release upgrades the fixed_dictionaries() strategy to support optional keys ( issue #1913 ).
This release makes some minor internal changes in support of improving the Hypothesis test suite. It should not have any user visible impact.
This release makes some minor internal changes in support of improving the Hypothesis test suite. It should not have any user visible impact.
This release changes how Hypothesis checks if a parameter to a test function is a mock object. It is unlikely to have any noticeable effect, but may r
This release changes how Hypothesis checks if a parameter to a test function is a mock object. It is unlikely to have any noticeable effect, but may result in a small performance improvement, especially for test functions where a mock object is being passed as the first argument.
This release fixes a bug where our example database logic did not distinguish between failing examples based on arguments from a @pytest.mark.parametr
This release fixes a bug where our example database logic did not distinguish between failing examples based on arguments from a @pytest.mark.parametrize(...). This could in theory cause data loss if a common failure overwrote a rare one, and in practice caused occasional file-access collisions in highly concurrent workloads (e.g. during a 300-way parametrize on 16 cores).
For internal reasons this also involves bumping the minimum supported version of pytest to 4.3
Thanks to Peter C Kroon for the Hacktoberfest patch!
This patch improves our type hints on the ~hypothesis.strategies.emails, ~hypothesis.strategies.functions, ~hypothesis.strategies.integers, ~hypothesi
This patch improves our type hints on the ~hypothesis.strategies.emails, ~hypothesis.strategies.functions, ~hypothesis.strategies.integers, ~hypothesis.strategies.iterables, and ~hypothesis.strategies.slices strategies, as well as the .filter() method.
There is no runtime change, but if you use mypy or a similar type-checker on your tests the results will be a bit more precise.
This patch improves our type hints on the emails() , functions() , integers() , iterables() , and slices() strategies, as well as the .filter() method.
There is no runtime change, but if you use mypy or a similar type-checker on your tests the results will be a bit more precise.
This patch improves the performance of unique collections such as ~hypothesis.strategies.sets of ~hypothesis.strategies.just or ~hypothesis.strategies
This patch improves the performance of unique collections such as ~hypothesis.strategies.sets of ~hypothesis.strategies.just or ~hypothesis.strategies.booleans strategies. They were already pretty good though, so you're unlikely to notice much!
This patch improves the performance of unique collections such as sets() of just() or booleans() strategies. They were already pretty good though, so you’re unlikely to notice much!
If a value in a dict passed to ~hypothesis.strategies.fixed_dictionaries is not a strategy, Hypothesis now tells you which one.
If a value in a dict passed to ~hypothesis.strategies.fixed_dictionaries is not a strategy, Hypothesis now tells you which one.
If a value in a dict passed to fixed_dictionaries() is not a strategy, Hypothesis now tells you which one.
This release adds the ~hypothesis.extra.numpy.basic_indices strategy, to generate basic indexes __ for arrays of the specified shape (1930).
This release adds the ~hypothesis.extra.numpy.basic_indices strategy, to generate basic indexes for arrays of the specified shape (1930).
It generates tuples containing some mix of integers, python:slice objects, ... (Ellipsis), and numpy:numpy.newaxis; which when used to index an array of the specified shape produce either a scalar or a shared-memory view of the array. Note that the index tuple may be longer or shorter than the array shape, and may produce a view with another dimensionality again!
Thanks to Lampros Mountrakis, Ryan Soklaski, and Zac Hatfield-Dodds for their collaboration on this surprisingly subtle strategy!
This patch defers creation of the .hypothesis directory until we have something to store in it, meaning that it will appear when Hypothesis is used ra
This patch defers creation of the .hypothesis directory until we have something to store in it, meaning that it will appear when Hypothesis is used rather than simply installed.
Thanks to Peter C Kroon for the Hacktoberfest patch!
This patch bumps our dependency on attrs to >=19.2.0; but there are no user-visible changes to Hypothesis.
This patch bumps our dependency on attrs to >=19.2.0; but there are no user-visible changes to Hypothesis.
This is a comment-only patch which tells mypy 0.730 to ignore some internal compatibility shims we use to support older Pythons.
This is a comment-only patch which tells mypy 0.730 to ignore some internal compatibility shims we use to support older Pythons.
This release adds the hypothesis.target function, which implements targeted property-based testing (1779).
This release adds the hypothesis.target function, which implements targeted property-based testing (1779).
By calling ~hypothesis.target in your test function, Hypothesis can do a hill-climbing search for bugs. If you can calculate a suitable metric such as the load factor or length of a queue, this can help you find bugs with inputs that are highly improbably from unguided generation - however good our heuristics, example diversity, and deduplication logic might be. After all, those features are at work in targeted PBT too!
This release emits a warning if you use the .example() method of a strategy in a non-interactive context.
This release emits a warning if you use the .example() method of a strategy in a non-interactive context.
~hypothesis.given is a much better choice for writing tests, whether you care about performance, minimal examples, reproducing failures, or even just the variety of inputs that will be tested!
This patch disables part of the typing-based inference for the attrs package under Python 3.5.0, which has some incompatible internal details (2095).
This patch disables part of the typing-based inference for the attrs package under Python 3.5.0, which has some incompatible internal details (2095).
This patch fixes a bug in strategy inference for attrs classes where Hypothesis would fail to infer a strategy for attributes of a generic type such a
This patch fixes a bug in strategy inference for attrs classes where Hypothesis would fail to infer a strategy for attributes of a generic type such as Union[int, str] or List[bool] (2091).
Thanks to Jonathan Gayvallet for the bug report and this patch!
Your coding agent can read these notes before it upgrades. Set up the MCP server →