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 ensures that if the "hypothesis" entry point is callable, we call it after importing it. You can still use non-callable entry points (like
This patch ensures that if the "hypothesis" entry point is callable, we call it after importing it. You can still use non-callable entry points (like modules), which are only imported.
We also prefer importlib.metadata or the backport over pkg_resources, which makes import hypothesis around 200 milliseconds faster (2571).
This patch adds some helpful suggestions to error messages you might see while learning to use the @example() decorator (2611) or the ~hypothesis.stra
This patch adds some helpful suggestions to error messages you might see while learning to use the @example() decorator (2611) or the ~hypothesis.strategies.one_of strategy.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
This release upgrades the ~hypothesis.extra.numpy.from_dtype strategy to pass optional kwargs to the inferred strategy, and upgrades the ~hypothesis.e
This release upgrades the ~hypothesis.extra.numpy.from_dtype strategy to pass optional **kwargs to the inferred strategy, and upgrades the ~hypothesis.extra.numpy.arrays strategy to accept an elements=kwargs dict to pass through to ~hypothesis.extra.numpy.from_dtype.
arrays(floating_dtypes(), shape, elements={"min_value": -10, "max_value": 10}) is a particularly useful pattern, as it allows for any floating dtype without triggering the roundoff warning for smaller types or sacrificing variety for larger types (2552).
This patch reformats our code with the latest black to take advantage of the support for magic trailing commas.
This patch reformats our code with the latest black to take advantage of the support for magic trailing commas.
This release significantly improves the performance of Hypothesis's internal implementation of automaton learning. However this code does not run as p
This release significantly improves the performance of Hypothesis's internal implementation of automaton learning. However this code does not run as part of the user-accessible API so this has no user-visible impact.
This patch ensures that, when the generate ~hypothesis.settings.phases is disabled, we can replay up to ~hypothesis.settings.max_examples examples fro
This patch ensures that, when the generate ~hypothesis.settings.phases is disabled, we can replay up to ~hypothesis.settings.max_examples examples from the database - which is very useful when using Hypothesis with a fuzzer.
Thanks to Afrida Tabassum for fixing 2585!
This patch ensures that, when the generate phases is disabled, we can replay up to max_examples examples from the database - which is very useful when using Hypothesis with a fuzzer .
Thanks to Afrida Tabassum for fixing issue #2585 !
This patch changes some internal python:struct.Struct.format strings from bytes to str, to avoid python:BytesWarning when running python -bb __.
This patch changes some internal python:struct.Struct.format strings from bytes to str, to avoid python:BytesWarning when running python -bb.
Thanks to everyone involved in pytest-xdist issue 596, 16349, 21071, and 41777 for their work on this - it was a remarkably subtle issue!
This patch changes some internal struct.Struct.format strings from bytes to str , to avoid BytesWarning when running python -bb .
Thanks to everyone involved in pytest-xdist issue 596 , bpo-16349 , bpo-21071 , and bpo-41777 for their work on this - it was a remarkably subtle issue!
The ~hypothesis.target function now accepts integers as well as floats.
The ~hypothesis.target function now accepts integers as well as floats.
This patch adds explicit ~python:typing.Optional annotations to our public API, to better support users who run mypy with --strict or no_implicit_opti
This patch adds explicit ~python:typing.Optional annotations to our public API, to better support users who run mypy with --strict or no_implicit_optional=True.
Thanks to Krzysztof Przybyła for bringing this to our attention and writing the patch!
This release drops support for Python 3.5, which reached end of life upstream __ on 2020-09-13.
This release drops support for Python 3.5, which reached end of life upstream on 2020-09-13.
This patch fixes a problem with ~hypothesis.strategies.builds that was not able to generate valid data for annotated classes with constructors.
This patch fixes a problem with ~hypothesis.strategies.builds that was not able to generate valid data for annotated classes with constructors.
Thanks to Nikita Sobolev for fixing 2603!
This patch improves the error message from the hypothesis write command if black (required for the ghostwriter ) is not installed.
This patch improves the error message from the hypothesis write command if black (required for the ghostwriter) is not installed.
Thanks to Nikita Sobolev for fixing 2604!
When reporting failing examples, or tried examples in verbose mode, Hypothesis now identifies which were from @example(...) explicit examples.
When reporting failing examples, or tried examples in verbose mode, Hypothesis now identifies which were from @example(...) explicit examples.
This patch contains some internal refactoring. Thanks to Felix Sheldon for fixing 2516!
This patch contains some internal refactoring. Thanks to Felix Sheldon for fixing 2516!
An array drawn from ~hypothesis.extra.numpy.arrays will own its own memory; previously most arrays returned by this strategy were views.
An array drawn from ~hypothesis.extra.numpy.arrays will own its own memory; previously most arrays returned by this strategy were views.
An array drawn from arrays() will own its own memory; previously most arrays returned by this strategy were views.
~hypothesis.strategies.builds will use the __signature__ attribute of the target, if it exists, to retrieve type hints. Previously python:typing.get_t
~hypothesis.strategies.builds will use the __signature__ attribute of the target, if it exists, to retrieve type hints. Previously python:typing.get_type_hints, was used by default. If argument names varied between the __annotations__ and __signature__, they would not be supplied to the target.
This was particularly an issue for pydantic models which use an alias generator.
This patch makes the ghostwriter much more robust when passed unusual modules.
This patch makes the ghostwriter much more robust when passed unusual modules.
improved support for non-resolvable type annotations
~hypothesis.extra.ghostwriter.magic can now write ~hypothesis.extra.ghostwriter.equivalent tests
running ~hypothesis.extra.ghostwriter.magic on modules where some names in __all__ are undefined skips such names, instead of raising an error
~hypothesis.extra.ghostwriter.magic now knows to skip mocks
improved handling of import-time errors found by the ghostwriter CLI
This patch makes the ghostwriter much more robust when passed unusual modules.
improved support for non-resolvable type annotations
magic() can now write equivalent() tests
running magic() on modules where some names in all are undefined skips such names, instead of raising an error
magic() now knows to skip mocks
improved handling of import-time errors found by the ghostwriter CLI
~hypothesis.strategies.register_type_strategy now supports python:typing.TypeVar, which was previously hard-coded, and allows a variety of types to be
~hypothesis.strategies.register_type_strategy now supports python:typing.TypeVar, which was previously hard-coded, and allows a variety of types to be generated for an unconstrained ~python:typing.TypeVar instead of just ~hypothesis.strategies.text.
Thanks again to Nikita Sobolev for all your work on advanced types!
register_type_strategy() now supports typing.TypeVar , which was previously hard-coded, and allows a variety of types to be generated for an unconstrained TypeVar instead of just text() .
Thanks again to Nikita Sobolev for all your work on advanced types!
This release fixes some hard to trigger bugs in Hypothesis's automata learning code. This code is only run as part of the Hypothesis build process, an
This release fixes some hard to trigger bugs in Hypothesis's automata learning code. This code is only run as part of the Hypothesis build process, and not for user code, so this release has no user visible impact.
This patch adds type annotations to the hypothesis.database module. There is no runtime change, but your typechecker might notice.
This patch adds type annotations to the hypothesis.database module. There is no runtime change, but your typechecker might notice.
This patch tracks some additional information in Hypothesis internals, and has no user-visible impact.
This patch tracks some additional information in Hypothesis internals, and has no user-visible impact.
This release fixes a bug in some Hypothesis internal support code for learning automata. This mostly doesn't have any user visible impact, although it
This release fixes a bug in some Hypothesis internal support code for learning automata. This mostly doesn't have any user visible impact, although it slightly affects the learned shrink passes so shrinking may be subtly different.
This release adds support for entry-points, which allows for smoother integration of third-party Hypothesis extensions and external libraries. Unless
This release adds support for entry-points, which allows for smoother integration of third-party Hypothesis extensions and external libraries. Unless you're publishing a library with Hypothesis integration, you'll probably only ever use this indirectly!
This release adds support for Hypothesis integration via entry points , which allows for smoother integration of third-party Hypothesis extensions and external libraries. Unless you’re publishing a library with Hypothesis integration, you’ll probably only ever use this indirectly!
~hypothesis.strategies.from_type can now resolve ~python:typing.TypeVar instances when the bound is a ~python:typing.ForwardRef, so long as that name
~hypothesis.strategies.from_type can now resolve ~python:typing.TypeVar instances when the bound is a ~python:typing.ForwardRef, so long as that name is in fact defined in the same module as the typevar (no TYPE_CHECKING tricks, sorry). This feature requires Python 3.7 or later.
Thanks to Zac Hatfield-Dodds and Nikita Sobolev for this feature!
This patch adds two new ghostwriters to test binary operations , like python:operator.add, and Numpy ufuncs and gufuncs like np.matmul() .
This patch adds two new ghostwriters to test binary operations, like python:operator.add, and Numpy ufuncs and gufuncs like np.matmul().
This patch adds two new ghostwriters to test binary operations , like operator.add() , and Numpy ufuncs and gufuncs like np.matmul() .
This release improves the performance of some methods in Hypothesis's internal automaton library. These are currently only lightly used by user code,
This release improves the performance of some methods in Hypothesis's internal automaton library. These are currently only lightly used by user code, but this may result in slightly faster shrinking.
~hypothesis.strategies.register_type_strategy no longer accepts parametrised user-defined generic types, because the resolution logic was quite badly
~hypothesis.strategies.register_type_strategy no longer accepts parametrised user-defined generic types, because the resolution logic was quite badly broken (2537).
Instead of registering a strategy for e.g. MyCollection[int], you should register a function for MyCollection and inspect the type parameters within that function.
Thanks to Nikita Sobolev for the bug report, design assistance, and pull request to implement this feature!
Tired of writing tests? Or new to Hypothesis and not sure where to start?
Tired of writing tests? Or new to Hypothesis and not sure where to start?
This release is for you! With our new Ghostwriter functions and hypothesis write ... command-line interface, you can stop writing tests entirely... or take the source code Hypothesis writes for you as a starting point.
This has been in the works for months, from 2118 to versions 5.18.3, 5.23.5, and 5.23.5 - particular thanks to the many people who reviewed pull requests or commented on demos, and to Timothy Crosley's hypothesis-auto project for inspiration.
This patch adds yet more internal functions to support a new feature we're working on, like version 5.18.3 and version 5.23.6 . We promise it's worth
This patch adds yet more internal functions to support a new feature we're working on, like version 5.18.3 and version 5.23.6. We promise it's worth the wait!
This release fixes a small internal bug in Hypothesis's internal automaton library. Fortunately this bug was currently impossible to hit in user facin
This release fixes a small internal bug in Hypothesis's internal automaton library. Fortunately this bug was currently impossible to hit in user facing code, so this has no user visible impact.
This release improves shrink quality by allowing Hypothesis to automatically learn new shrink passes for difficult to shrink tests.
This release improves shrink quality by allowing Hypothesis to automatically learn new shrink passes for difficult to shrink tests.
The automatic learning is not currently accessible in user code (it still needs significant work on robustness and performance before it is ready for that), but this release includes learned passes that should improve shrinking quality for tests which use any of the ~hypothesis.strategies.text, ~hypothesis.strategies.floats, ~hypothesis.strategies.datetimes, ~hypothesis.strategies.emails, and ~hypothesis.strategies.complex_numbers strategies.
This release improves shrink quality by allowing Hypothesis to automatically learn new shrink passes for difficult to shrink tests.
The automatic learning is not currently accessible in user code (it still needs significant work on robustness and performance before it is ready for that), but this release includes learned passes that should improve shrinking quality for tests which use any of the text() , floats() , datetimes() , emails() , and complex_numbers() strategies.
This patch updates some docstrings, without changing runtime behaviour.
This patch updates some docstrings, without changing runtime behaviour.
The ~hypothesis.strategies.functions strategy has a new argument pure=True, which ensures that the same return value is generated for identical calls
The ~hypothesis.strategies.functions strategy has a new argument pure=True, which ensures that the same return value is generated for identical calls to the generated function (2538).
Thanks to Zac Hatfield-Dodds and Nikita Sobolev for this feature!
This release removes a number of Hypothesis's internal "shrink passes" - transformations it makes to a generated test case during shrinking - which ap
This release removes a number of Hypothesis's internal "shrink passes" - transformations it makes to a generated test case during shrinking - which appeared to be redundant with other transformations.
It is unlikely that you will see much impact from this. If you do, it will likely show up as a change in shrinking performance (probably slower, maybe faster), or possibly in worse shrunk results. If you encounter the latter, please let us know.
This release fixes a bug in some internal Hypothesis support code. It has no user visible impact.
This release fixes a bug in some internal Hypothesis support code. It has no user visible impact.
This release improves the quality of shrunk test cases in some special cases. Specifically, it should get shrinking unstuck in some scenarios which re
This release improves the quality of shrunk test cases in some special cases. Specifically, it should get shrinking unstuck in some scenarios which require simultaneously changing two parts of the generated test case.
This release improves the performance of some internal support code. It has no user visible impact, as that code is not currently run during normal Hy
This release improves the performance of some internal support code. It has no user visible impact, as that code is not currently run during normal Hypothesis operation.
This release adds a heuristic to detect when shrinking has finished despite the fact that there are many more possible transformations to try. This wi
This release adds a heuristic to detect when shrinking has finished despite the fact that there are many more possible transformations to try. This will be particularly useful for tests where the minimum failing test case is very large despite there being many smaller test cases possible, where it is likely to speed up shrinking dramatically.
In some cases it is likely that this will result in worse shrunk test cases. In those cases rerunning the test will result in further shrinking.
This release makes some performance improvements to shrinking. They should only be noticeable for tests that are currently particularly slow to shrink
This release makes some performance improvements to shrinking. They should only be noticeable for tests that are currently particularly slow to shrink.
This patch adds some more internal functions to support a new feature we're working on, like version 5.18.3 . There is still no user-visible change...
This patch adds some more internal functions to support a new feature we're working on, like version 5.18.3. There is still no user-visible change... yet.
This release makes some changes to internal support code that is not currently used in production Hypothesis. It has no user visible effect at present
This release makes some changes to internal support code that is not currently used in production Hypothesis. It has no user visible effect at present.
This release improves shrinking quality in some special cases.
This release improves shrinking quality in some special cases.
This release fixes 2507, where lazy evaluation meant that the values drawn from a ~hypothesis.strategies.sampled_from strategy could depend on mutatio
This release fixes 2507, where lazy evaluation meant that the values drawn from a ~hypothesis.strategies.sampled_from strategy could depend on mutations of the sampled sequence that happened after the strategy was constructed.
This patch fixes 2462, a bug in our handling of unittest.TestCase.subTest. Thanks to Israel Fruchter for fixing this at the EuroPython sprints!
This patch fixes 2462, a bug in our handling of unittest.TestCase.subTest. Thanks to Israel Fruchter for fixing this at the EuroPython sprints!
This release improves the behaviour of the ~hypothesis.strategies.characters strategy when shrinking, by changing which characters are considered smal
This release improves the behaviour of the ~hypothesis.strategies.characters strategy when shrinking, by changing which characters are considered smallest to prefer more "normal" ascii characters where available.
The default print_blob setting is now smarter. It defaults to True in CI and False for local development.
The default print_blob setting is now smarter. It defaults to True in CI and False for local development.
Thanks to Hugo van Kemenade for implementing this feature at the EuroPython sprints!
The ~hypothesis.strategies.slices strategy can now generate slices for empty sequences, slices with negative start and stop indices (from the end of t
The ~hypothesis.strategies.slices strategy can now generate slices for empty sequences, slices with negative start and stop indices (from the end of the sequence), and step=None in place of step=1.
Thanks to Sangarshanan for implementing this feature at the EuroPython sprints!
This release ensures that tests which raise RecursionError are not reported as flaky simply because we run them from different initial stack depths (2
This release ensures that tests which raise RecursionError are not reported as flaky simply because we run them from different initial stack depths (2494).
This release improves the performance of the sample method on objects obtained from ~hypothesis.strategies.randoms when use_true_random=False. This sh
This release improves the performance of the sample method on objects obtained from ~hypothesis.strategies.randoms when use_true_random=False. This should mostly only be noticeable when the sample size is a large fraction of the population size, but may also help avoid health check failures in some other cases.
This release makes some internal changes for testing purposes and should have no user visible effect.
This release makes some internal changes for testing purposes and should have no user visible effect.
This release fixes a small caching bug in Hypothesis internals that may under some circumstances have resulted in a less diverse set of test cases bei
This release fixes a small caching bug in Hypothesis internals that may under some circumstances have resulted in a less diverse set of test cases being generated than was intended.
Fixing this problem revealed some performance problems that could occur during targeted property based testing, so this release also fixes those. Targeted property-based testing should now be significantly faster in some cases, but this may be at the cost of reduced effectiveness.
This patch updates our formatting to use isort 5. There is no user-visible change.
This patch updates our formatting to use isort 5. There is no user-visible change.
The ~hypothesis.extra.numpy.basic_indices strategy can now generate bare indexers in place of length-one tuples. Thanks to Andrea for this patch!
The ~hypothesis.extra.numpy.basic_indices strategy can now generate bare indexers in place of length-one tuples. Thanks to Andrea for this patch!
This patch removes an internal use of distutils in order to avoid this setuptools warning __ for some users.
This patch removes an internal use of distutils in order to avoid this setuptools warning for some users.
This patch contains a small internal refactoring with no user-visible impact.
This patch contains a small internal refactoring with no user-visible impact.
Thanks to Andrea for writing this at the SciPy 2020 Sprints!
This release slightly improves shrinking behaviour. This should mainly only impact stateful tests, but may have some minor positive impact on shrinkin
This release slightly improves shrinking behaviour. This should mainly only impact stateful tests, but may have some minor positive impact on shrinking collections (lists, sets, etc).
This release improves the ~hypothesis.strategies.randoms strategy by adding support for Random instances where Hypothesis generates the random values
This release improves the ~hypothesis.strategies.randoms strategy by adding support for Random instances where Hypothesis generates the random values rather than having them be "truly" random.
This patch adds some internal functions to support a new feature we're working on. There is no user-visible change... yet.
This patch adds some internal functions to support a new feature we're working on. There is no user-visible change... yet.
This patch improves our docs for the ~hypothesis.settings.derandomize setting.
This patch improves our docs for the ~hypothesis.settings.derandomize setting.
This release consists of some internal refactoring to the shrinker in preparation for future work. It has no user visible impact.
This release consists of some internal refactoring to the shrinker in preparation for future work. It has no user visible impact.
One column per quarter.