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 today
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 None being inferred as the float64 dtype in ~xps.from_dtype() and ~xps.arrays() from the Array API extra .
This release fixes None being inferred as the float64 dtype in ~xps.from_dtype() and ~xps.arrays() from the Array API extra.
This release fixes None being inferred as the float64 dtype in from_dtype() and arrays() from the Array API extra .
This release fixes the type hint for the @given() decorator when decorating an async function (3099).
This release fixes the type hint for the @given() decorator when decorating an async function (3099).
Your coding agent can read these notes before it upgrades. Set up the MCP server →
This release improves Ghostwritten tests for builtins (2977).
This release improves Ghostwritten tests for builtins (2977).
This release deprecates use of both min_dims > len(shape) and max_dims > len(shape) when allow_newaxis == False in ~hypothesis.extra.numpy.basic_indic…
This release deprecates use of both min_dims > len(shape) and max_dims > len(shape) when allow_newaxis == False in ~hypothesis.extra.numpy.basic_indices (3091).
This release improves the behaviour of ~hypothesis.strategies.builds and ~hypothesis.strategies.from_type in certain situations involving decorators (
This release improves the behaviour of ~hypothesis.strategies.builds and ~hypothesis.strategies.from_type in certain situations involving decorators (2495 and 3029).
This release improves the behaviour of builds() and from_type() in certain situations involving decorators ( issue #2495 and issue #3029 ).
This release introduces strategies for array/tensor libraries adopting the Array API standard __ (3037). They are available in the hypothesis.extra.ar
This release introduces strategies for array/tensor libraries adopting the Array API standard (3037). They are available in the hypothesis.extra.array_api extra, and work much like the existing strategies for NumPy.
This patch fixes 961, where calling given() inline on a bound method would fail to handle the self argument correctly.
This patch fixes 961, where calling given() inline on a bound method would fail to handle the self argument correctly.
This release allows ~hypothesis.strategies.slices to generate step=None, and fixes an off-by-one error where the start index could be equal to size. T
This release allows ~hypothesis.strategies.slices to generate step=None, and fixes an off-by-one error where the start index could be equal to size. This works fine for all Python sequences and Numpy arrays, but is undefined behaviour in the Array API standard (see 3065).
Using a ~hypothesis.stateful.consumes bundle as a target is deprecated, and will be an error in a future version.
This release makes stateful testing more likely to tell you if you do something unexpected and unsupported:
The ~hypothesis.HealthCheck.return_value health check now applies to ~hypothesis.stateful.rule and ~hypothesis.stateful.initialize rules, if they don't have target bundles, as well as ~hypothesis.stateful.invariant.
Using a ~hypothesis.stateful.consumes bundle as a target is deprecated, and will be an error in a future version.
If existing code triggers these new checks, check for related bugs and misunderstandings - these patterns never had any effect.
This release makes stateful testing more likely to tell you if you do something unexpected and unsupported:
The return_value health check now applies to rule() and initialize() rules, if they don’t have target bundles, as well as invariant() .
Using a consumes() bundle as a target is deprecated, and will be an error in a future version.
If existing code triggers these new checks, check for related bugs and misunderstandings - these patterns never had any effect.
This release teaches ~hypothesis.strategies.from_type a neat trick: when resolving an python:typing.Annotated type, if one of the annotations is a str
This release teaches ~hypothesis.strategies.from_type a neat trick: when resolving an python:typing.Annotated type, if one of the annotations is a strategy object we use that as the inferred strategy. For example:
PositiveInt = Annotated[int, st.integers(min_value=1)]
If there are multiple strategies, we use the last outer-most annotation. See 2978 and 3082 for discussion.
Requires Python 3.9 or later for get_type_hints(..., include_extras=False).
This patch makes unique ~hypothesis.extra.numpy.arrays much more efficient, especially when there are only a few valid elements - such as for eight-bi
This patch makes unique ~hypothesis.extra.numpy.arrays much more efficient, especially when there are only a few valid elements - such as for eight-bit integers (3066).
This patch fixes the repr of ~hypothesis.extra.numpy.array_shapes.
This patch fixes the repr of ~hypothesis.extra.numpy.array_shapes.
This patch wraps some internal helper code in our proxies decorator to prevent mutations of method docstrings carrying over to other instances of the
This patch wraps some internal helper code in our proxies decorator to prevent mutations of method docstrings carrying over to other instances of the respective methods.
This patch moves some internal helper code in preparation for 3065. There is no user-visible change, unless you depended on undocumented internals.
This patch moves some internal helper code in preparation for 3065. There is no user-visible change, unless you depended on undocumented internals.
This release adds type annotations to the stateful testing API.
This release adds type annotations to the stateful testing API.
Thanks to Ruben Opdebeeck for this contribution!
This release adds the ~hypothesis.strategies.DrawFn type as a reusable type hint for the draw argument of @composite functions.
This release adds the ~hypothesis.strategies.DrawFn type as a reusable type hint for the draw argument of @composite functions.
Thanks to Ruben Opdebeeck for this contribution!
This release emits a more useful error message when @given() is applied to a coroutine function, i.e. one defined using async def (3054).
This release emits a more useful error message when @given() is applied to a coroutine function, i.e. one defined using async def (3054).
This was previously only handled by the generic ~hypothesis.HealthCheck.return_value health check, which doesn't direct you to use either a custom executor or a library such as pytest-trio or pytest-asyncio to handle it for you.
This patch fixes a regression in Hypothesis 6.14.8, where ~hypothesis.strategies.from_type failed to resolve types which inherit from multiple paramet
This patch fixes a regression in Hypothesis 6.14.8, where ~hypothesis.strategies.from_type failed to resolve types which inherit from multiple parametrised generic types, affecting the returns package (3060).
This patch ensures that registering a strategy for a subclass of a parametrised generic type such as class Lines(Sequence[str]): will not "leak" into
This patch ensures that registering a strategy for a subclass of a parametrised generic type such as class Lines(Sequence[str]): will not "leak" into unrelated strategies such as st.from_type(Sequence[int]) (2951). Unfortunately this fix requires 560, meaning Python 3.7 or later.
This patch fixes 3050, where attrs classes could cause an internal error in the ghostwriter .
This patch fixes 3050, where attrs classes could cause an internal error in the ghostwriter.
This patch improves the error message for 3016, where 585 builtin generics with self-referential forward-reference strings cannot be resolved to a str
This patch improves the error message for 3016, where 585 builtin generics with self-referential forward-reference strings cannot be resolved to a strategy by ~hypothesis.strategies.from_type.
This patch improves the error message for issue #3016 , where PEP 585 builtin generics with self-referential forward-reference strings cannot be resolved to a strategy by from_type() .
This patch fixes hypothesis.strategies._internal.types.is_a_new_type. It was failing on Python 3.10.0b4, where NewType is a function.
This patch fixes hypothesis.strategies._internal.types.is_a_new_type. It was failing on Python 3.10.0b4, where NewType is a function.
This patch fixes ~hypothesis.strategies.from_type and ~hypothesis.strategies.register_type_strategy for python:typing.NewType on Python 3.10, which ch
This patch fixes ~hypothesis.strategies.from_type and ~hypothesis.strategies.register_type_strategy for python:typing.NewType on Python 3.10, which changed the underlying implementation (see 44353 for details).
This patch fixes from_type() and register_type_strategy() for typing.NewType on Python 3.10, which changed the underlying implementation (see bpo-44353 for details).
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 ensures that we shorten tracebacks for tests which fail due to inconsistent data generation between runs (i.e. raise Flaky).
This patch ensures that we shorten tracebacks for tests which fail due to inconsistent data generation between runs (i.e. raise Flaky).
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.
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.
One column per quarter.