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 is a refactoring release. It moves a number of internal uses of ~python:collections.namedtuple over to using attrs based classes, and removes a c
This is a refactoring release. It moves a number of internal uses of ~python:collections.namedtuple over to using attrs based classes, and removes a couple of internal namedtuple classes that were no longer in use.
It should have no user visible impact.
This release adds support for testing pandas via the hypothesis.extra.pandas module.
This release adds support for testing pandas via the hypothesis.extra.pandas module.
It also adds a dependency on attrs.
This work was funded by Stripe.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
This release fixes some formatting and broken cross-references in the documentation, which includes editing docstrings - and thus a patch release.
This release fixes some formatting and broken cross-references in the documentation, which includes editing docstrings - and thus a patch release.
This release introduces a ~hypothesis.settings.deadline setting to Hypothesis.
This release introduces a ~hypothesis.settings.deadline setting to Hypothesis.
When set this turns slow tests into errors. By default it is unset but will warn if you exceed 200ms, which will become the default value in a future release.
This work was funded by Smarkets.
Hypothesis now emits deprecation warnings if you are using the legacy SQLite example database format, or the tool for merging them. These were already…
Hypothesis now emits deprecation warnings if you are using the legacy SQLite example database format, or the tool for merging them. These were already documented as deprecated, so this doesn't change their deprecation status, only that we warn about it.
This release fixes a bug with generating numpy datetime and timedelta types : When inferring the strategy from the dtype, datetime and timedelta dtype
This release fixes a bug with generating numpy datetime and timedelta types: When inferring the strategy from the dtype, datetime and timedelta dtypes with sub-second precision would always produce examples with one second resolution. Inferring a strategy from a time dtype will now always produce example with the same precision.
This release changes how Hypothesis shrinks and replays examples to take into account that it can encounter new bugs while shrinking the bug it origin
This release changes how Hypothesis shrinks and replays examples to take into account that it can encounter new bugs while shrinking the bug it originally found. Previously it would end up replacing the originally found bug with the new bug and show you only that one. Now it is (often) able to recognise when two bugs are distinct and when it finds more than one will show both.
This release removes the (purely internal and no longer useful) strategy_test_suite function and the corresponding strategytests module.
This release removes the (purely internal and no longer useful) strategy_test_suite function and the corresponding strategytests module.
This release improves the reduction of examples involving floating point numbers to produce more human readable examples.
This release improves the reduction of examples involving floating point numbers to produce more human readable examples.
It also has some general purpose changes to the way the minimizer works internally, which may see some improvement in quality and slow down of test case reduction in cases that have nothing to do with floating point numbers.
Hypothesis now emits deprecation warnings if you use some_strategy.example() inside a test function or strategy definition (this was never intended to…
Hypothesis now emits deprecation warnings if you use some_strategy.example() inside a test function or strategy definition (this was never intended to be supported, but is sufficiently widespread that it warrants a deprecation path).
This is a bugfix release for ~hypothesis.strategies.decimals with the places argument.
This is a bugfix release for ~hypothesis.strategies.decimals with the places argument.
No longer fails health checks (725, due to internal filtering)
Specifying a min_value and max_value without any decimals with places places between them gives a more useful error message.
Works for any valid arguments, regardless of the decimal precision context.
This is a small refactoring release that removes a now-unused parameter to an internal API. It shouldn't have any user visible effect.
This is a small refactoring release that removes a now-unused parameter to an internal API. It shouldn't have any user visible effect.
Hypothesis no longer propagates the dynamic scope of settings into strategy definitions.
Hypothesis no longer propagates the dynamic scope of settings into strategy definitions.
This release is a small change to something that was never part of the public API and you will almost certainly not notice any effect unless you're doing something surprising, but for example the following code will now give a different answer in some circumstances:
import hypothesis.strategies as st
from hypothesis import settings
CURRENT_SETTINGS = st.builds(lambda: settings.default)
(We don't actually encourage you writing code like this)
Previously this would have generated the settings that were in effect at the point of definition of CURRENT_SETTINGS. Now it will generate the settings that are used for the current test.
It is very unlikely to be significant enough to be visible, but you may also notice a small performance improvement.
This release adds a unique argument to ~hypothesis.extra.numpy.arrays which behaves the same ways as the corresponding one for ~hypothesis.strategies.
This release adds a unique argument to ~hypothesis.extra.numpy.arrays which behaves the same ways as the corresponding one for ~hypothesis.strategies.lists, requiring all of the elements in the generated array to be distinct.
This release adds a unique argument to arrays() which behaves the same ways as the corresponding one for lists() , requiring all of the elements in the generated array to be distinct.
This release fixes an issue where Hypothesis would raise a TypeError when using the datetime-related strategies if running with PYTHONOPTIMIZE=2. This
This release fixes an issue where Hypothesis would raise a TypeError when using the datetime-related strategies if running with PYTHONOPTIMIZE=2. This bug was introduced in 3.20.0. (See 822)
Hypothesis now transparently handles problems with an internal unicode cache, including file truncation or read-only filesystems (767). Thanks to Sam
Hypothesis now transparently handles problems with an internal unicode cache, including file truncation or read-only filesystems (767). Thanks to Sam Hames for the patch.
This release provides what should be a substantial performance improvement to numpy arrays generated using provided numpy support , and adds a new fil
This release provides what should be a substantial performance improvement to numpy arrays generated using provided numpy support, and adds a new fill_value argument to ~hypothesis.extra.numpy.arrays to control this behaviour.
This work was funded by Stripe.
This release fixes some extremely specific circumstances that probably have never occurred in the wild where users of ~hypothesis.strategies.deferred
This release fixes some extremely specific circumstances that probably have never occurred in the wild where users of ~hypothesis.strategies.deferred might have seen a python:RuntimeError from too much recursion, usually in cases where no valid example could have been generated anyway.
This release fixes some extremely specific circumstances that probably have never occurred in the wild where users of deferred() might have seen a RuntimeError from too much recursion, usually in cases where no valid example could have been generated anyway.
streaming() would not have emitted a deprecation warning when called with an invalid argument.
This release fixes some minor bugs in argument validation:
hypothesis.extra.numpy dtype strategies would raise an internal error instead of an InvalidArgument exception when passed an invalid endianness specification.
~hypothesis.strategies.fractions would raise an internal error instead of an InvalidArgument if passed float("nan") as one of its bounds.
The error message for passing float("nan") as a bound to various strategies has been improved.
Various bound arguments will now raise InvalidArgument in cases where they would previously have raised an internal TypeError or ValueError from the relevant conversion function.
streaming() would not have emitted a deprecation warning when called with an invalid argument.
This release fixes a bug where test failures that were the result of an @example would print an extra stack trace before re-raising the exception.
This release fixes a bug where test failures that were the result of an @example would print an extra stack trace before re-raising the exception.
This release deprecates Hypothesis's strict mode, which turned Hypothesis's deprecation warnings into errors. Similar functionality can be achieved by…
This release deprecates Hypothesis's strict mode, which turned Hypothesis's deprecation warnings into errors. Similar functionality can be achieved by using simplefilter('error', HypothesisDeprecationWarning).
The old argument names are still supported but will emit a deprecation warning when used explicitly as keyword arguments. Arguments passed positionall…
This release renames the relevant arguments on the ~hypothesis.strategies.datetimes, ~hypothesis.strategies.dates, ~hypothesis.strategies.times, and ~hypothesis.strategies.timedeltas strategies to min_value and max_value, to make them consistent with the other strategies in the module.
The old argument names are still supported but will emit a deprecation warning when used explicitly as keyword arguments. Arguments passed positionally will go to the new argument names and are not deprecated.
This release provides a major overhaul to the internals of how Hypothesis handles shrinking.
This release provides a major overhaul to the internals of how Hypothesis handles shrinking.
This should mostly be visible in terms of getting better examples for tests which make heavy use of ~hypothesis.strategies.composite, ~hypothesis.strategies.data or |.flatmap| where the data drawn depends a lot on previous choices, especially where size parameters are affected. Previously Hypothesis would have struggled to reliably produce good examples here. Now it should do much better. Performance should also be better for examples with a non-zero min_size.
You may see slight changes to example generation (e.g. improved example diversity) as a result of related changes to internals, but they are unlikely to be significant enough to notice.
This release fixes two bugs in hypothesis.extra.numpy:
This release fixes two bugs in hypothesis.extra.numpy:
~hypothesis.extra.numpy.unicode_string_dtypes didn't work at all due to an incorrect dtype specifier. Now it does.
Various impossible conditions would have been accepted but would error when they fail to produced any example. Now they raise an explicit InvalidArgument error.
This is a bugfix release for 739, where bounds for ~hypothesis.strategies.fractions or floating-point ~hypothesis.strategies.decimals were not properl
This is a bugfix release for 739, where bounds for ~hypothesis.strategies.fractions or floating-point ~hypothesis.strategies.decimals were not properly converted to integers before passing them to the integers strategy. This excluded some values that should have been possible, and could trigger internal errors if the bounds lay between adjacent integers.
You can now bound ~hypothesis.strategies.fractions with two arbitrarily close fractions.
It is now an explicit error to supply a min_value, max_value, and max_denominator to ~hypothesis.strategies.fractions where the value bounds do not include a fraction with denominator at most max_denominator.
This release adds the ~hypothesis.strategies.from_regex strategy, which generates strings that contain a match of a regular expression.
This release adds the ~hypothesis.strategies.from_regex strategy, which generates strings that contain a match of a regular expression.
Thanks to Maxim Kulkin for creating the hypothesis-regex package and then helping to upstream it! (662)
This is a bugfix release for ~hypothesis.strategies.integers. Previously the strategy would hit an internal assertion if passed non-integer bounds for
This is a bugfix release for ~hypothesis.strategies.integers. Previously the strategy would hit an internal assertion if passed non-integer bounds for min_value and max_value that had no integers between them. The strategy now raises InvalidArgument instead.
Release to fix a bug where mocks can be used as test runners under certain conditions. Specifically, if a mock is injected into a test via pytest fixt
Release to fix a bug where mocks can be used as test runners under certain conditions. Specifically, if a mock is injected into a test via pytest fixtures or patch decorators, and that mock is the first argument in the list, hypothesis will think it represents self and turns the mock into a test runner. If this happens, the affected test always passes because the mock is executed instead of the test body. Sometimes, it will also fail health checks.
Fixes 491 and a section of 198. Thanks to Ben Peterson for this bug fix.
This release should improve the performance of some tests which experienced a slow down as a result of the 3.13.0 release.
This release should improve the performance of some tests which experienced a slow down as a result of the 3.13.0 release.
Tests most likely to benefit from this are ones that make extensive use of min_size parameters, but others may see some improvement as well.
This release fixes a bug introduced in 3.18.0 . If the arguments include_characters and exclude_characters to ~hypothesis.strategies.characters contai
This release fixes a bug introduced in 3.18.0. If the arguments include_characters and exclude_characters to ~hypothesis.strategies.characters contained overlapping elements, then an InvalidArgument exception would be raised.
Thanks to Zac Hatfield-Dodds for reporting and fixing this.
This is a bug fix release to fix 780, where ~hypothesis.strategies.sets and similar would trigger health check errors if their element strategy could
This is a bug fix release to fix 780, where ~hypothesis.strategies.sets and similar would trigger health check errors if their element strategy could only produce one element (e.g. if it was ~hypothesis.strategies.just).
~hypothesis.strategies.characters now accepts include_characters, particular characters which will be added to those it produces. (668)
This is a feature release:
~hypothesis.strategies.characters now accepts include_characters, particular characters which will be added to those it produces. (668)
A bug fix for the internal function _union_interval_lists(), and a rename to _union_intervals(). It now correctly handles all cases where intervals overlap, and it always returns the result as a tuple for tuples.
Thanks to Alex Willmer for these.
This release documents the previously undocumented phases feature in |Phase|, making it part of the public API. It also updates how the example databa
This release documents the previously undocumented phases feature in |Phase|, making it part of the public API. It also updates how the example database is used. Principally:
The ~hypothesis.Phase.reuse phase will now correctly control whether examples from the database are run (it previously did exactly the wrong thing and controlled whether examples would be saved).
Hypothesis will no longer try to rerun all previously failing examples. Instead it will replay the smallest previously failing example and a selection of other examples that are likely to trigger any other bugs that will found. This prevents a previous failure from dominating your tests unnecessarily.
As a result of the previous change, Hypothesis will be slower about clearing out old examples from the database that are no longer failing (because it can only clear out ones that it actually runs).
This release makes an implementation change to how Hypothesis handles certain internal constructs.
This release makes an implementation change to how Hypothesis handles certain internal constructs.
The main effect you should see is improvement to the behaviour and performance of collection types, especially ones with a min_size parameter. Many cases that would previously fail due to being unable to generate enough valid examples will now succeed, and other cases should run slightly faster.
This release introduces a deprecation of the timeout feature. This results in the following changes:
This release introduces a deprecation of the timeout feature. This results in the following changes:
Creating a settings object with an explicit timeout will emit a deprecation warning.
If your test stops because it hits the timeout (and has not found a bug) then it will emit a deprecation warning.
There is a new value unlimited which you can import from hypothesis. settings(timeout=unlimited) will not cause a deprecation warning.
There is a new health check, hung_test, which will trigger after a test has been running for five minutes if it is not suppressed.
This release deprecates two strategies, choices() and streaming().
This release deprecates two strategies, choices() and streaming().
Both of these are somewhat confusing to use and are entirely redundant since the introduction of the ~hypothesis.strategies.data strategy for interactive drawing in tests, and their use should be replaced with direct use of ~hypothesis.strategies.data instead.
This fixes a bug where Hypothesis would not work correctly on Python 2.7 if you had the python:typing module backport installed.
This fixes a bug where Hypothesis would not work correctly on Python 2.7 if you had the python:typing module backport installed.
This raises the maximum depth at which Hypothesis starts cutting off data generation to a more reasonable value which it is harder to hit by accident.
This raises the maximum depth at which Hypothesis starts cutting off data generation to a more reasonable value which it is harder to hit by accident.
This resolves (751), in which some examples which previously worked would start timing out, but it will also likely improve the data generation quality for complex data types.
Hypothesis now understands inline type annotations (293):
Hypothesis now understands inline type annotations (293):
If the target of ~hypothesis.strategies.builds has type annotations, a default strategy for missing required arguments is selected based on the type. Type-based strategy selection will only override a default if you pass hypothesis.infer as a keyword argument.
If @given wraps a function with type annotations, you can pass ~hypothesis.infer as a keyword argument and the appropriate strategy will be substituted.
You can check what strategy will be inferred for a type with the new ~hypothesis.strategies.from_type function.
~hypothesis.strategies.register_type_strategy teaches Hypothesis which strategy to infer for custom or unknown types. You can provide a strategy, or for more complex cases a function which takes the type and returns a strategy.
This is a bug fix release for 514 - Hypothesis would continue running examples after a ~python:unittest.SkipTest exception was raised, including print
This is a bug fix release for 514 - Hypothesis would continue running examples after a ~python:unittest.SkipTest exception was raised, including printing a falsifying example. Skip exceptions from the standard python:unittest module, and pytest, nose, or unittest2 modules now abort the test immediately without printing output.
This release has two major aspects to it: The first is the introduction of ~hypothesis.strategies.deferred, which allows more natural definition of re
This release has two major aspects to it: The first is the introduction of ~hypothesis.strategies.deferred, which allows more natural definition of recursive (including mutually recursive) strategies.
The second is a number of engine changes designed to support this sort of strategy better. These should have a knock-on effect of also improving the performance of any existing strategies that currently generate a lot of data or involve heavy nesting by reducing their typical example size.
This release makes some major internal changes to how Hypothesis represents data internally, as a prelude to some major engine changes that should imp
This release makes some major internal changes to how Hypothesis represents data internally, as a prelude to some major engine changes that should improve data quality. There are no API changes, but it's a significant enough internal change that a minor version bump seemed warranted.
User facing impact should be fairly mild, but includes:
All existing examples in the database will probably be invalidated. Hypothesis handles this automatically, so you don't need to do anything, but if you see all your examples disappear that's why.
Almost all data distributions have changed significantly. Possibly for the better, possibly for the worse. This may result in new bugs being found, but it may also result in Hypothesis being unable to find bugs it previously did.
Data generation may be somewhat faster if your existing bottleneck was in draw_bytes (which is often the case for large examples).
Shrinking will probably be slower, possibly significantly.
If you notice any effects you consider to be a significant regression, please open an issue about them.
This release involves no functionality changes, but is the first to ship wheels as well as an sdist.
This release involves no functionality changes, but is the first to ship wheels as well as an sdist.
This release provides a performance improvement to shrinking. For cases where there is some non-trivial "boundary" value (e.g. the bug happens for all
This release provides a performance improvement to shrinking. For cases where there is some non-trivial "boundary" value (e.g. the bug happens for all values greater than some other value), shrinking should now be substantially faster. Other types of bug will likely see improvements too.
This may also result in some changes to the quality of the final examples - it may sometimes be better, but is more likely to get slightly worse in some edge cases. If you see any examples where this happens in practice, please report them.
This is a bugfix release: Hypothesis now prints explicit examples when running in verbose mode. (313)
This is a bugfix release: Hypothesis now prints explicit examples when running in verbose mode. (313)
This is a bugfix release: Hypothesis no longer emits a warning if you try to use ~hypothesis.strategies.sampled_from with python:collections.OrderedDi
This is a bugfix release: Hypothesis no longer emits a warning if you try to use ~hypothesis.strategies.sampled_from with python:collections.OrderedDict. (688)
This is a bugfix release: Hypothesis no longer emits a warning if you try to use sampled_from() with collections.OrderedDict . ( issue #688 )
This is a documentation release. Several outdated snippets have been updated or removed, and many cross-references are now hyperlinks.
This is a documentation release. Several outdated snippets have been updated or removed, and many cross-references are now hyperlinks.
This is a minor ergonomics release. Tracebacks shown by pytest no longer include Hypothesis internals for test functions decorated with @given .
This is a minor ergonomics release. Tracebacks shown by pytest no longer include Hypothesis internals for test functions decorated with @given.
The old dates, times, and datetimes strategies in hypothesis.extra.datetimes are deprecated in favor of the new core strategies, which are more flexib…
This is a feature release, adding datetime-related strategies to the core strategies.
~hypothesis.extra.pytz.timezones allows you to sample pytz timezones from the Olsen database. Use directly in a recipe for tz-aware datetimes, or compose with ~hypothesis.strategies.none to allow a mix of aware and naive output.
The new ~hypothesis.strategies.dates, ~hypothesis.strategies.times, ~hypothesis.strategies.datetimes, and ~hypothesis.strategies.timedeltas strategies are all constrained by objects of their type. This means that you can generate dates bounded by a single day (i.e. a single date), or datetimes constrained to the microsecond.
~hypothesis.strategies.times and ~hypothesis.strategies.datetimes take an optional timezones= argument, which defaults to ~hypothesis.strategies.none for naive times. You can use our extra strategy based on pytz, or roll your own timezones strategy with dateutil or even the standard library.
The old dates, times, and datetimes strategies in hypothesis.extra.datetimes are deprecated in favor of the new core strategies, which are more flexible and have no dependencies.
This is a feature release, adding datetime-related strategies to the core strategies.
timezones() allows you to sample pytz timezones from the Olsen database. Use directly in a recipe for tz-aware datetimes, or compose with none() to allow a mix of aware and naive output.
The new dates() , times() , datetimes() , and timedeltas() strategies are all constrained by objects of their type. This means that you can generate dates bounded by a single day (i.e. a single date), or datetimes constrained to the microsecond.
times() and datetimes() take an optional timezones= argument, which defaults to none() for naive times. You can use our extra strategy based on pytz, or roll your own timezones strategy with dateutil or even the standard library.
The old dates , times , and datetimes strategies in hypothesis.extra.datetimes are deprecated in favor of the new core strategies, which are more flexible and have no dependencies.
Hypothesis now uses python:inspect.getfullargspec internally. On Python 2, there are no visible changes.
Hypothesis now uses python:inspect.getfullargspec internally. On Python 2, there are no visible changes.
On Python 3 @given and @composite now preserve 3107 annotations on the decorated function. Keyword-only arguments are now either handled correctly (e.g. @composite), or caught in validation instead of silently discarded or raising an unrelated error later (e.g. @given).
This is a bugfix release: the default field mapping for a DateTimeField in the Django extra now respects the USE_TZ setting when choosing a strategy.
This is a bugfix release: the default field mapping for a DateTimeField in the Django extra now respects the USE_TZ setting when choosing a strategy.
This is feature release, expanding the capabilities of the ~hypothesis.strategies.decimals strategy.
This is feature release, expanding the capabilities of the ~hypothesis.strategies.decimals strategy.
The new (optional) places argument allows you to generate decimals with a certain number of places (e.g. cents, thousandths, satoshis).
If allow_infinity is None, setting min_bound no longer excludes positive infinity and setting max_value no longer excludes negative infinity.
All of NaN, -Nan, sNaN, and -sNaN may now be drawn if allow_nan is True, or if allow_nan is None and min_value or max_value is None.
min_value and max_value may be given as decimal strings, e.g. "1.234".
Hypothesis now imports python:sqlite3 when a SQLite database is used, rather than at module load, improving compatibility with Python implementations
Hypothesis now imports python:sqlite3 when a SQLite database is used, rather than at module load, improving compatibility with Python implementations compiled without SQLite support (such as BSD or Jython).
This is a compatibility bugfix release. ~hypothesis.strategies.sampled_from no longer raises a deprecation warning when sampling from an python:enum.E…
This is a compatibility bugfix release. ~hypothesis.strategies.sampled_from no longer raises a deprecation warning when sampling from an python:enum.Enum, as all enums have a reliable iteration order.
This is a compatibility bugfix release. sampled_from() no longer raises a deprecation warning when sampling from an enum.Enum , as all enums have a reliable iteration order.
This release removes a version check for older versions of pytest when using the Hypothesis pytest plugin. The pytest plugin will now run unconditiona
This release removes a version check for older versions of pytest when using the Hypothesis pytest plugin. The pytest plugin will now run unconditionally on all versions of pytest. This breaks compatibility with any version of pytest prior to 2.7.0 (which is more than two years old).
The primary reason for this change is that the version check was a frequent source of breakage when pytest change their versioning scheme. If you are not working on pytest itself and are not running a very old version of it, this release probably doesn't affect you.
This is a code reorganisation release that moves some internal test helpers out of the main source tree so as to not have changes to them trigger rele
This is a code reorganisation release that moves some internal test helpers out of the main source tree so as to not have changes to them trigger releases in future.
This is a documentation release. Almost all code examples are now doctests checked in CI, eliminating stale examples.
This is a documentation release. Almost all code examples are now doctests checked in CI, eliminating stale examples.
This is a feature release, adding the ~hypothesis.strategies.iterables strategy, equivalent to lists(...).map(iter) but with a much more useful repr.
This is a feature release, adding the ~hypothesis.strategies.iterables strategy, equivalent to lists(...).map(iter) but with a much more useful repr. You can use this strategy to check that code doesn't accidentally depend on sequence properties such as indexing support or repeated iteration.
This patch fixes a bug in 3.7.3 , where using @example and a pytest fixture in the same test could cause the test to fail to fill the arguments, and t
This patch fixes a bug in 3.7.3, where using @example and a pytest fixture in the same test could cause the test to fail to fill the arguments, and throw a TypeError.
This release should include no user visible changes and is purely a refactoring release. This modularises the behaviour of the core ~hypothesis.given
This release should include no user visible changes and is purely a refactoring release. This modularises the behaviour of the core ~hypothesis.given function, breaking it up into smaller and more accessible parts, but its actual behaviour should remain unchanged.
One column per quarter.