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.17
Last release 2 days ago
20 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
1596 releases · first in 2013
Drag across the ruler to compare, or tap a release to open it.
This patch improves the testing of some internal caching. It should have no user-visible effect.
This patch improves the testing of some internal caching. It should have no user-visible effect.
This change performs a small rename and refactoring in the core engine. There is no user-visible change.
This change performs a small rename and refactoring in the core engine. There is no user-visible change.
This change improves the core engine's ability to avoid unnecessary work, by consulting its cache of previously-tried inputs in more cases.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
This change improves the core engine's ability to avoid unnecessary work, by consulting its cache of previously-tried inputs in more cases.
This patch handles passing an empty python:enum.Enum to ~hypothesis.strategies.from_type by returning ~hypothesis.strategies.nothing, instead of raisi
This patch handles passing an empty python:enum.Enum to ~hypothesis.strategies.from_type by returning ~hypothesis.strategies.nothing, instead of raising an internal python:AssertionError.
Thanks to Paul Amazona for writing this patch at the PyCon Australia sprints!
This patch handles passing an empty enum.Enum to from_type() by returning nothing() , instead of raising an internal AssertionError .
Thanks to Paul Amazona for writing this patch at the PyCon Australia sprints!
This patch fixes a small mistake in an internal comment. There is no user-visible change.
This patch fixes a small mistake in an internal comment. There is no user-visible change.
This change fixes a small bug in how the core engine consults its cache of previously-tried inputs. There is unlikely to be any user-visible change.
This change fixes a small bug in how the core engine consults its cache of previously-tried inputs. There is unlikely to be any user-visible change.
Passing both the target and targets arguments is deprecated - append the target bundle to the targets tuple of bundles instead.
This release improves argument validation for stateful testing.
If the target or targets of a ~hypothesis.stateful.rule are invalid, we now raise a useful validation error rather than an internal exception.
Passing both the target and targets arguments is deprecated - append the target bundle to the targets tuple of bundles instead.
Passing the name of a Bundle rather than the Bundle itself is also deprecated.
This is a docs-only patch, fixing some typos and formatting issues.
This is a docs-only patch, fixing some typos and formatting issues.
This change fixes a small bug in how the core engine caches the results of previously-tried inputs. The effect is unlikely to be noticeable, but it mi
This change fixes a small bug in how the core engine caches the results of previously-tried inputs. The effect is unlikely to be noticeable, but it might avoid unnecessary work in some cases.
This patch documents the ~hypothesis.extra.numpy.from_dtype function, which infers a strategy for numpy:numpy.dtype\ s. This is used in ~hypothesis.ex
This patch documents the ~hypothesis.extra.numpy.from_dtype function, which infers a strategy for numpy:numpy.dtypes. This is used in ~hypothesis.extra.numpy.arrays, but can also be used directly when creating e.g. Pandas objects.
This patch documents the from_dtype() function, which infers a strategy for numpy.dtype s. This is used in arrays() , but can also be used directly when creating e.g. Pandas objects.
~hypothesis.extra.numpy.arrays now checks that integer and float values drawn from elements and fill strategies can be safely cast to the dtype of the
~hypothesis.extra.numpy.arrays now checks that integer and float values drawn from elements and fill strategies can be safely cast to the dtype of the array, and emits a warning otherwise (1385).
Elements in the resulting array could previously violate constraints on the elements strategy due to floating-point overflow or truncation of integers to fit smaller types.
This release contains a tiny refactoring of the internals. There is no user-visible change.
This release contains a tiny refactoring of the internals. There is no user-visible change.
This release adds a width argument to ~hypothesis.strategies.floats, to generate lower-precision floating point numbers for e.g. Numpy arrays.
This release adds a width argument to ~hypothesis.strategies.floats, to generate lower-precision floating point numbers for e.g. Numpy arrays.
The generated examples are always instances of Python's native float type, which is 64bit, but passing width=32 will ensure that all values can be exactly represented as 32bit floats. This can be useful to avoid overflow (to +/- infinity), and for efficiency of generation and shrinking.
Half-precision floats (width=16) are also supported, but require Numpy if you are running Python 3.5 or earlier.
This release fixes a bug in ~hypothesis.strategies.floats, where setting allow_infinity=False and exactly one of min_value and max_value would allow i
This release fixes a bug in ~hypothesis.strategies.floats, where setting allow_infinity=False and exactly one of min_value and max_value would allow infinite values to be generated.
This release adds type hints to the @example() and ~hypothesis.seed decorators, and fixes the type hint on ~hypothesis.strategies.register_type_strate
This release adds type hints to the @example() and ~hypothesis.seed decorators, and fixes the type hint on ~hypothesis.strategies.register_type_strategy. The second argument to ~hypothesis.strategies.register_type_strategy must either be a SearchStrategy, or a callable which takes a type and returns a SearchStrategy.
This release adds type hints to the @example() and seed() decorators, and fixes the type hint on register_type_strategy() . The second argument to register_type_strategy() must either be a SearchStrategy , or a callable which takes a type and returns a SearchStrategy .
Another set of changes designed to improve the performance of shrinking on large examples. In particular the shrinker should now spend considerably le
Another set of changes designed to improve the performance of shrinking on large examples. In particular the shrinker should now spend considerably less time running useless shrinks.
"Bug fixes and performance improvements".
"Bug fixes and performance improvements".
This release is a fairly major overhaul of the shrinker designed to improve its behaviour on large examples, especially around stateful testing. You should hopefully see shrinking become much faster, with little to no quality degradation (in some cases quality may even improve).
This release fixes two very minor bugs in the core engine:
This release fixes two very minor bugs in the core engine:
it fixes a corner case that was missing in 3.66.28, which should cause shrinking to work slightly better.
it fixes some logic for how shrinking interacts with the database that was causing Hypothesis to be insufficiently aggressive about clearing out old keys.
This release improves how Hypothesis handles reducing the size of integers' representation. This change should mostly be invisible as it's purely abou
This release improves how Hypothesis handles reducing the size of integers' representation. This change should mostly be invisible as it's purely about the underlying representation and not the generated value, but it may result in some improvements to shrink performance.
This release changes the order in which Hypothesis chooses parts of the test case to shrink. For typical usage this should be a significant performanc
This release changes the order in which Hypothesis chooses parts of the test case to shrink. For typical usage this should be a significant performance improvement on large examples. It is unlikely to have a major impact on example quality, but where it does change the result it should usually be an improvement.
This release improves the debugging information that the shrinker emits about the operations it performs, giving better summary statistics about which
This release improves the debugging information that the shrinker emits about the operations it performs, giving better summary statistics about which passes resulted in test executions and whether they were successful.
This release fixes several bugs that were introduced to the shrinker in 3.66.24 which would have caused it to behave significantly less well than adve
This release fixes several bugs that were introduced to the shrinker in 3.66.24 which would have caused it to behave significantly less well than advertised. With any luck you should actually see the promised benefits now.
This release changes how Hypothesis deletes data when shrinking in order to better handle deletion of large numbers of contiguous sequences. Most test
This release changes how Hypothesis deletes data when shrinking in order to better handle deletion of large numbers of contiguous sequences. Most tests should see little change, but this will hopefully provide a significant speed up for stateful testing.
This release makes some internal changes to enable further improvements to the shrinker. You may see some changes in the final shrunk examples, but th
This release makes some internal changes to enable further improvements to the shrinker. You may see some changes in the final shrunk examples, but they are unlikely to be significant.
This release adds some more internal caching to the shrinker. This should cause a significant speed up for shrinking, especially for stateful testing
This release adds some more internal caching to the shrinker. This should cause a significant speed up for shrinking, especially for stateful testing and large example sizes.
This patch is for downstream packagers - our tests now pass under pytest 3.7.0 (released 2018-07-30). There are no changes to the source of Hypothesis
This patch is for downstream packagers - our tests now pass under pytest 3.7.0 (released 2018-07-30). There are no changes to the source of Hypothesis itself.
This release removes some functionality from the shrinker that was taking a considerable amount of time and does not appear to be useful any more due
This release removes some functionality from the shrinker that was taking a considerable amount of time and does not appear to be useful any more due to a number of quality improvements in the shrinker.
You may see some degradation in shrink quality as a result of this, but mostly shrinking should just get much faster.
This release slightly changes the format of some debugging information emitted during shrinking, and refactors some of the internal interfaces around
This release slightly changes the format of some debugging information emitted during shrinking, and refactors some of the internal interfaces around that.
This release is a very small internal refactoring which should have no user visible impact.
This release is a very small internal refactoring which should have no user visible impact.
This release fixes a bug that could cause an IndexError to be raised from inside Hypothesis during shrinking. It is likely that it was impossible to t
This release fixes a bug that could cause an IndexError to be raised from inside Hypothesis during shrinking. It is likely that it was impossible to trigger this bug in practice - it was only made visible by some currently unreleased work.
This release is a very small internal refactoring which should have no user visible impact.
This release is a very small internal refactoring which should have no user visible impact.
This release makes Hypothesis's shrinking faster by removing some redundant work that it does when minimizing values in its internal representation.
This release makes Hypothesis's shrinking faster by removing some redundant work that it does when minimizing values in its internal representation.
This release expands the deprecation of timeout from 3.16.0 to also emit the deprecation warning in find or stateful testing .
This release expands the deprecation of timeout from 3.16.0 to also emit the deprecation warning in find or stateful testing.
This release adds an additional shrink pass that is able to reduce the size of examples in some cases where the transformation is non-obvious. In part
This release adds an additional shrink pass that is able to reduce the size of examples in some cases where the transformation is non-obvious. In particular this will improve the quality of some examples which would have regressed in 3.66.12.
This release changes how we group data together for shrinking. It should result in improved shrinker performance, especially in stateful testing.
This release changes how we group data together for shrinking. It should result in improved shrinker performance, especially in stateful testing.
This patch modifies how which rule to run is selected during rule based stateful testing . This should result in a slight performance increase during
This patch modifies how which rule to run is selected during rule based stateful testing. This should result in a slight performance increase during generation and a significant performance and quality improvement when shrinking.
As a result of this change, some state machines which would previously have thrown an InvalidDefinition are no longer detected as invalid.
This release weakens some minor functionality in the shrinker that had only modest benefit and made its behaviour much harder to reason about.
This release weakens some minor functionality in the shrinker that had only modest benefit and made its behaviour much harder to reason about.
This is unlikely to have much user visible effect, but it is possible that in some cases shrinking may get slightly slower. It is primarily to make it easier to work on the shrinker and pave the way for future work.
This release improves the information that Hypothesis emits about its shrinking when ~hypothesis.settings.verbosity is set to debug.
This release improves the information that Hypothesis emits about its shrinking when ~hypothesis.settings.verbosity is set to debug.
This release improves the information that Hypothesis emits about its shrinking when verbosity is set to debug.
This patch includes some minor fixes in the documentation, and updates the minimum version of pytest to 3.0 (released August 2016).
This patch includes some minor fixes in the documentation, and updates the minimum version of pytest to 3.0 (released August 2016).
This release fixes a bug where difficult to shrink tests could sometimes trigger an internal assertion error inside the shrinker.
This release fixes a bug where difficult to shrink tests could sometimes trigger an internal assertion error inside the shrinker.
This patch ensures that Hypothesis fully supports Python 3.7, by upgrading ~hypothesis.strategies.from_type (1264) and fixing some minor issues in our
This patch ensures that Hypothesis fully supports Python 3.7, by upgrading ~hypothesis.strategies.from_type (1264) and fixing some minor issues in our test suite (1148).
This patch fixes the online docs for various extras, by ensuring that their dependencies are installed on readthedocs.io (1326).
This patch fixes the online docs for various extras, by ensuring that their dependencies are installed on readthedocs.io (1326).
This release improves the shrinker's ability to reorder examples.
This release improves the shrinker's ability to reorder examples.
For example, consider the following test:
import hypothesis.strategies as st
from hypothesis import given
@given(st.text(), st.text())
def test_non_equal(x, y):
assert x != y
Previously this could have failed with either of x="", y="0" or x="0", y="". Now it should always fail with x="", y="0".
This will allow the shrinker to produce more consistent results, especially in cases where test cases contain some ordered collection whose actual order does not matter.
This patch fixes inference in the ~hypothesis.strategies.builds strategy with subtypes of python:typing.NamedTuple, where the __init__ method is not u
This patch fixes inference in the ~hypothesis.strategies.builds strategy with subtypes of python:typing.NamedTuple, where the __init__ method is not useful for introspection. We now use the field types instead - thanks to James Uther for identifying this bug.
This patch fixes inference in the builds() strategy with subtypes of typing.NamedTuple , where the init method is not useful for introspection. We now use the field types instead - thanks to James Uther for identifying this bug.
This release improves the shrinker's ability to handle situations where there is an additive constraint between two values.
This release improves the shrinker's ability to handle situations where there is an additive constraint between two values.
For example, consider the following test:
import hypothesis.strategies as st
from hypothesis import given
@given(st.integers(), st.integers())
def test_does_not_exceed_100(m, n):
assert m + n < 100
Previously this could have failed with almost any pair (m, n) with 0 <= m <= n and m + n == 100. Now it should almost always fail with m=0, n=100.
This is a relatively niche specialisation, but can be useful in situations where e.g. a bug is triggered by an integer overflow.
This patch fixes a rare bug where an incorrect percentage drawtime could be displayed for a test, when the system clock was changed during a test runn
This patch fixes a rare bug where an incorrect percentage drawtime could be displayed for a test, when the system clock was changed during a test running under Python 2 (we use python:time.monotonic where it is available to avoid such problems). It also fixes a possible zero-division error that can occur when the underlying C library double-rounds an intermediate value in python:math.fsum and gets the least significant bit wrong.
The following misuses are now deprecated, and will be an error in a future version:
This release improves validation of the alphabet argument to the ~hypothesis.strategies.text strategy. The following misuses are now deprecated, and will be an error in a future version:
passing an unordered collection (such as set('abc')), which violates invariants about shrinking and reproducibility
passing an alphabet sequence with elements that are not strings
passing an alphabet sequence with elements that are not of length one, which violates any size constraints that may apply
Thanks to Sushobhit for adding these warnings (1329).
This release fixes a mostly theoretical bug where certain usage of the internal API could trigger an assertion error inside Hypothesis. It is unlikely
This release fixes a mostly theoretical bug where certain usage of the internal API could trigger an assertion error inside Hypothesis. It is unlikely that this problem is even possible to trigger through the public API.
This release fixes dependency information for coverage. Previously Hypothesis would allow installing coverage with any version, but it only works with
This release fixes dependency information for coverage. Previously Hypothesis would allow installing coverage with any version, but it only works with coverage 4.0 or later.
We now specify the correct metadata in our setup.py, so Hypothesis will only allow installation with compatible versions of coverage.
This patch ensures that stateful tests which raise an error from a pytest helper still print the sequence of steps taken to reach that point (1372). T
This patch ensures that stateful tests which raise an error from a pytest helper still print the sequence of steps taken to reach that point (1372). This reporting was previously broken because the helpers inherit directly from python:BaseException, and therefore require special handling to catch without breaking e.g. the use of ctrl-C to quit the test.
This release deprecates the max_shrinks setting in favor of an internal heuristic. If you need to avoid shrinking examples, use the ~hypothesis.settin…
This release deprecates the max_shrinks setting in favor of an internal heuristic. If you need to avoid shrinking examples, use the ~hypothesis.settings.phases setting instead. (1235)
This release fixes a bug where an internal assertion error could sometimes be triggered while shrinking a failing test.
This release fixes a bug where an internal assertion error could sometimes be triggered while shrinking a failing test.
This patch fixes type-checking errors in our vendored pretty-printer, which were ignored by our mypy config but visible for anyone else (whoops). Than
This patch fixes type-checking errors in our vendored pretty-printer, which were ignored by our mypy config but visible for anyone else (whoops). Thanks to Pi Delport for reporting 1359 so promptly.
This release adds an interface which can be used to insert a wrapper between the original test function and @given (1257). This will be particularly u
This release adds an interface which can be used to insert a wrapper between the original test function and @given (1257). This will be particularly useful for test runner extensions such as pytest-trio, but is not recommended for direct use by other users of Hypothesis.
This release adds a new mechanism to infer strategies for classes defined using attrs, based on the type, converter, or validator of each attribute. T
This release adds a new mechanism to infer strategies for classes defined using attrs, based on the type, converter, or validator of each attribute. This inference is now built in to ~hypothesis.strategies.builds and ~hypothesis.strategies.from_type.
On Python 2, ~hypothesis.strategies.from_type no longer generates instances of int when passed long, or vice-versa.
This release adds a new mechanism to infer strategies for classes defined using attrs , based on the type, converter, or validator of each attribute. This inference is now built in to builds() and from_type() .
On Python 2, from_type() no longer generates instances of int when passed long , or vice-versa.
This release adds :PEP:484 type hints to Hypothesis on a provisional basis, using the comment-based syntax for Python 2 compatibility.
This release adds PEP 484 type hints to Hypothesis on a provisional basis, using the comment-based syntax for Python 2 compatibility.
It also adds the py.typed marker specified in PEP 561. After you pip install hypothesis, mypy 0.590 or later will therefore type-check your use of our public interface!
This release adds PEP 484 type hints to Hypothesis on a provisional basis, using the comment-based syntax for Python 2 compatibility.
It also adds the py.typed marker specified in PEP 561 . After you pip install hypothesis , mypy 0.590 or later will therefore type-check your use of our public interface!
This release deprecates the use of ~hypothesis.settings as a context manager, the use of which is somewhat ambiguous.
This release deprecates the use of ~hypothesis.settings as a context manager, the use of which is somewhat ambiguous.
Users should define settings with global state or with the @settings(...) decorator.
Fixed a bug in generating an instance of a Django model from a strategy where the primary key is generated as part of the strategy. See details here .
Fixed a bug in generating an instance of a Django model from a strategy where the primary key is generated as part of the strategy. See details here.
Thanks to Tim Martin for this contribution.
This release adds the @initialize decorator for stateful testing (originally discussed in 1216). All @initialize rules will be called once each in an
This release adds the @initialize decorator for stateful testing (originally discussed in 1216). All @initialize rules will be called once each in an arbitrary order before any normal rule is called.
This is a no-op release to take into account some changes to the release process. It should have no user visible effect.
This is a no-op release to take into account some changes to the release process. It should have no user visible effect.
One column per quarter.