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 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.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
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.
This release adds a new health check that checks if the smallest "natural" possible example of your test case is very large - this will tend to cause
This release adds a new health check that checks if the smallest "natural" possible example of your test case is very large - this will tend to cause Hypothesis to generate bad examples and be quite slow.
This work was funded by Smarkets.
This is a documentation release to improve the documentation of shrinking behaviour for Hypothesis's strategies.
This is a documentation release to improve the documentation of shrinking behaviour for Hypothesis's strategies.
This release improves the performance of ~hypothesis.strategies.characters when using exclude_characters and ~hypothesis.strategies.from_regex when us
This release improves the performance of ~hypothesis.strategies.characters when using exclude_characters and ~hypothesis.strategies.from_regex when using negative character classes.
The problems this fixes were found in the course of work funded by Smarkets.
This release improves the performance of characters() when using exclude_characters and from_regex() when using negative character classes.
The problems this fixes were found in the course of work funded by Smarkets .
This is a patch release for ~hypothesis.strategies.from_regex, which had a bug in handling of the python:re.VERBOSE flag (992). Flags are now handled
This is a patch release for ~hypothesis.strategies.from_regex, which had a bug in handling of the python:re.VERBOSE flag (992). Flags are now handled correctly when parsing regex.
This is a patch release for from_regex() , which had a bug in handling of the re.VERBOSE flag ( issue #992 ). Flags are now handled correctly when parsing regex.
This patch changes a few byte-string literals from double to single quotes, thanks to an update in unify. There are no user-visible changes.
This patch changes a few byte-string literals from double to single quotes, thanks to an update in unify. There are no user-visible changes.
This fixes the repr of strategies using lambda that are defined inside decorators to include the lambda source.
This fixes the repr of strategies using lambda that are defined inside decorators to include the lambda source.
This would mostly have been visible when using the statistics functionality - lambdas used for e.g. filtering would have shown up with a <unknown> as their body. This can still happen, but it should happen less often now.
This release updates the reported statistics so that they show approximately what fraction of your test run time is spent in data generation (as oppos
This release updates the reported statistics so that they show approximately what fraction of your test run time is spent in data generation (as opposed to test execution).
This work was funded by Smarkets.
This is a documentation release, which ensures code examples are up to date by running them as doctests in CI (711).
This is a documentation release, which ensures code examples are up to date by running them as doctests in CI (711).
This release changes the behaviour of the ~hypothesis.settings.deadline setting when used with ~hypothesis.strategies.data: Time spent inside calls to
This release changes the behaviour of the ~hypothesis.settings.deadline setting when used with ~hypothesis.strategies.data: Time spent inside calls to data.draw will no longer be counted towards the deadline time.
As a side effect of some refactoring required for this work, the way flaky tests are handled has changed slightly. You are unlikely to see much difference from this, but some error messages will have changed.
This work was funded by Smarkets.
This patch has a variety of non-user-visible refactorings, removing various minor warts ranging from indirect imports to typos in comments.
This patch has a variety of non-user-visible refactorings, removing various minor warts ranging from indirect imports to typos in comments.
This release overhauls the |HealthCheck| system in a variety of small ways. It adds no new features, but is nevertheless a minor release because it ch
This release overhauls the |HealthCheck| system in a variety of small ways. It adds no new features, but is nevertheless a minor release because it changes which tests are likely to fail health checks.
The most noticeable effect is that some tests that used to fail health checks will now pass, and some that used to pass will fail. These should all be improvements in accuracy. In particular:
New failures will usually be because they are now taking into account things like use of ~hypothesis.strategies.data and ~hypothesis.assume inside the test body.
New failures may also be because for some classes of example the way data generation performance was measured was artificially faster than real data generation (for most examples that are hitting performance health checks the opposite should be the case).
Tests that used to fail health checks and now pass do so because the health check system used to run in a way that was subtly different than the main Hypothesis data generation and lacked some of its support for e.g. large examples.
If your data generation is especially slow, you may also see your tests get somewhat faster, as there is no longer a separate health check phase. This will be particularly noticeable when rerunning test failures.
This work was funded by Smarkets.
This is a deprecation release for some health check related features.
This is a deprecation release for some health check related features.
The following are now deprecated:
Passing HealthCheck.exception_in_generation to ~hypothesis.settings.suppress_health_check. This no longer does anything even when passed - All errors that occur during data generation will now be immediately reraised rather than going through the health check mechanism.
Passing HealthCheck.random_module to ~hypothesis.settings.suppress_health_check. This hasn't done anything for a long time, but was never explicitly deprecated. Hypothesis always seeds the random module when running @given tests, so this is no longer an error and suppressing it doesn't do anything.
Passing non-~hypothesis.HealthCheck values in ~hypothesis.settings.suppress_health_check. This was previously allowed but never did anything useful.
In addition, passing a non-iterable value as ~hypothesis.settings.suppress_health_check will now raise an error immediately (it would never have worked correctly, but it would previously have failed later). Some validation error messages have also been updated.
This work was funded by Smarkets.
While ~python:inspect.getfullargspec was documented as deprecated in Python 3.5, it never actually emitted a warning. Our code to silence this (nonexi…
This is a yak shaving release, mostly concerned with our own tests.
While ~python:inspect.getfullargspec was documented as deprecated in Python 3.5, it never actually emitted a warning. Our code to silence this (nonexistent) warning has therefore been removed.
We now run our tests with DeprecationWarning as an error, and made some minor changes to our own tests as a result. This required similar upstream updates to coverage and execnet (a test-time dependency via pytest-xdist).
There is no user-visible change in Hypothesis itself, but we encourage you to consider enabling deprecations as errors in your own tests.
Documented the strict setting as deprecated, and updated the build so our docs always match deprecations in the code.
This release adds a setting to the public API, and does some internal cleanup:
The ~hypothesis.settings.derandomize setting is now documented (890)
Removed - and disallowed - all 'bare excepts' in Hypothesis (953)
Documented the strict setting as deprecated, and updated the build so our docs always match deprecations in the code.
This minor release supports constraining ~hypothesis.strategies.uuids to generate a particular version of ~python:uuid.UUID (721).
This minor release supports constraining ~hypothesis.strategies.uuids to generate a particular version of ~python:uuid.UUID (721).
Thanks to Dion Misic for this feature.
This minor release supports constraining uuids() to generate a particular version of UUID ( issue #721 ).
Thanks to Dion Misic for this feature.
This patch updates the documentation to suggest builds(callable) instead of just(callable()) .
This patch updates the documentation to suggest builds(callable) instead of just(callable()).
Hypothesis now emits deprecation warnings if you apply @given more than once to a target.
Hypothesis now emits deprecation warnings if you apply @given more than once to a target.
Applying @given repeatedly wraps the target multiple times. Each wrapper will search the space of possible parameters separately. This is equivalent but will be much more inefficient than doing it with a single call to @given.
For example, instead of @given(booleans()) @given(integers()), you could write @given(booleans(), integers())
~hypothesis.strategies.builds would try to infer a strategy for required positional arguments of the target from type hints, even if they had been giv
This is a bugfix release:
~hypothesis.strategies.builds would try to infer a strategy for required positional arguments of the target from type hints, even if they had been given to ~hypothesis.strategies.builds as positional arguments (946). Now it only infers missing required arguments.
An internal introspection function wrongly reported self as a required argument for bound methods, which might also have affected ~hypothesis.strategies.builds. Now it knows better.
This release supports strategy inference for more Django field types - you can now omit an argument for Date, Time, Duration, Slug, IP Address, and UU
This release supports strategy inference for more Django field types - you can now omit an argument for Date, Time, Duration, Slug, IP Address, and UUID fields. (642)
Strategy generation for fields with grouped choices now selects choices from each group, instead of selecting from the group names.
This patch removes the mergedb tool, introduced in Hypothesis 1.7.1 on an experimental basis. It has never actually worked, and the new Hypothesis exa
This patch removes the mergedb tool, introduced in Hypothesis 1.7.1 on an experimental basis. It has never actually worked, and the new Hypothesis example database is designed to make such a tool unnecessary.
This patch has two improvements for strategies based on enumerations.
This patch has two improvements for strategies based on enumerations.
~hypothesis.strategies.from_type now handles enumerations correctly, delegating to ~hypothesis.strategies.sampled_from. Previously it noted that Enum.__init__ has no required arguments and therefore delegated to ~hypothesis.strategies.builds, which would subsequently fail.
When sampling from an python:enum.Flag, we also generate combinations of members. Eg for Flag('Permissions', 'READ, WRITE, EXECUTE') we can now generate, Permissions.READ, Permissions.READ|WRITE, and so on.
This patch has two improvements for strategies based on enumerations.
from_type() now handles enumerations correctly, delegating to sampled_from() . Previously it noted that Enum.init has no required arguments and therefore delegated to builds() , which would subsequently fail.
When sampling from an enum.Flag , we also generate combinations of members. Eg for Flag('Permissions', 'READ, WRITE, EXECUTE') we can now generate, Permissions.READ , Permissions.READ|WRITE , and so on.
This changes the default value of the use_coverage setting to True when running on pypy (it was already True on CPython).
This changes the default value of the use_coverage setting to True when running on pypy (it was already True on CPython).
It was previously set to False because we expected it to be too slow, but recent benchmarking shows that actually performance of the feature on pypy is fairly acceptable - sometimes it's slower than on CPython, sometimes it's faster, but it's generally within a factor of two either way.
This patch improves the quality of strategies inferred from Numpy dtypes:
This patch improves the quality of strategies inferred from Numpy dtypes:
Integer dtypes generated examples with the upper half of their (non-sign) bits set to zero. The inferred strategies can now produce any representable integer.
Fixed-width unicode- and byte-string dtypes now cap the internal example length, which should improve example and shrink quality.
Numpy arrays can only store fixed-size strings internally, and allow shorter strings by right-padding them with null bytes. Inferred string strategies no longer generate such values, as they can never be retrieved from an array. This improves shrinking performance by skipping useless values.
This has already been useful in Hypothesis - we found an overflow bug in our Pandas support, and as a result ~hypothesis.extra.pandas.indexes and ~hypothesis.extra.pandas.range_indexes now check that min_size and max_size are at least zero.
This release fixes a performance problem in tests where the use_coverage setting is True.
This release fixes a performance problem in tests where the use_coverage setting is True.
Tests experience a slow-down proportionate to the amount of code they cover. This is still the case, but the factor is now low enough that it should be unnoticeable. Previously it was large and became much larger in 3.30.4.
~hypothesis.strategies.from_type failed with a very confusing error if passed a ~typing.NewType (901). These pseudo-types are now unwrapped correctly,
~hypothesis.strategies.from_type failed with a very confusing error if passed a ~typing.NewType (901). These pseudo-types are now unwrapped correctly, and strategy inference works as expected.
This release makes some small optimisations to our use of coverage that should reduce constant per-example overhead. This is probably only noticeable
This release makes some small optimisations to our use of coverage that should reduce constant per-example overhead. This is probably only noticeable on examples where the test itself is quite fast. On no-op tests that don't test anything you may see up to a fourfold speed increase (which is still significantly slower than without coverage). On more realistic tests the speed up is likely to be less than that.
This release fixes some formatting and small typos/grammar issues in the documentation, specifically the page docs/settings.rst, and the inline docs f
This release fixes some formatting and small typos/grammar issues in the documentation, specifically the page docs/settings.rst, and the inline docs for the various settings.
This release improves the handling of deadlines so that they act better with the shrinking process. This fixes 892.
This release improves the handling of deadlines so that they act better with the shrinking process. This fixes 892.
This involves two changes:
The deadline is raised during the initial generation and shrinking, and then lowered to the set value for final replay. This restricts our attention to examples which exceed the deadline by a more significant margin, which increases their reliability.
When despite the above a test still becomes flaky because it is significantly faster on rerun than it was on its first run, the error message is now more explicit about the nature of this problem, and includes both the initial test run time and the new test run time.
In addition, this release also clarifies the documentation of the deadline setting slightly to be more explicit about where it applies.
This work was funded by Smarkets.
This release blocks installation of Hypothesis on Python 3.3, which :PEP:reached its end of life date on 2017-09-29 <398>.
This release blocks installation of Hypothesis on Python 3.3, which :PEP:`reached its end of life date on 2017-09-29 <398>`.
This should not be of interest to anyone but downstream maintainers - if you are affected, migrate to a secure version of Python as soon as possible or at least seek commercial support.
This release makes several changes:
This release makes several changes:
It significantly improves Hypothesis's ability to use coverage information to find interesting examples.
It reduces the default ~hypothesis.settings.max_examples setting from 200 to 100. This takes advantage of the improved algorithm meaning fewer examples are typically needed to get the same testing and is sufficiently better at covering interesting behaviour, and offsets some of the performance problems of running under coverage.
Hypothesis will always try to start its testing with an example that is near minimized.
The new algorithm for 1 also makes some changes to Hypothesis's low level data generation which apply even with coverage turned off. They generally reduce the total amount of data generated, which should improve test performance somewhat. Between this and 3 you should see a noticeable reduction in test runtime (how much so depends on your tests and how much example size affects their performance. On our benchmarks, where data generation dominates, we saw up to a factor of two performance improvement, but it's unlikely to be that large.
This release fixes some formatting and small typos/grammar issues in the documentation, specifically the page docs/details.rst, and some inline docs l
This release fixes some formatting and small typos/grammar issues in the documentation, specifically the page docs/details.rst, and some inline docs linked from there.
This release changes Hypothesis's caching approach for functions in hypothesis.strategies. Previously it would have cached extremely aggressively and
This release changes Hypothesis's caching approach for functions in hypothesis.strategies. Previously it would have cached extremely aggressively and cache entries would never be evicted. Now it adopts a least-frequently used, least recently used key invalidation policy, and is somewhat more conservative about which strategies it caches.
Workloads which create strategies based on dynamic values, e.g. by using |.flatmap| or ~hypothesis.strategies.composite, will use significantly less memory.
This release fixes a bug where when running with the use_coverage=True setting inside an existing running instance of coverage, Hypothesis would frequ
This release fixes a bug where when running with the use_coverage=True setting inside an existing running instance of coverage, Hypothesis would frequently put files that the coveragerc excluded in the report for the enclosing coverage.
This release introduces two new features:
This release introduces two new features:
When a test fails, either with a health check failure or a falsifying example, Hypothesis will print out a seed that led to that failure, if the test is not already running with a fixed seed. You can then recreate that failure using either the @seed decorator or (if you are running pytest) with --hypothesis-seed.
pytest users can specify a seed to use for @given based tests by passing the --hypothesis-seed command line argument.
This work was funded by Smarkets.
This release makes Hypothesis coverage aware. Hypothesis now runs all test bodies under coverage, and uses this information to guide its testing.
This release makes Hypothesis coverage aware. Hypothesis now runs all test bodies under coverage, and uses this information to guide its testing.
The use_coverage setting can be used to disable this behaviour if you want to test code that is sensitive to coverage being enabled (either because of performance or interaction with the trace function).
The main benefits of this feature are:
Hypothesis now observes when examples it discovers cover particular lines or branches and stores them in the database for later.
Hypothesis will make some use of this information to guide its exploration of the search space and improve the examples it finds (this is currently used only very lightly and will likely improve significantly in future releases).
This also has the following side-effects:
Hypothesis now has an install time dependency on the coverage package.
Tests that are already running Hypothesis under coverage will likely get faster.
Tests that are not running under coverage now run their test bodies under coverage by default.
This feature is only partially supported under pypy. It is significantly slower than on CPython and is turned off by default as a result, but it should still work correctly if you want to use it.
This release is an internal change that affects how Hypothesis handles calculating certain properties of strategies.
This release is an internal change that affects how Hypothesis handles calculating certain properties of strategies.
The primary effect of this is that it fixes a bug where use of ~hypothesis.strategies.deferred could sometimes trigger an internal assertion error. However the fix for this bug involved some moderately deep changes to how Hypothesis handles certain constructs so you may notice some additional knock-on effects.
In particular the way Hypothesis handles drawing data from strategies that cannot generate any values has changed to bail out sooner than it previously did. This may speed up certain tests, but it is unlikely to make much of a difference in practice for tests that were not already failing with Unsatisfiable.
This is a patch release that fixes a bug in the hypothesis.extra.pandas documentation where it incorrectly referred to ~hypothesis.extra.pandas.column
This is a patch release that fixes a bug in the hypothesis.extra.pandas documentation where it incorrectly referred to ~hypothesis.extra.pandas.column instead of ~hypothesis.extra.pandas.columns.
This is a patch release that fixes a bug in the hypothesis.extra.pandas documentation where it incorrectly referred to column() instead of columns() .
One column per quarter.