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 7 days ago
28 Sep 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
1571 releases · first in 2013
This patch updates some internal type annotations. There is no user-visible change.
This patch updates some internal type annotations. There is no user-visible change.
The |Phase.explain| phase now requires shrinking to be enabled, and will be automatically skipped for deadline-exceeded errors.
The |Phase.explain| phase now requires shrinking to be enabled, and will be automatically skipped for deadline-exceeded errors.
One column per quarter.
This patch improves the ~hypothesis.strategies.tuples strategy type annotations, to preserve the element types for up to length-five tuples (3005).
This patch improves the ~hypothesis.strategies.tuples strategy type annotations, to preserve the element types for up to length-five tuples (3005).
As for ~hypothesis.strategies.one_of, this is the best we can do before a planned extension to 646 is released, hopefully in Python 3.11.
This patch improves the tuples() strategy type annotations, to preserve the element types for up to length-five tuples ( issue #3005 ).
As for one_of() , this is the best we can do before a planned extension to PEP 646 is released, hopefully in Python 3.11.
This patch teaches the Ghostwriter how to find custom ufuncs from *any* module that defines them, and that yaml.unsafe_load() does not undo yaml.safe_
This patch teaches the Ghostwriter how to find custom ufuncs from any module that defines them, and that yaml.unsafe_load() does not undo yaml.safe_load().
This patch reduces the amount of internal code excluded from our test suite's code coverage checks.
This patch reduces the amount of internal code excluded from our test suite's code coverage checks.
There is no user-visible change.
This patch removes some old internal helper code that previously existed to make Python 2 compatibility easier.
This patch removes some old internal helper code that previously existed to make Python 2 compatibility easier.
There is no user-visible change.
This release adjusts some internal code to help make our test suite more reliable.
This release adjusts some internal code to help make our test suite more reliable.
There is no user-visible change.
This patch cleans up some internal code related to filtering strategies.
This patch cleans up some internal code related to filtering strategies.
There is no user-visible change.
This patch slightly improves the performance of some internal code for generating integers.
This patch slightly improves the performance of some internal code for generating integers.
This patch fixes a bug in ~hypothesis.strategies.from_regex that caused from_regex("", fullmatch=True) to unintentionally generate non-empty strings (
This patch fixes a bug in ~hypothesis.strategies.from_regex that caused from_regex("", fullmatch=True) to unintentionally generate non-empty strings (4982).
The only strings that completely match an empty regex pattern are empty strings.
This patch fixes a bug that caused ~hypothesis.strategies.integers to shrink towards negative values instead of positive values in some cases.
This patch fixes a bug that caused ~hypothesis.strategies.integers to shrink towards negative values instead of positive values in some cases.
This patch fixes a bug that caused integers() to shrink towards negative values instead of positive values in some cases.
This patch fixes rare cases where hypothesis write --binary-op could print reproducing instructions from the internal search for an identity element.
This patch fixes rare cases where hypothesis write --binary-op could print reproducing instructions from the internal search for an identity element.
This patch removes some unnecessary intermediate list-comprehensions, using the latest versions of pyupgrade and shed.
This patch removes some unnecessary intermediate list-comprehensions, using the latest versions of pyupgrade and shed.
This patch adds a .hypothesis property to invalid test functions, bringing them inline with valid tests and fixing a bug where pytest-asyncio would sw
This patch adds a .hypothesis property to invalid test functions, bringing them inline with valid tests and fixing a bug where pytest-asyncio would swallow the real error message and mistakenly raise a version incompatibility error.
Some of Hypothesis's numpy/pandas strategies use a fill argument to speed up generating large arrays, by generating a single fill value and sharing th
Some of Hypothesis's numpy/pandas strategies use a fill argument to speed up generating large arrays, by generating a single fill value and sharing that value among many array slots instead of filling every single slot individually.
When no fill argument is provided, Hypothesis tries to detect whether it is OK to automatically use the elements argument as a fill strategy, so that it can still use the faster approach.
This patch fixes a bug that would cause that optimization to trigger in some cases where it isn't 100% guaranteed to be OK.
If this makes some of your numpy/pandas tests run more slowly, try adding an explicit fill argument to the relevant strategies to ensure that Hypothesis always uses the faster approach.
This patch strengthens some internal import-time consistency checks for the built-in strategies.
This patch strengthens some internal import-time consistency checks for the built-in strategies.
There is no user-visible change.
This release adds URL fragment generation to the ~hypothesis.provisional.urls strategy (2908). Thanks to Pax (R. Margret) for contributing this patch
This release adds URL fragment generation to the ~hypothesis.provisional.urls strategy (2908). Thanks to Pax (R. Margret) for contributing this patch at the PyCon US Mentored Sprints!
This patch fixes 2964, where .map() and .filter() methods were omitted from the repr() of ~hypothesis.strategies.just and ~hypothesis.strategies.sampl
This patch fixes 2964, where .map() and .filter() methods were omitted from the repr() of ~hypothesis.strategies.just and ~hypothesis.strategies.sampled_from strategies, since version 5.43.7.
This patch fixes issue #2964 , where .map() and .filter() methods were omitted from the repr() of just() and sampled_from() strategies, since version 5.43.7 .
This release automatically rewrites some simple filters, such as integers().filter(lambda x: x > 9) to the more efficient integers(min_value=10), base
This release automatically rewrites some simple filters, such as integers().filter(lambda x: x > 9) to the more efficient integers(min_value=10), based on the AST of the predicate.
We continue to recommend using the efficient form directly wherever possible, but this should be useful for e.g. pandera "Checks" where you already have a simple predicate and translating manually is really annoying. See 2701 for ideas about floats and simple text strategies.
hypothesis.target now returns the observation value, allowing it to be conveniently used inline in expressions such as assert target(abs(a - b)) < 0.1
hypothesis.target now returns the observation value, allowing it to be conveniently used inline in expressions such as assert target(abs(a - b)) < 0.1.
This patch fixes a deprecation warning if you're using recent versions of importlib-metadata (2934), which we use to load third-party plugins such as…
This patch fixes a deprecation warning if you're using recent versions of importlib-metadata (2934), which we use to load third-party plugins such as Pydantic's integration. On older versions of importlib-metadata, there is no change and you don't need to upgrade.
This release teaches the Ghostwriter to read parameter types from Sphinx, Google, or Numpy-style structured docstrings, and improves some related heur
This release teaches the Ghostwriter to read parameter types from Sphinx, Google, or Numpy-style structured docstrings, and improves some related heuristics about how to test scientific and numerical programs.
This release improves the Ghostwriter's handling of exceptions, by reading :raises ...: entries in function docstrings and ensuring that we don't supp
This release improves the Ghostwriter's handling of exceptions, by reading :raises ...: entries in function docstrings and ensuring that we don't suppresss the error raised by test assertions.
This patch updates our autoformatting tools, improving our code style without any API changes.
This patch updates our autoformatting tools, improving our code style without any API changes.
This release teaches ~hypothesis.strategies.from_type how to see through python:typing.Annotated. Thanks to Vytautas Strimaitis for reporting and fixi
This release teaches ~hypothesis.strategies.from_type how to see through python:typing.Annotated. Thanks to Vytautas Strimaitis for reporting and fixing 2919!
This release teaches from_type() how to see through typing.Annotated . Thanks to Vytautas Strimaitis for reporting and fixing issue #2919 !
If rich is installed, the hypothesis write command will use it to syntax-highlight the Ghostwritten code.
If rich is installed, the hypothesis write command will use it to syntax-highlight the Ghostwritten code.
This patch improves an error message from ~hypothesis.strategies.builds when ~hypothesis.strategies.from_type would be more suitable (2930).
This patch improves an error message from ~hypothesis.strategies.builds when ~hypothesis.strategies.from_type would be more suitable (2930).
This patch improves an error message from builds() when from_type() would be more suitable ( issue #2930 ).
This patch updates the type annotations for ~hypothesis.extra.numpy.arrays to reflect that shape: SearchStrategy[int] is supported.
This patch updates the type annotations for ~hypothesis.extra.numpy.arrays to reflect that shape: SearchStrategy[int] is supported.
This patch updates the type annotations for arrays() to reflect that shape: SearchStrategy[int] is supported.
This patch fixes ~hypothesis.strategies.from_type with abstract types which have either required but non-type-annotated arguments to __init__, or wher
This patch fixes ~hypothesis.strategies.from_type with abstract types which have either required but non-type-annotated arguments to __init__, or where ~hypothesis.strategies.from_type can handle some concrete subclasses but not others.
This patch fixes from_type() with abstract types which have either required but non-type-annotated arguments to init , or where from_type() can handle some concrete subclasses but not others.
This patch teaches hypothesis write to check for possible roundtrips in several more cases, such as by looking for an inverse in the module which defi
This patch teaches hypothesis write to check for possible roundtrips in several more cases, such as by looking for an inverse in the module which defines the function to test.
This patch adds a more helpful error message if you try to call ~hypothesis.strategies.sampled_from on an ~python:enum.Enum which has no members, but
This patch adds a more helpful error message if you try to call ~hypothesis.strategies.sampled_from on an ~python:enum.Enum which has no members, but does have ~python:dataclasses.dataclass-style annotations (2923).
This patch adds a more helpful error message if you try to call sampled_from() on an Enum which has no members, but does have dataclass() -style annotations ( issue #2923 ).
The ~hypothesis.strategies.fixed_dictionaries strategy now preserves dict iteration order instead of sorting the keys. This also affects the pretty-pr
The ~hypothesis.strategies.fixed_dictionaries strategy now preserves dict iteration order instead of sorting the keys. This also affects the pretty-printing of keyword arguments to @given() (2913).
This patch teaches hypothesis write to default to ghostwriting tests with --style=pytest only if pytest is installed, or --style=unittest otherwise.
This patch teaches hypothesis write to default to ghostwriting tests with --style=pytest only if pytest is installed, or --style=unittest otherwise.
This patch adds type annotations for the ~hypothesis.settings decorator, to avoid an error when running mypy in strict mode.
This patch adds type annotations for the ~hypothesis.settings decorator, to avoid an error when running mypy in strict mode.
This patch adds type annotations for the settings decorator, to avoid an error when running mypy in strict mode.
This patch improves the Ghostwriter's handling of strategies to generate various fiddly types including frozensets, keysviews, valuesviews, regex matc
This patch improves the Ghostwriter's handling of strategies to generate various fiddly types including frozensets, keysviews, valuesviews, regex matches and patterns, and so on.
This patch fixes some internal typos. There is no user-visible change.
This patch fixes some internal typos. There is no user-visible change.
This patch lays more groundwork for filter rewriting (2701). There is no user-visible change... yet.
This patch lays more groundwork for filter rewriting (2701). There is no user-visible change... yet.
This release registers the remaining builtin types, and teaches ~hypothesis.strategies.from_type to try resolving ~python:typing.ForwardRef and ~pytho
This release registers the remaining builtin types, and teaches ~hypothesis.strategies.from_type to try resolving ~python:typing.ForwardRef and ~python:typing.Type references to built-in types.
This release registers the remaining builtin types, and teaches from_type() to try resolving ForwardRef and Type references to built-in types.
This release teaches ~hypothesis.stateful.RuleBasedStateMachine to avoid checking ~hypothesis.stateful.invariant\ s until all ~hypothesis.stateful.ini
This release teaches ~hypothesis.stateful.RuleBasedStateMachine to avoid checking ~hypothesis.stateful.invariants until all ~hypothesis.stateful.initialize rules have been run. You can enable checking of specific invariants for incompletely initialized machines by using @invariant(check_during_init=True) (2868).
In previous versions, it was possible if awkward to implement this behaviour using ~hypothesis.stateful.precondition and an auxiliary variable.
This release teaches RuleBasedStateMachine to avoid checking invariant() s until all initialize() rules have been run. You can enable checking of specific invariants for incompletely initialized machines by using @invariant(check_during_init=True) ( issue #2868 ).
In previous versions, it was possible if awkward to implement this behaviour using precondition() and an auxiliary variable.
This patch improves the error message when ~hypothesis.strategies.from_type fails to resolve a forward-reference inside a python:typing.Type such as T
This patch improves the error message when ~hypothesis.strategies.from_type fails to resolve a forward-reference inside a python:typing.Type such as Type["int"] (2565).
This patch improves the error message when from_type() fails to resolve a forward-reference inside a typing.Type such as Type["int"] ( issue #2565 ).
This release makes it an explicit error to apply ~hypothesis.stateful.invariant to a ~hypothesis.stateful.rule or ~hypothesis.stateful.initialize rule
This release makes it an explicit error to apply ~hypothesis.stateful.invariant to a ~hypothesis.stateful.rule or ~hypothesis.stateful.initialize rule in stateful testing. Such a combination had unclear semantics, especially in combination with ~hypothesis.stateful.precondition, and was never meant to be allowed (2681).
This release makes it an explicit error to apply invariant() to a rule() or initialize() rule in stateful testing . Such a combination had unclear semantics, especially in combination with precondition() , and was never meant to be allowed ( issue #2681 ).
This release adds |Phase.explain|, in which Hypothesis attempts to explain *why* your test failed by pointing to suspicious lines of code (i.e. those
This release adds |Phase.explain|, in which Hypothesis attempts to explain why your test failed by pointing to suspicious lines of code (i.e. those which were always, and only, run on failing inputs). We plan to include "generalising" failing examples in this phase in a future release (2192).
This patch fixes 2794, where nesting ~hypothesis.strategies.deferred strategies within ~hypothesis.strategies.recursive strategies could trigger an in
This patch fixes 2794, where nesting ~hypothesis.strategies.deferred strategies within ~hypothesis.strategies.recursive strategies could trigger an internal assertion. While it was always possible to get the same results from a more sensible strategy, the convoluted form now works too.
This patch fixes issue #2794 , where nesting deferred() strategies within recursive() strategies could trigger an internal assertion. While it was always possible to get the same results from a more sensible strategy, the convoluted form now works too.
This patch fixes several problems with mypy when --no-implicit-reexport _ was activated in user projects.
This patch fixes several problems with mypy when --no-implicit-reexport was activated in user projects.
Thanks to Nikita Sobolev for fixing 2884!
This patch fixes an exception that occurs when using type unions of the typing-extensions Literal backport on Python 3.6.
This patch fixes an exception that occurs when using type unions of the typing-extensions Literal backport on Python 3.6.
Thanks to Ben Anhalt for identifying and fixing this bug.
This release fixes stateful testing methods with multiple ~hypothesis.stateful.precondition decorators. Previously, only the outer-most precondition w
This release fixes stateful testing methods with multiple ~hypothesis.stateful.precondition decorators. Previously, only the outer-most precondition was checked (2681).
This release fixes stateful testing methods with multiple precondition() decorators. Previously, only the outer-most precondition was checked ( issue #2681 ).
This patch refactors some internals of ~hypothesis.stateful.RuleBasedStateMachine. There is no change to the public API or behaviour.
This patch refactors some internals of ~hypothesis.stateful.RuleBasedStateMachine. There is no change to the public API or behaviour.
This patch refactors some internals of RuleBasedStateMachine . There is no change to the public API or behaviour.
This patch moves some internal code, so that future work can avoid creating import cycles. There is no user-visible change.
This patch moves some internal code, so that future work can avoid creating import cycles. There is no user-visible change.
This patch enables ~hypothesis.strategies.register_type_strategy for subclasses of python:typing.TypedDict. Previously, ~hypothesis.strategies.from_ty
This patch enables ~hypothesis.strategies.register_type_strategy for subclasses of python:typing.TypedDict. Previously, ~hypothesis.strategies.from_type would ignore the registered strategy (2872).
Thanks to Ilya Lebedev for identifying and fixing this bug!
This patch enables register_type_strategy() for subclasses of typing.TypedDict . Previously, from_type() would ignore the registered strategy ( issue #2872 ).
Thanks to Ilya Lebedev for identifying and fixing this bug!
This release lays the groundwork for automatic rewriting of simple filters, for example converting integers().filter(lambda x: x > 9) to integers(min_
This release lays the groundwork for automatic rewriting of simple filters, for example converting integers().filter(lambda x: x > 9) to integers(min_value=10).
Note that this is not supported yet, and we will continue to recommend writing the efficient form directly wherever possible - predicate rewriting is provided mainly for the benefit of downstream libraries which would otherwise have to implement it for themselves (e.g. pandera and icontract-hypothesis). See 2701 for details.
The Hypothesis pytest plugin now requires pytest version 4.6 or later. If the plugin detects an earlier version of pytest, it will automatically deact
The Hypothesis pytest plugin now requires pytest version 4.6 or later. If the plugin detects an earlier version of pytest, it will automatically deactivate itself.
(4.6.x is the earliest pytest branch that still accepts community bugfixes.)
Hypothesis-based tests should continue to work in earlier versions of pytest, but enhanced integrations provided by the plugin (such as --hypothesis-show-statistics and other command-line flags) will no longer be available in obsolete pytest versions.
If you use pytest-html, Hypothesis now includes the summary statistics for each test in the HTML report, whether or not the --hypothesis-show-statisti
If you use pytest-html, Hypothesis now includes the summary statistics for each test in the HTML report, whether or not the --hypothesis-show-statistics argument was passed to show them in the command-line output.
This patch updates our automatic code formatting to use shed, which includes autoflake, black, isort, and pyupgrade (2780).
This patch updates our automatic code formatting to use shed, which includes autoflake, black, isort, and pyupgrade (2780).
This release teaches Hypothesis to distinguish between errors based on the __cause__ or __context__ of otherwise identical exceptions __, which is par
This release teaches Hypothesis to distinguish between errors based on the __cause__ or __context__ of otherwise identical exceptions, which is particularly useful when internal errors can be wrapped by a library-specific or semantically appropriate exception such as:
try:
do_the_thing(foo, timeout=10)
except Exception as err:
raise FooError("Failed to do the thing") from err
Earlier versions of Hypothesis only see the FooError, while we can now distinguish a FooError raised because of e.g. an internal assertion from one raised because of a TimeoutExceeded exception.
This release prevents a race condition inside ~hypothesis.strategies.recursive strategies. The race condition occurs when the same ~hypothesis.strateg
This release prevents a race condition inside ~hypothesis.strategies.recursive strategies. The race condition occurs when the same ~hypothesis.strategies.recursive strategy is shared among tests that are running in multiple threads (2717).
This release prevents a race condition inside recursive() strategies. The race condition occurs when the same recursive() strategy is shared among tests that are running in multiple threads ( issue #2717 ).
This patch improves the type annotations for ~hypothesis.strategies.one_of, by adding overloads to handle up to five distinct arguments as ~python:typ
This patch improves the type annotations for ~hypothesis.strategies.one_of, by adding overloads to handle up to five distinct arguments as ~python:typing.Union before falling back to ~python:typing.Any, as well as annotating the | (__or__) operator for strategies (2765).
This patch improves the type annotations for one_of() , by adding overloads to handle up to five distinct arguments as Union before falling back to Any , as well as annotating the | ( or ) operator for strategies ( issue #2765 ).
This release makes some small improvements to how filtered strategies work. It should improve the performance of shrinking filtered strategies, and ma
This release makes some small improvements to how filtered strategies work. It should improve the performance of shrinking filtered strategies, and may under some (probably rare) circumstances improve the diversity of generated examples.
This patch fixes an interaction where our test statistics handling made Pytest's --junit-xml output fail to validate against the strict xunit2 schema
This patch fixes an interaction where our test statistics handling made Pytest's --junit-xml output fail to validate against the strict xunit2 schema (1975).
There are no new features here, as we release those in minor versions. Instead, 6.0 is a chance for us to remove deprecated features (many already con…
Welcome to the next major version of Hypothesis!
There are no new features here, as we release those in minor versions. Instead, 6.0 is a chance for us to remove deprecated features (many already converted into no-ops), and turn a variety of warnings into errors.
If you were running on the last version of Hypothesis 5.x without any Hypothesis deprecation warnings, this will be a very boring upgrade. In fact, nothing will change for you at all.
Many functions now use 3102 keyword-only arguments where passing positional arguments was deprecated since 5.5.
hypothesis.extra.django.from_model no longer accepts model as a keyword argument, where it could conflict with fields named "model".
~hypothesis.strategies.randoms now defaults to use_true_random=False.
~hypothesis.strategies.complex_numbers no longer accepts min_magnitude=None; either use min_magnitude=0 or just omit the argument.
hypothesis.provisional.ip4_addr_strings and ip6_addr_strings are removed in favor of ip_addresses(v=...).map(str).
~hypothesis.strategies.register_type_strategy no longer accepts generic types with type arguments, which were always pretty badly broken.
Using function-scoped pytest fixtures is now a health-check error, instead of a warning.
Tip
The hypothesis codemod command can automatically refactor your code, particularly to convert positional to keyword arguments where those are now required.
This release adds the ~hypothesis.HealthCheck.function_scoped_fixture health check value, which can be used to suppress the existing warning that appe
This release adds the ~hypothesis.HealthCheck.function_scoped_fixture health check value, which can be used to suppress the existing warning that appears when @given is applied to a test that uses pytest function-scoped fixtures.
(This warning exists because function-scoped fixtures only run once per function, not once per example, which is usually unexpected and can cause subtle problems.)
When this warning becomes a health check error in a future release, suppressing it via Python warning settings will no longer be possible. In the rare case that once-per-function behaviour is intended, it will still be possible to use ~hypothesis.HealthCheck.function_scoped_fixture to opt out of the health check error for specific tests.
Your coding agent can read these notes before it upgrades. Set up the MCP server →