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 adds support for partially sorting examples which cannot be fully sorted. For example, [5, 4, 3, 2, 1, 0] with a constraint that the first elemen
This adds support for partially sorting examples which cannot be fully sorted. For example, [5, 4, 3, 2, 1, 0] with a constraint that the first element needs to be larger than the last becomes [1, 2, 3, 4, 5, 0].
Thanks to Luke for contributing.
This patch uses python:random.getstate and python:random.setstate to restore the PRNG state after @given runs deterministic tests. Without restoring s
This patch uses python:random.getstate and python:random.setstate to restore the PRNG state after @given runs deterministic tests. Without restoring state, you might have noticed problems such as 1266. The fix also applies to stateful testing (702).
This patch uses random.getstate() and random.setstate() to restore the PRNG state after @given runs deterministic tests. Without restoring state, you might have noticed problems such as issue #1266 . The fix also applies to stateful testing ( issue #702 ).
Your coding agent can read these notes before it upgrades. Set up the MCP server →
This release adds the ~hypothesis.strategies.emails strategy, which generates unicode strings representing an email address.
This release adds the ~hypothesis.strategies.emails strategy, which generates unicode strings representing an email address.
Thanks to Sushobhit for moving this to the public API (162).
This improves the shrinker. It can now reorder examples: 3 1 2 becomes 1 2 3.
This improves the shrinker. It can now reorder examples: 3 1 2 becomes 1 2 3.
Thanks to Luke for contributing.
This adds a new extra func:~hypothesis.extra.dateutil.timezones strategy that generates dateutil timezones .
This adds a new extra ~hypothesis.extra.dateutil.timezones strategy that generates dateutil timezones.
Thanks to Conrad for contributing.
This adds a new extra timezones() strategy that generates dateutil timezones .
Thanks to Conrad for contributing.
Using an unordered collection with the ~hypothesis.strategies.permutations strategy has been deprecated because the order in which e.g. a set shrinks…
Using an unordered collection with the ~hypothesis.strategies.permutations strategy has been deprecated because the order in which e.g. a set shrinks is arbitrary. This may cause different results between runs.
This release makes hypothesis.settings.define_setting a private method, which has the effect of hiding it from the documentation.
This release makes hypothesis.settings.define_setting a private method, which has the effect of hiding it from the documentation.
This is another release with no functionality changes as part of changes to Hypothesis's new release tagging scheme.
This is another release with no functionality changes as part of changes to Hypothesis's new release tagging scheme.
This is a release with no functionality changes that moves Hypothesis over to a new release tagging scheme.
This is a release with no functionality changes that moves Hypothesis over to a new release tagging scheme.
This release provides a performance improvement for most tests, but in particular users of ~hypothesis.strategies.sampled_from who don't have numpy in
This release provides a performance improvement for most tests, but in particular users of ~hypothesis.strategies.sampled_from who don't have numpy installed should see a significant performance improvement.
This patch contains further internal work to support Mypy. There are no user-visible changes... yet.
This patch contains further internal work to support Mypy. There are no user-visible changes... yet.
This patch contains some internal refactoring to run mypy in CI. There are no user-visible changes.
This patch contains some internal refactoring to run mypy in CI. There are no user-visible changes.
This release involves some very minor internal clean up and should have no user visible effect at all.
This release involves some very minor internal clean up and should have no user visible effect at all.
This release fixes a problem introduced in 3.56.0 where setting the hypothesis home directory (through currently undocumented means) would no longer r
This release fixes a problem introduced in 3.56.0 where setting the hypothesis home directory (through currently undocumented means) would no longer result in the default database location living in the new home directory.
This release fixes a problem introduced in 3.56.0 where setting ~hypothesis.settings.max_examples to 1 would result in tests failing with Unsatisfiabl
This release fixes a problem introduced in 3.56.0 where setting ~hypothesis.settings.max_examples to 1 would result in tests failing with Unsatisfiable. This problem could also occur in other harder to trigger circumstances (e.g. by setting it to a low value, having a hard to satisfy assumption, and disabling health checks).
…environment variable was, rather than deprecated, actually broken due to being read before various setup the deprecation path needed was done. It now…
This release fixes a problem that was introduced in 3.56.0: Use of the HYPOTHESIS_VERBOSITY_LEVEL environment variable was, rather than deprecated, actually broken due to being read before various setup the deprecation path needed was done. It now works correctly (and emits a deprecation warning).
This release deprecates several redundant or internally oriented ~hypothesis.settings, working towards an orthogonal set of configuration options that…
This release deprecates several redundant or internally oriented ~hypothesis.settings, working towards an orthogonal set of configuration options that are widely useful without requiring any knowledge of our internals (535).
Deprecated settings that no longer have any effect are no longer shown in the __repr__ unless set to a non-default value.
hypothesis.settings.perform_health_check is deprecated, as it duplicates ~hypothesis.settings.suppress_health_check.
hypothesis.settings.max_iterations is deprecated and disabled, because we can usually get better behaviour from an internal heuristic than a user-controlled setting.
hypothesis.settings.min_satisfying_examples is deprecated and disabled, due to overlap with the ~hypothesis.HealthCheck.filter_too_much healthcheck and poor interaction with ~hypothesis.settings.max_examples.
HYPOTHESIS_VERBOSITY_LEVEL is now deprecated. Set ~hypothesis.settings.verbosity through the profile system instead.
Examples tried by find() are now reported at debug verbosity level (as well as verbose level).
This release fixes a somewhat obscure condition (1230) under which you could occasionally see a failing test trigger an assertion error inside Hypothe
This release fixes a somewhat obscure condition (1230) under which you could occasionally see a failing test trigger an assertion error inside Hypothesis instead of failing normally.
This patch fixes one possible cause of 966. When running Python 2 with hash randomisation, passing a python:bytes object to python:random.seed would u
This patch fixes one possible cause of 966. When running Python 2 with hash randomisation, passing a python:bytes object to python:random.seed would use version=1, which broke ~hypothesis.settings.derandomize (because the seed depended on a randomised hash). If ~hypothesis.settings.derandomize is still nondeterministic for you, please open an issue.
This patch fixes one possible cause of issue #966 . When running Python 2 with hash randomisation, passing a bytes object to random.seed() would use version=1 , which broke derandomize (because the seed depended on a randomised hash). If derandomize is still nondeterministic for you, please open an issue.
This patch makes a variety of minor improvements to the documentation, and improves a few validation messages for invalid inputs.
This patch makes a variety of minor improvements to the documentation, and improves a few validation messages for invalid inputs.
This release updates the URL metadata associated with the PyPI package (again). It has no other user visible effects.
This release updates the URL metadata associated with the PyPI package (again). It has no other user visible effects.
This release updates the URL metadata associated with the PyPI package. It has no other user visible effects.
This release updates the URL metadata associated with the PyPI package. It has no other user visible effects.
This patch relaxes constraints in our tests on the expected values returned by the standard library function ~python:math.hypot and the internal helpe
This patch relaxes constraints in our tests on the expected values returned by the standard library function ~python:math.hypot and the internal helper function cathetus, to fix near-exact test failures on some 32-bit systems used by downstream packagers.
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.
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.
One column per quarter.