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.15
Last release 13 days ago
06 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
1594 releases · first in 2013
Drag across the ruler to compare, or tap a release to open it.
This patch refactors some internals, continuing our work on supporting alternative backends (3086). There is no user-visible change.
This patch refactors some internals, continuing our work on supporting alternative backends (3086). There is no user-visible change.
The ~hypothesis.extra.lark.from_lark strategy now accepts an alphabet= argument, which is passed through to ~hypothesis.strategies.from_regex, so that
The ~hypothesis.extra.lark.from_lark strategy now accepts an alphabet= argument, which is passed through to ~hypothesis.strategies.from_regex, so that you can e.g. constrain the generated strings to a particular codec.
In support of this feature, ~hypothesis.strategies.from_regex will avoid generating optional parts which do not fit the alphabet. For example, from_regex(r"abc|def", alphabet="abcd") was previously an error, and will now generate only 'abc'. Cases where there are no valid strings remain an error.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
This patch refactors some internals, continuing our work on supporting alternative backends (3086). There is no user-visible change.
This patch refactors some internals, continuing our work on supporting alternative backends (3086). There is no user-visible change.
This patch adds a test statistics event when a generated example is rejected via assume .
This patch adds a test statistics event when a generated example is rejected via assume.
This may also help with distinguishing gave_up examples in observability (3827).
This introduces the rewriting of length filters on some collection strategies (3791).
This introduces the rewriting of length filters on some collection strategies (3791).
Thanks to Reagan Lee for implementing this feature!
If a test uses ~hypothesis.strategies.sampled_from on a sequence of strategies, and raises a TypeError, we now add a note <678> asking whether you mea
If a test uses ~hypothesis.strategies.sampled_from on a sequence of strategies, and raises a TypeError, we now add a note asking whether you meant to use ~hypothesis.strategies.one_of.
Thanks to Vince Reuter for suggesting and implementing this hint!
If a test uses sampled_from() on a sequence of strategies, and raises a TypeError , we now add a note asking whether you meant to use one_of() .
Thanks to Vince Reuter for suggesting and implementing this hint!
This patch registers explicit strategies for a handful of builtin types, motivated by improved introspection in PyPy 7.3.14 triggering existing intern
This patch registers explicit strategies for a handful of builtin types, motivated by improved introspection in PyPy 7.3.14 triggering existing internal warnings. Thanks to Carl Friedrich Bolz-Tereick for helping us work out what changed!
This patch fixes an error when writing observability reports without a pre-existing .hypothesis directory.
This patch fixes an error when writing observability reports without a pre-existing .hypothesis directory.
This patch adds a new environment variable HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY_NOCOVER, which turns on observability data collection without collect
This patch adds a new environment variable HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY_NOCOVER, which turns on observability data collection without collecting code coverage data, which may be faster on Python 3.11 and earlier.
Thanks to Harrison Goldstein for reporting and fixing 3821.
This patch updates our vendored list of top-level domains __, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch updates our vendored list of top-level domains, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch fixes a bug introduced in version 6.92.0 , where using the ~hypothesis.strategies.data strategy would fail to draw a ~python:dataclasses.da
This patch fixes a bug introduced in version 6.92.0, where using the ~hypothesis.strategies.data strategy would fail to draw a ~python:dataclasses.dataclass with a ~python:collections.defaultdict field. This was due to a bug in the standard library which was fixed in 3.12, so we've vendored the fix.
This patch fixes a bug introduced in version 6.92.0 , where using the data() strategy would fail to draw a dataclass() with a defaultdict field. This was due to a bug in the standard library which was fixed in 3.12 , so we’ve vendored the fix.
This release adds an experimental observability mode. You can read the docs about it here .
This release adds an experimental observability mode. You can read the docs about it here.
This patch refactors some more internals, continuing our work on supporting alternative backends (3086). There is no user-visible change.
This patch refactors some more internals, continuing our work on supporting alternative backends (3086). There is no user-visible change.
This patch fixes an issue where ~hypothesis.strategies.builds could not be used with attrs objects that defined private attributes (i.e. attributes wi
This patch fixes an issue where ~hypothesis.strategies.builds could not be used with attrs objects that defined private attributes (i.e. attributes with a leading underscore). See also 3791.
This patch also adds support more generally for using ~hypothesis.strategies.builds with attrs' alias parameter, which was previously unsupported.
This patch increases the minimum required version of attrs to 22.2.0.
This release adds an optional payload argument to hypothesis.event, so that you can clearly express the difference between the label and the value of
This release adds an optional payload argument to hypothesis.event, so that you can clearly express the difference between the label and the value of an observation. statistics will still summarize it as a string, but future observability options can preserve the distinction.
This patch supports assigning settings = settings(...) as a class attribute on a subclass of a .TestCase attribute of a ~hypothesis.stateful.RuleBased
This patch supports assigning settings = settings(...) as a class attribute on a subclass of a .TestCase attribute of a ~hypothesis.stateful.RuleBasedStateMachine. Previously, this did nothing at all.
# works as of this release
class TestMyStatefulMachine(MyStatefulMachine.TestCase):
settings = settings(max_examples=10000)
# the old way still works, but it's more verbose.
MyStateMachine.TestCase.settings = settings(max_examples=10000)
class TestMyStatefulMachine(MyStatefulMachine.TestCase):
pass
Thanks to Joey Tran for reporting these settings-related edge cases in stateful testing.
This release makes it an error to assign settings = settings(...) as a class attribute on a ~hypothesis.stateful.RuleBasedStateMachine. This has never
This release makes it an error to assign settings = settings(...) as a class attribute on a ~hypothesis.stateful.RuleBasedStateMachine. This has never had any effect, and it should be used as a decorator instead:
class BadMachine(RuleBasedStateMachine):
"""This doesn't do anything, and is now an error!"""
settings = settings(derandomize=True)
@settings(derandomize=True)
class GoodMachine(RuleBasedStateMachine):
"""This is the right way to do it :-)"""
This patch refactors some internals. There is no user-visible change, but we hope to improve performance and unlock support for alternative backends s
This patch refactors some internals. There is no user-visible change, but we hope to improve performance and unlock support for alternative backends such as symbolic execution with crosshair in future (3086).
Thanks to Liam DeVoe for this fantastic contribution!
This release teaches ~hypothesis.strategies.from_type to handle constraints implied by the annotated-types package - as used by e.g. pydantic. This is
This release teaches ~hypothesis.strategies.from_type to handle constraints implied by the annotated-types package - as used by e.g. pydantic. This is usually efficient, but falls back to filtering in a few remaining cases.
Thanks to Viicos for 3780!
This patch adds a warning when @st.composite wraps a function annotated as returning a ~hypothesis.strategies.SearchStrategy, since this is usually an
This patch adds a warning when @st.composite wraps a function annotated as returning a ~hypothesis.strategies.SearchStrategy, since this is usually an error (3786). The function should return a value, and the decorator will convert it to a function which returns a strategy.
This patch refactors from_type(typing.Tuple), allowing ~hypothesis.strategies.register_type_strategy to take effect for tuples instead of being silent
This patch refactors from_type(typing.Tuple), allowing ~hypothesis.strategies.register_type_strategy to take effect for tuples instead of being silently ignored (3750).
Thanks to Nick Collins for reporting and extensive work on this issue.
This patch improves the speed of the explain phase on python 3.12+, by using the new sys.monitoring module to collect coverage, instead of sys.settrac
This patch improves the speed of the explain phase on python 3.12+, by using the new sys.monitoring module to collect coverage, instead of sys.settrace.
Thanks to Liam DeVoe for 3776!
This patch improves ~hypothesis.strategies.register_type_strategy when used with tuple subclasses, by preventing them from being interpreted as generi
This patch improves ~hypothesis.strategies.register_type_strategy when used with tuple subclasses, by preventing them from being interpreted as generic and provided to strategies like st.from_type(Sequence[int]) (3767).
This release allows strategy-generating functions registered with ~hypothesis.strategies.register_type_strategy to conditionally not return a strategy
This release allows strategy-generating functions registered with ~hypothesis.strategies.register_type_strategy to conditionally not return a strategy, by returning NotImplemented (3767).
This release allows strategy-generating functions registered with register_type_strategy() to conditionally not return a strategy, by returning NotImplemented ( issue #3767 ).
When ~hypothesis.strategies.randoms was called with use_true_randoms=False, calling r.sample([], 0) would result in an error, when it should have retu
When ~hypothesis.strategies.randoms was called with use_true_randoms=False, calling r.sample([], 0) would result in an error, when it should have returned an empty sequence to agree with the normal behaviour of random.sample. This fixes that discrepancy (3765).
This patch ensures that the hypothesis codemod CLI will print a warning instead of stopping with an internal error if one of your files contains inval
This patch ensures that the hypothesis codemod CLI will print a warning instead of stopping with an internal error if one of your files contains invalid syntax (3759).
This patch makes some small changes to our NumPy integration to ensure forward compatibility. Thanks to Mateusz Sokół for 3761.
This patch makes some small changes to our NumPy integration to ensure forward compatibility. Thanks to Mateusz Sokół for 3761.
Fixes 3755, where an internal condition turns out to be reachable after all.
Fixes 3755, where an internal condition turns out to be reachable after all.
This release deprecates use of ~hypothesis.assume and reject() outside of property-based tests, because these functions work by raising a special exce…
This release deprecates use of ~hypothesis.assume and reject() outside of property-based tests, because these functions work by raising a special exception (3743). It also fixes some type annotations (3753).
Hotfix for 3747, a bug in explain mode which is so rare that we missed it in six months of dogfooding. Thanks to mygrad for discovering and promptly r
Hotfix for 3747, a bug in explain mode which is so rare that we missed it in six months of dogfooding. Thanks to mygrad for discovering and promptly reporting this!
This patch improves the documentation of @example(...).xfail() by adding a note about 614, similar to @example(...).via() , and adds a warning when a
This patch improves the documentation of @example(...).xfail() by adding a note about 614, similar to @example(...).via(), and adds a warning when a strategy generates a test case which seems identical to one provided by an xfailed example.
This release enables the |Phase.explain| phase by default. We hope it helps you to understand *why* your failing tests have failed!
This release enables the |Phase.explain| phase by default. We hope it helps you to understand why your failing tests have failed!
This patch switches some of our type annotations to use typing.Literal when only a few specific values are allowed, such as UUID or IP address version
This patch switches some of our type annotations to use typing.Literal when only a few specific values are allowed, such as UUID or IP address versions.
This release deprecates the old whitelist/blacklist arguments to ~hypothesis.strategies.characters, in favor of include/exclude arguments which more c…
This release deprecates the old whitelist/blacklist arguments to ~hypothesis.strategies.characters, in favor of include/exclude arguments which more clearly describe their effects on the set of characters which can be generated.
You can use Hypothesis' codemods to automatically upgrade to the new argument names. In a future version, the old names will start to raise a DeprecationWarning.
This patch automatically disables the ~hypothesis.HealthCheck.differing_executors health check for methods which are also pytest parametrized tests, b
This patch automatically disables the ~hypothesis.HealthCheck.differing_executors health check for methods which are also pytest parametrized tests, because those were mostly false alarms (3733).
Building on recent releases, ~hypothesis.strategies.characters now accepts _any_ codec=, not just "utf-8" and "ascii".
Building on recent releases, ~hypothesis.strategies.characters now accepts _any_ codec=, not just "utf-8" and "ascii".
This includes standard codecs from the codecs module and their aliases, platform specific and user-registered codecs if they are available, and python-specific text encodings (but not text transforms or binary transforms).
This patch by Reagan Lee makes st.text(...).filter(str.isidentifier) return an efficient custom strategy (3480).
This patch by Reagan Lee makes st.text(...).filter(str.isidentifier) return an efficient custom strategy (3480).
The ~hypothesis.strategies.from_regex strategy now takes an optional alphabet=characters(codec="utf-8") argument for unicode strings, like ~hypothesis
The ~hypothesis.strategies.from_regex strategy now takes an optional alphabet=characters(codec="utf-8") argument for unicode strings, like ~hypothesis.strategies.text.
This offers more and more-consistent control over the generated strings, removing previously-hard-coded limitations. With fullmatch=False and alphabet=characters(), surrogate characters are now possible in leading and trailing text as well as the body of the match. Negated character classes such as [^A-Z] or \S had a hard-coded exclusion of control characters and surrogate characters; now they permit anything in alphabet= consistent with the class, and control characters are permitted by default.
Add a health check that detects if the same test is executed several times by different executors . This can lead to difficult-to-debug problems such
Add a health check that detects if the same test is executed several times by different executors. This can lead to difficult-to-debug problems such as 3446.
Pretty-printing of failing examples can now use functions registered with IPython.lib.pretty.for_type or ~IPython.lib.pretty.for_type_by_name, as well
Pretty-printing of failing examples can now use functions registered with IPython.lib.pretty.for_type or ~IPython.lib.pretty.for_type_by_name, as well as restoring compatibility with _repr_pretty_ callback methods which were accidentally broken in version 6.61.2 (3721).
Adds a new codec= option in ~hypothesis.strategies.characters, making it convenient to produce only characters which can be encoded as ascii or utf-8
Adds a new codec= option in ~hypothesis.strategies.characters, making it convenient to produce only characters which can be encoded as ascii or utf-8 bytestrings.
Support for other codecs will be added in a future release.
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 patch enables and fixes many more of ruff\ 's lint rules.
This patch enables and fixes many more of ruff's lint rules.
Fixes the error message for missing [cli] extra.
Fixes the error message for missing [cli] extra.
This patch ensures that we always close the download connection in ~hypothesis.database.GitHubArtifactDatabase.
This patch ensures that we always close the download connection in ~hypothesis.database.GitHubArtifactDatabase.
We can now pretty-print combinations of *zero* enum.Flag values, like SomeFlag(0), which has never worked before.
We can now pretty-print combinations of zero enum.Flag values, like SomeFlag(0), which has never worked before.
This patch fixes pretty-printing of combinations of enum.Flag values, which was previously an error (3709).
This patch fixes pretty-printing of combinations of enum.Flag values, which was previously an error (3709).
Improve shrinking of floats in narrow regions that don't cross an integer boundary. Closes 3357.
Improve shrinking of floats in narrow regions that don't cross an integer boundary. Closes 3357.
~hypothesis.strategies.from_regex now supports the atomic grouping ((?>...)) and possessive quantifier (*+, ++, ?+, {m,n}+) syntax added in Python 3.1
~hypothesis.strategies.from_regex now supports the atomic grouping ((?>...)) and possessive quantifier (*+, ++, ?+, {m,n}+) syntax added in Python 3.11.
Thanks to Cheuk Ting Ho for implementing this!
If the HYPOTHESIS_NO_PLUGINS environment variable is set, we'll avoid loading plugins such as the old Pydantic integration __ or HypoFuzz' CLI options
If the HYPOTHESIS_NO_PLUGINS environment variable is set, we'll avoid loading plugins such as the old Pydantic integration or HypoFuzz' CLI options.
This is probably only useful for our own self-tests, but documented in case it might help narrow down any particularly weird bugs in complex environments.
Fixes some lingering issues with inference of recursive types in ~hypothesis.strategies.from_type. Closes 3525.
Fixes some lingering issues with inference of recursive types in ~hypothesis.strategies.from_type. Closes 3525.
Fixes some lingering issues with inference of recursive types in from_type() . Closes issue #3525 .
This release further improves our .patch-file support from version 6.75 , skipping duplicates, tests which use ~hypothesis.strategies.data (and don't
This release further improves our .patch-file support from version 6.75, skipping duplicates, tests which use ~hypothesis.strategies.data (and don't support @example()), and various broken edge-cases.
Because libCST has released version 1.0 which uses the native parser by default, we no longer set the LIBCST_PARSER_TYPE=native environment variable. If you are using an older version, you may need to upgrade or set this envvar for yourself.
This patch updates some internal code for selftests. There is no user-visible change.
This patch updates some internal code for selftests. There is no user-visible change.
This release drops support for Python 3.7, which reached end of life on 2023-06-27 __.
This release drops support for Python 3.7, which reached end of life on 2023-06-27.
Fixes occasional recursion-limit-exceeded errors when validating deeply nested strategies. Closes: 3671
Fixes occasional recursion-limit-exceeded errors when validating deeply nested strategies. Closes: 3671
This patch updates our vendored list of top-level domains __, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch updates our vendored list of top-level domains, which is used by the provisional ~hypothesis.provisional.domains strategy.
Improve the type rendered in ~hypothesis.strategies.from_type, which improves the coverage of Ghostwriter.
Improve the type rendered in ~hypothesis.strategies.from_type, which improves the coverage of Ghostwriter.
Improve the type rendered in from_type() , which improves the coverage of Ghostwriter.
We now test against Python 3.12 beta in CI, and this patch fixes some new deprecations.
We now test against Python 3.12 beta in CI, and this patch fixes some new deprecations.
This release changes ~hypothesis.strategies.register_type_strategy for compatibility with 585: we now store only a single strategy or resolver functio
This release changes ~hypothesis.strategies.register_type_strategy for compatibility with 585: we now store only a single strategy or resolver function which is used for both the builtin and the typing module version of each type (3635).
If you previously relied on registering separate strategies for e.g. list vs typing.List, you may need to use explicit strategies rather than inferring them from types.
This release ensures that Ghostwriter does not use the deprecated aliases for the collections.abc classes in collections.
This release ensures that Ghostwriter does not use the deprecated aliases for the collections.abc classes in collections.
One column per quarter.