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 today
05 Oct 2026
Ships on a steady schedule
a new release about every 1 weeks
Nearly every release is documented
notes for 58 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
1573 releases · first in 2013
The HYPOTHESIS_DATABASE_FILE environment variable is deprecated, in favor of ~hypothesis.settings.load_profile and the ~hypothesis.settings.database s…
This release includes several improvements to the handling of the ~hypothesis.settings.database setting.
The database_file setting was a historical artefact, and you should just use ~hypothesis.settings.database directly.
The HYPOTHESIS_DATABASE_FILE environment variable is deprecated, in favor of ~hypothesis.settings.load_profile and the ~hypothesis.settings.database setting.
If you have not configured the example database at all and the default location is not usable (due to e.g. permissions issues), Hypothesis will fall back to an in-memory database. This is not persisted between sessions, but means that the defaults work on read-only filesystems.
This release improves the ~hypothesis.strategies.complex_numbers strategy, which now supports min_magnitude and max_magnitude arguments, along with al
This release improves the ~hypothesis.strategies.complex_numbers strategy, which now supports min_magnitude and max_magnitude arguments, along with allow_nan and allow_infinity like for ~hypothesis.strategies.floats.
Thanks to J.J. Green for this feature.
One column per quarter.
This release improves the complex_numbers() strategy, which now supports min_magnitude and max_magnitude arguments, along with allow_nan and allow_infinity like for floats() .
Thanks to J.J. Green for this feature.
This release removes support for Django 1.8, which reached end of life on 2018-04-01. You can see Django's release and support schedule on the Django
This release removes support for Django 1.8, which reached end of life on 2018-04-01. You can see Django's release and support schedule on the Django Project website.
This patch fixes the min_satisfying_examples settings documentation, by explaining that example shrinking is tracked at the level of the underlying by
This patch fixes the min_satisfying_examples settings documentation, by explaining that example shrinking is tracked at the level of the underlying bytestream rather than the output value.
The output from find() in verbose mode has also been adjusted - see the example session for |Verbosity| - to avoid duplicating lines when the example repr is constant, even if the underlying representation has been shrunken.
This release improves the output of failures with rule based stateful testing in two ways:
This release improves the output of failures with rule based stateful testing in two ways:
The output from it is now usually valid Python code.
When the same value has two different names because it belongs to two different bundles, it will now display with the name associated with the correct bundle for a rule argument where it is used.
This release improves the behaviour of stateful testing in two ways:
This release improves the behaviour of stateful testing in two ways:
Previously some runs would run no steps (376). This should no longer happen.
RuleBasedStateMachine tests which used bundles extensively would often shrink terribly. This should now be significantly improved, though there is likely a lot more room for improvement.
This release also involves a low level change to how ranges of integers are handles which may result in other improvements to shrink quality in some cases.
This release deprecates use of @settings(...) as a decorator, on functions or methods that are not also decorated with @given . You can still apply th…
This release deprecates use of @settings(...) as a decorator, on functions or methods that are not also decorated with @given. You can still apply these decorators in any order, though you should only do so once each.
Applying @given twice was already deprecated, and applying @settings(...) twice is deprecated in this release and will become an error in a future version. Neither could ever be used twice to good effect.
Using @settings(...) as the sole decorator on a test is completely pointless, so this common usage error will become an error in a future version of Hypothesis.
This release deprecates the average_size argument to ~hypothesis.strategies.lists and other collection strategies. You should simply delete it whereve…
This release deprecates the average_size argument to ~hypothesis.strategies.lists and other collection strategies. You should simply delete it wherever it was used in your tests, as it no longer has any effect.
In early versions of Hypothesis, the average_size argument was treated as a hint about the distribution of examples from a strategy. Subsequent improvements to the conceptual model and the engine for generating and shrinking examples mean it is more effective to simply describe what constitutes a valid example, and let our internals handle the distribution.
This patch contains some internal refactoring so that we can run with warnings as errors in CI.
This patch contains some internal refactoring so that we can run with warnings as errors in CI.
This has no user-visible changes except one slight formatting change to one docstring, to avoid a deprecation warning.
This has no user-visible changes except one slight formatting change to one docstring, to avoid a deprecation warning.
This patch fixes an internal error introduced in 3.48.0 , where a check for the Django test runner would expose import-time errors in Django configura
This patch fixes an internal error introduced in 3.48.0, where a check for the Django test runner would expose import-time errors in Django configuration (1167).
This release improves validation of numeric bounds for some strategies.
This release improves validation of numeric bounds for some strategies.
~hypothesis.strategies.integers and ~hypothesis.strategies.floats now raise InvalidArgument if passed a min_value or max_value which is not an instance of ~python:numbers.Real, instead of various internal errors.
~hypothesis.strategies.floats now converts its bounding values to the nearest float above or below the min or max bound respectively, instead of just casting to float. The old behaviour was incorrect in that you could generate float(min_value), even when this was less than min_value itself (possible with eg. fractions).
When both bounds are provided to ~hypothesis.strategies.floats but there are no floats in the interval, such as [(2**54)+1 .. (2**55)-1], InvalidArgument is raised.
~hypothesis.strategies.decimals gives a more useful error message if passed a string that cannot be converted to ~python:decimal.Decimal in a context where this error is not trapped.
Code that previously seemed to work may be explicitly broken if there were no floats between min_value and max_value (only possible with non-float bounds), or if a bound was not a ~python:numbers.Real number but still allowed in python:math.isnan (some custom classes with a __float__ method).
This patch fixes our tests for Numpy dtype strategies on big-endian platforms, where the strategy behaved correctly but the test assumed that the nati
This patch fixes our tests for Numpy dtype strategies on big-endian platforms, where the strategy behaved correctly but the test assumed that the native byte order was little-endian.
There is no user impact unless you are running our test suite on big-endian platforms. Thanks to Graham Inggs for reporting 1164.
This release deprecates passing elements=None to collection strategies, such as ~hypothesis.strategies.lists.
This release deprecates passing elements=None to collection strategies, such as ~hypothesis.strategies.lists.
Requiring lists(nothing()) or builds(list) instead of lists() means slightly more typing, but also improves the consistency and discoverability of our API - as well as showing how to compose or construct strategies in ways that still work in more complex situations.
Passing a nonzero max_size to a collection strategy where the elements strategy contains no values is now deprecated, and will be an error in a future version. The equivalent with elements=None is already an error.
This patch will minimize examples that would come out non-minimal in previous versions. Thanks to Kyle Reeve for this patch.
This patch will minimize examples that would come out non-minimal in previous versions. Thanks to Kyle Reeve for this patch.
This release improves some "unhappy paths" when using Hypothesis with the standard library python:unittest module:
This release improves some "unhappy paths" when using Hypothesis with the standard library python:unittest module:
Applying @given to a non-test method which is overridden from python:unittest.TestCase, such as setUp, raises a new health check. (991)
Using ~python:unittest.TestCase.subTest within a test decorated with @given would leak intermediate results when tests were run under the python:unittest test runner. Individual reporting of failing subtests is now disabled during a test using @given. (1071)
@given is still not a class decorator, but the error message if you try using it on a class has been improved.
As a related improvement, using django:django.test.TestCase with @given instead of hypothesis.extra.django.TestCase raises an explicit error instead of running all examples in a single database transaction.
Using a name for a registered profile which is not a string was never suggested, but it is now also deprecated and will eventually be an error.
~hypothesis.settings.register_profile now accepts keyword arguments for specific settings, and the parent settings object is now optional. Using a name for a registered profile which is not a string was never suggested, but it is now also deprecated and will eventually be an error.
This release removes an unnecessary branch from the code, and has no user-visible impact.
This release removes an unnecessary branch from the code, and has no user-visible impact.
This changes only the formatting of our docstrings and should have no user-visible effects.
This changes only the formatting of our docstrings and should have no user-visible effects.
…of some existing code), and all other input is deprecated.
~hypothesis.strategies.characters has improved docs about what arguments are valid, and additional validation logic to raise a clear error early (instead of e.g. silently ignoring a bad argument). Categories may be specified as the Unicode 'general category' (eg 'Nd'), or as the 'major category' (eg ['N', 'Lu'] is equivalent to ['Nd', 'Nl', 'No', 'Lu']).
In previous versions, general categories were supported and all other input was silently ignored. Now, major categories are supported in addition to general categories (which may change the behaviour of some existing code), and all other input is deprecated.
This patch improves strategy inference in hypothesis.extra.django to account for some validators in addition to field type - see 1116 for ongoing work
This patch improves strategy inference in hypothesis.extra.django to account for some validators in addition to field type - see 1116 for ongoing work in this space.
Specifically, if a ~django:django.db.models.CharField or ~django:django.db.models.TextField has an attached ~django:django.core.validators.RegexValidator, we now use ~hypothesis.strategies.from_regex instead of ~hypothesis.strategies.text as the underlying strategy. This allows us to generate examples of the default ~django:django.contrib.auth.models.User model, closing 1112.
This patch improves strategy inference in hypothesis.extra.django to account for some validators in addition to field type - see issue #1116 for ongoing work in this space.
Specifically, if a CharField or TextField has an attached RegexValidator , we now use from_regex() instead of text() as the underlying strategy. This allows us to generate examples of the default User model, closing issue #1112 .
This patch improves some internal debugging information, fixes a typo in a validation error message, and expands the documentation for new contributor
This patch improves some internal debugging information, fixes a typo in a validation error message, and expands the documentation for new contributors.
This patch may improve example shrinking slightly for some strategies.
This patch may improve example shrinking slightly for some strategies.
This release makes our docstring style more consistent, thanks to flake8-docstrings. There are no user-visible changes.
This release makes our docstring style more consistent, thanks to flake8-docstrings. There are no user-visible changes.
This fixes an indentation issue in docstrings for ~hypothesis.strategies.datetimes, ~hypothesis.strategies.dates, ~hypothesis.strategies.times, and ~h
This fixes an indentation issue in docstrings for ~hypothesis.strategies.datetimes, ~hypothesis.strategies.dates, ~hypothesis.strategies.times, and ~hypothesis.strategies.timedeltas.
This fixes an indentation issue in docstrings for datetimes() , dates() , times() , and timedeltas() .
The target itself can still be specified as a keyword argument, but that behavior is now deprecated. The target should be provided as the first positi…
This release fixes ~hypothesis.strategies.builds so that target can be used as a keyword argument for passing values to the target. The target itself can still be specified as a keyword argument, but that behavior is now deprecated. The target should be provided as the first positional argument.
This release fixes some formatting issues in the Hypothesis source code. It should have no externally visible effects.
This release fixes some formatting issues in the Hypothesis source code. It should have no externally visible effects.
This release changes the way in which Hypothesis tries to shrink the size of examples. It probably won't have much impact, but might make shrinking fa
This release changes the way in which Hypothesis tries to shrink the size of examples. It probably won't have much impact, but might make shrinking faster in some cases. It is unlikely but not impossible that it will change the resulting examples.
This release fixes dependency information when installing Hypothesis from a binary "wheel" distribution.
This release fixes dependency information when installing Hypothesis from a binary "wheel" distribution.
The install_requires for enum34 is resolved at install time, rather than at build time (with potentially different results).
Django has fixed their python_requires for versions 2.0.0 onward, simplifying Python2-compatible constraints for downstream projects.
This release improves shrinking in a class of pathological examples that you are probably never hitting in practice. If you *are* hitting them in prac
This release improves shrinking in a class of pathological examples that you are probably never hitting in practice. If you are hitting them in practice this should be a significant speed up in shrinking. If you are not, you are very unlikely to notice any difference. You might see a slight slow down and/or slightly better falsifying examples.
This release fixes a dependency problem. It was possible to install Hypothesis with an old version of attrs, which would throw a TypeError as soon as
This release fixes a dependency problem. It was possible to install Hypothesis with an old version of attrs, which would throw a TypeError as soon as you tried to import hypothesis. Specifically, you need attrs 16.0.0 or newer.
Hypothesis will now require the correct version of attrs when installing.
This change adds some additional structural information that Hypothesis will use to guide its search.
This change adds some additional structural information that Hypothesis will use to guide its search.
You mostly shouldn't see much difference from this. The two most likely effects you would notice are:
Hypothesis stores slightly more examples in its database for passing tests.
Hypothesis may find new bugs that it was previously missing, but it probably won't (this is a basic implementation of the feature that is intended to support future work. Although it is useful on its own, it's not very useful on its own).
This is a small refactoring release that changes how Hypothesis tracks some information about the boundary of examples in its internal representation.
This is a small refactoring release that changes how Hypothesis tracks some information about the boundary of examples in its internal representation.
You are unlikely to see much difference in behaviour, but memory usage and run time may both go down slightly during normal test execution, and when failing Hypothesis might print its failing example slightly sooner.
This changes how we compute the default average_size for all collection strategies. Previously setting a max_size without setting an average_size woul
This changes how we compute the default average_size for all collection strategies. Previously setting a max_size without setting an average_size would have the seemingly paradoxical effect of making data generation slower, because it would raise the average size from its default. Now setting max_size will either leave the default unchanged or lower it from its default.
If you are currently experiencing this problem, this may make your tests substantially faster. If you are not, this will likely have no effect on you.
This is a small refactoring release that changes how Hypothesis detects when the structure of data generation depends on earlier values generated (e.g
This is a small refactoring release that changes how Hypothesis detects when the structure of data generation depends on earlier values generated (e.g. when using |.flatmap| or ~hypothesis.strategies.composite). It should not have any observable effect on behaviour.
This release improves test case reduction for recursive data structures. Hypothesis now guarantees that whenever a strategy calls itself recursively (
This release improves test case reduction for recursive data structures. Hypothesis now guarantees that whenever a strategy calls itself recursively (usually this will happen because you are using ~hypothesis.strategies.deferred), any recursive call may replace the top level value. e.g. given a tree structure, Hypothesis will always try replacing it with a subtree.
Additionally this introduces a new heuristic that may in some circumstances significantly speed up test case reduction - Hypothesis should be better at immediately replacing elements drawn inside another strategy with their minimal possible value.
~hypothesis.strategies.from_type can now resolve recursive types such as binary trees (1004). Detection of non-type arguments has also improved, leadi
~hypothesis.strategies.from_type can now resolve recursive types such as binary trees (1004). Detection of non-type arguments has also improved, leading to better error messages in many cases involving forward references.
This release fixes a bug in the shrinker that prevented the optimisations in 3.44.6 from working in some cases. It would not have worked correctly whe
This release fixes a bug in the shrinker that prevented the optimisations in 3.44.6 from working in some cases. It would not have worked correctly when filtered examples were nested (e.g. with a set of integers in some range).
This would not have resulted in any correctness problems, but shrinking may have been slower than it otherwise could be.
This release changes the average bit length of values drawn from ~hypothesis.strategies.integers to be much smaller. Additionally it changes the shrin
This release changes the average bit length of values drawn from ~hypothesis.strategies.integers to be much smaller. Additionally it changes the shrinking order so that now size is considered before sign - e.g. -1 will be preferred to +10.
The new internal format for integers required some changes to the minimizer to make work well, so you may also see some improvements to example quality in unrelated areas.
This changes Hypothesis's internal implementation of weighted sampling. This will affect example distribution and quality, but you shouldn't see any o
This changes Hypothesis's internal implementation of weighted sampling. This will affect example distribution and quality, but you shouldn't see any other effects.
This is a change to some internals around how Hypothesis handles avoiding generating duplicate examples and seeking out novel regions of the search sp
This is a change to some internals around how Hypothesis handles avoiding generating duplicate examples and seeking out novel regions of the search space.
You are unlikely to see much difference as a result of it, but it fixes a bug where an internal assertion could theoretically be triggered and has some minor effects on the distribution of examples so could potentially find bugs that have previously been missed.
This patch avoids creating debug statements when debugging is disabled. Profiling suggests this is a 5-10% performance improvement (1040).
This patch avoids creating debug statements when debugging is disabled. Profiling suggests this is a 5-10% performance improvement (1040).
This patch blacklists null characters ('\x00') in automatically created strategies for Django ~django:django.db.models.CharField and ~django:django.db
This patch blacklists null characters ('\x00') in automatically created strategies for Django ~django:django.db.models.CharField and ~django:django.db.models.TextField, due to a database issue which was recently fixed upstream (Hypothesis 1045).
This patch blacklists null characters ( '\x00' ) in automatically created strategies for Django CharField and TextField , due to a database issue which was recently fixed upstream (Hypothesis issue #1045 ).
This release makes the Hypothesis shrinker slightly less greedy in order to avoid local minima - when it gets stuck, it makes a small attempt to searc
This release makes the Hypothesis shrinker slightly less greedy in order to avoid local minima - when it gets stuck, it makes a small attempt to search around the final example it would previously have returned to find a new starting point to shrink from. This should improve example quality in some cases, especially ones where the test data has dependencies among parts of it that make it difficult for Hypothesis to proceed.
This release adds support for Django 2 _ in the hypothesis-django extra.
This release adds support for Django 2 in the hypothesis-django extra.
This release drops support for Django 1.10, as it is no longer supported by the Django team.
This release speeds up test case reduction in many examples by being better at detecting large shrinks it can use to discard redundant parts of its in
This release speeds up test case reduction in many examples by being better at detecting large shrinks it can use to discard redundant parts of its input. This will be particularly noticeable in examples that make use of filtering and for some integer ranges.
This is a no-op release that updates the year range on all of the copyright headers in our source to include 2018.
Happy new year!
This is a no-op release that updates the year range on all of the copyright headers in our source to include 2018.
This release fixes 1041, which slowed tests by up to 6% due to broken caching.
This release fixes 1041, which slowed tests by up to 6% due to broken caching.
This release improves the shrinker in cases where examples drawn earlier can affect how much data is drawn later (e.g. when you draw a length paramete
This release improves the shrinker in cases where examples drawn earlier can affect how much data is drawn later (e.g. when you draw a length parameter in a composite and then draw that many elements). Examples found in cases like this should now be much closer to minimal.
This is a pure refactoring release which changes how Hypothesis manages its set of examples internally. It should have no externally visible effects.
This is a pure refactoring release which changes how Hypothesis manages its set of examples internally. It should have no externally visible effects.
This release fixes 997, in which under some circumstances the body of tests run under Hypothesis would not show up when run under coverage even though
This release fixes 997, in which under some circumstances the body of tests run under Hypothesis would not show up when run under coverage even though the tests were run and the code they called outside of the test file would show up normally.
This release adds a new feature: The @reproduce_failure decorator, designed to make it easy to use Hypothesis's binary format for examples to reproduc
This release adds a new feature: The @reproduce_failure decorator, designed to make it easy to use Hypothesis's binary format for examples to reproduce a problem locally without having to share your example database between machines.
This also changes when seeds are printed:
They will no longer be printed for normal falsifying examples, as there are now adequate ways of reproducing those for all cases, so it just contributes noise.
They will once again be printed when reusing examples from the database, as health check failures should now be more reliable in this scenario so it will almost always work in this case.
This work was funded by Smarkets.
This release fixes a bug with Hypothesis's database management - examples that were found in the course of shrinking were saved in a way that indicate
This release fixes a bug with Hypothesis's database management - examples that were found in the course of shrinking were saved in a way that indicated that they had distinct causes, and so they would all be retried on the start of the next test. The intended behaviour, which is now what is implemented, is that only a bounded subset of these examples would be retried.
~hypothesis.errors.HypothesisDeprecationWarning now inherits from python:FutureWarning instead of python:DeprecationWarning, as recommended by 565 for…
~hypothesis.errors.HypothesisDeprecationWarning now inherits from python:FutureWarning instead of python:DeprecationWarning, as recommended by 565 for user-facing warnings (618). If you have not changed the default warnings settings, you will now see each distinct ~hypothesis.errors.HypothesisDeprecationWarning instead of only the first.
HypothesisDeprecationWarning now inherits from FutureWarning instead of DeprecationWarning , as recommended by PEP 565 for user-facing warnings ( issue #618 ). If you have not changed the default warnings settings, you will now see each distinct HypothesisDeprecationWarning instead of only the first.
This patch fixes 1017, where instances of a list or tuple subtype used as an argument to a strategy would be coerced to tuple.
This patch fixes 1017, where instances of a list or tuple subtype used as an argument to a strategy would be coerced to tuple.
This release has some internal cleanup, which makes reading the code more pleasant and may shrink large examples slightly faster.
This release has some internal cleanup, which makes reading the code more pleasant and may shrink large examples slightly faster.
This release deprecates faker-extra, which was designed as a transition strategy but does not support example shrinking or coverage-guided discovery.
This release deprecates faker-extra, which was designed as a transition strategy but does not support example shrinking or coverage-guided discovery.
Sampling from multi-dimensional ndarrays still results in a deprecation warning. Thanks to Charlie Tanksley for this patch.
~hypothesis.strategies.sampled_from can now sample from one-dimensional numpy ndarrays. Sampling from multi-dimensional ndarrays still results in a deprecation warning. Thanks to Charlie Tanksley for this patch.
This release makes two changes:
This release makes two changes:
It makes the calculation of some of the metadata that Hypothesis uses for shrinking occur lazily. This should speed up performance of test case generation a bit because it no longer calculates information it doesn't need.
It improves the shrinker for certain classes of nested examples. e.g. when shrinking lists of lists, the shrinker is now able to concatenate two adjacent lists together into a single list. As a result of this change, shrinking may get somewhat slower when the minimal example found is large.
Using the example database with ~hypothesis.seed is now deprecated. You should set database=None if you are doing that. This will only warn if you act…
This release improves how various ways of seeding Hypothesis interact with the example database:
Using the example database with ~hypothesis.seed is now deprecated. You should set database=None if you are doing that. This will only warn if you actually load examples from the database while using @seed.
The ~hypothesis.settings.derandomize will behave the same way as @seed.
Using --hypothesis-seed will disable use of the database.
If a test used examples from the database, it will not suggest using a seed to reproduce it, because that won't work.
This work was funded by Smarkets.
Your coding agent can read these notes before it upgrades. Set up the MCP server →