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 release adds hypothesis.currently_in_test_context, which can be used to check whether the calling code is currently running inside an @given or s
This release adds hypothesis.currently_in_test_context, which can be used to check whether the calling code is currently running inside an @given or stateful test.
This is most useful for third-party integrations and assertion helpers which may wish to use ~hypothesis.assume or ~hypothesis.target, without also requiring that the helper only be used from property-based tests (2581).
This release upgrades the import logic for ghostwritten tests , handling many cases where imports would previously be missing or from unexpected locat
This release upgrades the import logic for ghostwritten tests, handling many cases where imports would previously be missing or from unexpected locations.
One column per quarter.
This release upgrades ~hypothesis.strategies.from_type, to infer strategies for type-annotated arguments even if they have defaults when it otherwise
This release upgrades ~hypothesis.strategies.from_type, to infer strategies for type-annotated arguments even if they have defaults when it otherwise falls back to ~hypothesis.strategies.builds (2708).
This release upgrades from_type() , to infer strategies for type-annotated arguments even if they have defaults when it otherwise falls back to builds() ( issue #2708 ).
This release adds the codemods extra, which you can use to check for and automatically fix issues such as use of deprecated Hypothesis APIs (2705).
This release adds the codemods extra, which you can use to check for and automatically fix issues such as use of deprecated Hypothesis APIs (2705).
This release adds the hypothesis[codemods] extra, which you can use to check for and automatically fix issues such as use of deprecated Hypothesis APIs ( issue #2705 ).
This patch fixes ~hypothesis.strategies.from_type with the typing-extensions Literal backport on Python 3.6.
This patch fixes ~hypothesis.strategies.from_type with the typing-extensions Literal backport on Python 3.6.
This patch fixes from_type() with the typing-extensions Literal backport on Python 3.6.
This patch fixes 2722, where certain orderings of ~hypothesis.strategies.register_type_strategy, ~python:typing.ForwardRef, and ~hypothesis.strategies
This patch fixes 2722, where certain orderings of ~hypothesis.strategies.register_type_strategy, ~python:typing.ForwardRef, and ~hypothesis.strategies.from_type could trigger an internal error.
This patch fixes issue #2722 , where certain orderings of register_type_strategy() , ForwardRef , and from_type() could trigger an internal error.
This patch makes some strategies for collections with a uniqueness constraint much more efficient, including dictionaries(keys=sampled_from(...), valu
This patch makes some strategies for collections with a uniqueness constraint much more efficient, including dictionaries(keys=sampled_from(...), values=..) and lists(tuples(sampled_from(...), ...), unique_by=lambda x: x[0]). (related to 2036)
This patch extends our faster special case for ~hypothesis.strategies.sampled_from elements in unique ~hypothesis.strategies.lists to account for chai
This patch extends our faster special case for ~hypothesis.strategies.sampled_from elements in unique ~hypothesis.strategies.lists to account for chains of .map(...) and .filter(...) calls (2036).
This patch extends our faster special case for sampled_from() elements in unique lists() to account for chains of .map(...) and .filter(...) calls ( issue #2036 ).
This patch improves the type annotations on ~hypothesis.assume and @reproduce_failure() .
This patch improves the type annotations on ~hypothesis.assume and @reproduce_failure().
This patch improves the type annotations on assume() and @reproduce_failure() .
This patch updates our copyright headers to include 2021. Happy new year!
This patch updates our copyright headers to include 2021. Happy new year!
This change fixes a documentation error in the ~hypothesis.settings.database setting.
This change fixes a documentation error in the ~hypothesis.settings.database setting.
The previous documentation suggested that callers could specify a database path string, or the special string ":memory:", but this setting has never actually allowed string arguments.
Permitted values are None, and instances of ~hypothesis.database.ExampleDatabase.
This patch fixes 2696, an internal error triggered when the @example decorator was used and the ~hypothesis.settings.verbosity setting was quiet.
This patch fixes 2696, an internal error triggered when the @example decorator was used and the ~hypothesis.settings.verbosity setting was quiet.
This patch fixes issue #2696 , an internal error triggered when the @example decorator was used and the verbosity setting was quiet .
This patch improves the error message from the ~hypothesis.extra.pandas.data_frames strategy when both the rows and columns arguments are given, but t
This patch improves the error message from the ~hypothesis.extra.pandas.data_frames strategy when both the rows and columns arguments are given, but there is a missing entry in rows and the corresponding column has no fill value (2678).
This patch improves the error message if ~hypothesis.strategies.builds is passed an ~python:enum.Enum which cannot be called without arguments, to sug
This patch improves the error message if ~hypothesis.strategies.builds is passed an ~python:enum.Enum which cannot be called without arguments, to suggest using ~hypothesis.strategies.sampled_from (2693).
This patch improves the error message if builds() is passed an Enum which cannot be called without arguments, to suggest using sampled_from() ( issue #2693 ).
This release adds new ~hypothesis.strategies.timezones and ~hypothesis.strategies.timezone_keys strategies (2630) based on the new python:zoneinfo mod
This release adds new ~hypothesis.strategies.timezones and ~hypothesis.strategies.timezone_keys strategies (2630) based on the new python:zoneinfo module in Python 3.9.
pip install hypothesis[zoneinfo] will ensure that you have the appropriate backports installed if you need them.
This release adds new timezones() and timezone_keys() strategies ( issue #2630 ) based on the new zoneinfo module in Python 3.9.
pip install hypothesis[zoneinfo] will ensure that you have the appropriate backports installed if you need them.
This patch fixes an internal error in ~hypothesis.strategies.datetimes with allow_imaginary=False where the timezones argument can generate tzinfo=Non
This patch fixes an internal error in ~hypothesis.strategies.datetimes with allow_imaginary=False where the timezones argument can generate tzinfo=None (2662).
This patch fixes an internal error in datetimes() with allow_imaginary=False where the timezones argument can generate tzinfo=None ( issue #2662 ).
This patch teaches hypothesis.extra.django.from_field to infer more efficient strategies by inspecting (not just filtering by) field validators for nu
This patch teaches hypothesis.extra.django.from_field to infer more efficient strategies by inspecting (not just filtering by) field validators for numeric and string fields (1116).
This patch refactors hypothesis.settings to use type-annotated keyword arguments instead of kwargs, which makes tab-completion much more useful - as w
This patch refactors hypothesis.settings to use type-annotated keyword arguments instead of **kwargs, which makes tab-completion much more useful - as well as type-checkers like mypy.
This patch teaches the ~hypothesis.extra.ghostwriter.magic ghostwriter to recognise "en/de" function roundtrips other than the common encode/decode pa
This patch teaches the ~hypothesis.extra.ghostwriter.magic ghostwriter to recognise "en/de" function roundtrips other than the common encode/decode pattern, such as encrypt/decrypt or, encipher/decipher.
This patch adds a performance optimisation to avoid saving redundant seeds when using the .fuzz_one_input hook .
This patch adds a performance optimisation to avoid saving redundant seeds when using the .fuzz_one_input hook.
This patch fixes 2657, where passing unicode patterns compiled with python:re.IGNORECASE to ~hypothesis.strategies.from_regex could trigger an interna
This patch fixes 2657, where passing unicode patterns compiled with python:re.IGNORECASE to ~hypothesis.strategies.from_regex could trigger an internal error when casefolding a character creates a longer string (e.g. "\u0130".lower() -> "i\u0370").
This patch fixes issue #2657 , where passing unicode patterns compiled with re.IGNORECASE to from_regex() could trigger an internal error when casefolding a character creates a longer string (e.g. "\u0130".lower() -> "i\u0370" ).
This patch adds a final fallback clause to our plugin logic to fail with a warning rather than error on Python < 3.8 when neither the importlib-metada
This patch adds a final fallback clause to our plugin logic to fail with a warning rather than error on Python < 3.8 when neither the importlib-metadata (preferred) or setuptools (fallback) packages are available.
This patch fixes ~hypothesis.provisional.urls strategy ensuring that ~ (tilde) is treated as one of the url-safe characters (2658).
This patch fixes ~hypothesis.provisional.urls strategy ensuring that ~ (tilde) is treated as one of the url-safe characters (2658).
This patch fixes urls() strategy ensuring that ~ (tilde) is treated as one of the url-safe characters ( issue #2658 ).
This patch improves our CLI help and documentation .
This patch improves our CLI help and documentation.
Hypothesis now shrinks examples where the error is raised while drawing from a strategy. This makes complicated custom strategies *much* easier to deb
Hypothesis now shrinks examples where the error is raised while drawing from a strategy. This makes complicated custom strategies much easier to debug, at the cost of a slowdown for use-cases where you catch and ignore such errors.
This release teaches ~hypothesis.strategies.from_type how to handle ~python:typing.ChainMap, ~python:typing.Counter, ~python:typing.Deque, ~python:typ
This release teaches ~hypothesis.strategies.from_type how to handle ~python:typing.ChainMap, ~python:typing.Counter, ~python:typing.Deque, ~python:typing.Generator, ~python:typing.Match, ~python:typing.OrderedDict, ~python:typing.Pattern, and ~python:collections.abc.Set (2654).
This release teaches from_type() how to handle ChainMap , Counter , Deque , Generator , Match , OrderedDict , Pattern , and Set ( issue #2654 ).
~hypothesis.strategies.from_type now knows how to resolve 585 parameterized standard collection types, which are new in Python 3.9 (2629).
~hypothesis.strategies.from_type now knows how to resolve 585 parameterized standard collection types, which are new in Python 3.9 (2629).
from_type() now knows how to resolve PEP 585 parameterized standard collection types, which are new in Python 3.9 ( issue #2629 ).
This patch fixes ~hypothesis.strategies.builds, so that when passed ~hypothesis.infer for an argument with a non-~python:typing.Optional type annotati
This patch fixes ~hypothesis.strategies.builds, so that when passed ~hypothesis.infer for an argument with a non-~python:typing.Optional type annotation and a default value of None to build a class which defines an explicit __signature__ attribute, either None or that type may be generated.
This is unlikely to happen unless you are using pydantic (2648).
This patch fixes builds() , so that when passed infer for an argument with a non- Optional type annotation and a default value of None to build a class which defines an explicit signature attribute, either None or that type may be generated.
This is unlikely to happen unless you are using pydantic ( issue #2648 ).
This release improves our support for @st.composite on a python:classmethod or python:staticmethod (2578).
This release improves our support for @st.composite on a python:classmethod or python:staticmethod (2578).
This release improves our support for @st.composite on a classmethod or staticmethod ( issue #2578 ).
This patch fixes ~hypothesis.strategies.from_type with Iterable[T] (2645).
This patch fixes ~hypothesis.strategies.from_type with Iterable[T] (2645).
This patch teaches the ~hypothesis.extra.ghostwriter.magic ghostwriter to recognise that pairs of functions like ~python:colorsys.rgb_to_hsv and ~pyth
This patch teaches the ~hypothesis.extra.ghostwriter.magic ghostwriter to recognise that pairs of functions like ~python:colorsys.rgb_to_hsv and ~python:colorsys.hsv_to_rgb should ~hypothesis.extra.ghostwriter.roundtrip.
This patch teaches the magic() ghostwriter to recognise that pairs of functions like rgb_to_hsv() and hsv_to_rgb() should roundtrip() .
This patch improves ~hypothesis.strategies.builds and ~hypothesis.strategies.from_type support for explicitly defined __signature__ attributes, from v
This patch improves ~hypothesis.strategies.builds and ~hypothesis.strategies.from_type support for explicitly defined __signature__ attributes, from version 5.8.3, to support generic types from the python:typing module.
Thanks to Rónán Carrigan for identifying and fixing this problem!
This patch improves builds() and from_type() support for explicitly defined signature attributes, from version 5.8.3 , to support generic types from the typing module.
Thanks to Rónán Carrigan for identifying and fixing this problem!
This patch fixes ~hypothesis.extra.lark.from_lark with version 0.10.1+ of the lark-parser package.
This patch fixes ~hypothesis.extra.lark.from_lark with version 0.10.1+ of the lark-parser package.
This patch fixes from_lark() with version 0.10.1+ of the lark-parser package.
This patch fixes some broken links in the ~hypothesis.extra.lark extra documentation.
This patch fixes some broken links in the ~hypothesis.extra.lark extra documentation.
This release adds a new ~hypothesis.extra.redis.RedisExampleDatabase, along with the ~hypothesis.database.ReadOnlyDatabase and ~hypothesis.database.Mu
This release adds a new ~hypothesis.extra.redis.RedisExampleDatabase, along with the ~hypothesis.database.ReadOnlyDatabase and ~hypothesis.database.MultiplexedDatabase helpers, to support team workflows where failing examples can be seamlessly shared between everyone on the team - and your CI servers or buildbots.
This release adds a new RedisExampleDatabase , along with the ReadOnlyDatabase and MultiplexedDatabase helpers, to support team workflows where failing examples can be seamlessly shared between everyone on the team - and your CI servers or buildbots.
This patch ensures that if the "hypothesis" entry point is callable, we call it after importing it. You can still use non-callable entry points (like
This patch ensures that if the "hypothesis" entry point is callable, we call it after importing it. You can still use non-callable entry points (like modules), which are only imported.
We also prefer importlib.metadata or the backport over pkg_resources, which makes import hypothesis around 200 milliseconds faster (2571).
This patch adds some helpful suggestions to error messages you might see while learning to use the @example() decorator (2611) or the ~hypothesis.stra
This patch adds some helpful suggestions to error messages you might see while learning to use the @example() decorator (2611) or the ~hypothesis.strategies.one_of strategy.
This release upgrades the ~hypothesis.extra.numpy.from_dtype strategy to pass optional kwargs to the inferred strategy, and upgrades the ~hypothesis.e
This release upgrades the ~hypothesis.extra.numpy.from_dtype strategy to pass optional **kwargs to the inferred strategy, and upgrades the ~hypothesis.extra.numpy.arrays strategy to accept an elements=kwargs dict to pass through to ~hypothesis.extra.numpy.from_dtype.
arrays(floating_dtypes(), shape, elements={"min_value": -10, "max_value": 10}) is a particularly useful pattern, as it allows for any floating dtype without triggering the roundoff warning for smaller types or sacrificing variety for larger types (2552).
This patch reformats our code with the latest black to take advantage of the support for magic trailing commas.
This patch reformats our code with the latest black to take advantage of the support for magic trailing commas.
This release significantly improves the performance of Hypothesis's internal implementation of automaton learning. However this code does not run as p
This release significantly improves the performance of Hypothesis's internal implementation of automaton learning. However this code does not run as part of the user-accessible API so this has no user-visible impact.
This patch ensures that, when the generate ~hypothesis.settings.phases is disabled, we can replay up to ~hypothesis.settings.max_examples examples fro
This patch ensures that, when the generate ~hypothesis.settings.phases is disabled, we can replay up to ~hypothesis.settings.max_examples examples from the database - which is very useful when using Hypothesis with a fuzzer.
Thanks to Afrida Tabassum for fixing 2585!
This patch ensures that, when the generate phases is disabled, we can replay up to max_examples examples from the database - which is very useful when using Hypothesis with a fuzzer .
Thanks to Afrida Tabassum for fixing issue #2585 !
This patch changes some internal python:struct.Struct.format strings from bytes to str, to avoid python:BytesWarning when running python -bb __.
This patch changes some internal python:struct.Struct.format strings from bytes to str, to avoid python:BytesWarning when running python -bb.
Thanks to everyone involved in pytest-xdist issue 596, 16349, 21071, and 41777 for their work on this - it was a remarkably subtle issue!
This patch changes some internal struct.Struct.format strings from bytes to str , to avoid BytesWarning when running python -bb .
Thanks to everyone involved in pytest-xdist issue 596 , bpo-16349 , bpo-21071 , and bpo-41777 for their work on this - it was a remarkably subtle issue!
The ~hypothesis.target function now accepts integers as well as floats.
The ~hypothesis.target function now accepts integers as well as floats.
This patch adds explicit ~python:typing.Optional annotations to our public API, to better support users who run mypy with --strict or no_implicit_opti
This patch adds explicit ~python:typing.Optional annotations to our public API, to better support users who run mypy with --strict or no_implicit_optional=True.
Thanks to Krzysztof Przybyła for bringing this to our attention and writing the patch!
This release drops support for Python 3.5, which reached end of life upstream __ on 2020-09-13.
This release drops support for Python 3.5, which reached end of life upstream on 2020-09-13.
This patch fixes a problem with ~hypothesis.strategies.builds that was not able to generate valid data for annotated classes with constructors.
This patch fixes a problem with ~hypothesis.strategies.builds that was not able to generate valid data for annotated classes with constructors.
Thanks to Nikita Sobolev for fixing 2603!
This patch improves the error message from the hypothesis write command if black (required for the ghostwriter ) is not installed.
This patch improves the error message from the hypothesis write command if black (required for the ghostwriter) is not installed.
Thanks to Nikita Sobolev for fixing 2604!
When reporting failing examples, or tried examples in verbose mode, Hypothesis now identifies which were from @example(...) explicit examples.
When reporting failing examples, or tried examples in verbose mode, Hypothesis now identifies which were from @example(...) explicit examples.
This patch contains some internal refactoring. Thanks to Felix Sheldon for fixing 2516!
This patch contains some internal refactoring. Thanks to Felix Sheldon for fixing 2516!
An array drawn from ~hypothesis.extra.numpy.arrays will own its own memory; previously most arrays returned by this strategy were views.
An array drawn from ~hypothesis.extra.numpy.arrays will own its own memory; previously most arrays returned by this strategy were views.
An array drawn from arrays() will own its own memory; previously most arrays returned by this strategy were views.
~hypothesis.strategies.builds will use the __signature__ attribute of the target, if it exists, to retrieve type hints. Previously python:typing.get_t
~hypothesis.strategies.builds will use the __signature__ attribute of the target, if it exists, to retrieve type hints. Previously python:typing.get_type_hints, was used by default. If argument names varied between the __annotations__ and __signature__, they would not be supplied to the target.
This was particularly an issue for pydantic models which use an alias generator.
This patch makes the ghostwriter much more robust when passed unusual modules.
This patch makes the ghostwriter much more robust when passed unusual modules.
improved support for non-resolvable type annotations
~hypothesis.extra.ghostwriter.magic can now write ~hypothesis.extra.ghostwriter.equivalent tests
running ~hypothesis.extra.ghostwriter.magic on modules where some names in __all__ are undefined skips such names, instead of raising an error
~hypothesis.extra.ghostwriter.magic now knows to skip mocks
improved handling of import-time errors found by the ghostwriter CLI
This patch makes the ghostwriter much more robust when passed unusual modules.
improved support for non-resolvable type annotations
magic() can now write equivalent() tests
running magic() on modules where some names in all are undefined skips such names, instead of raising an error
magic() now knows to skip mocks
improved handling of import-time errors found by the ghostwriter CLI
~hypothesis.strategies.register_type_strategy now supports python:typing.TypeVar, which was previously hard-coded, and allows a variety of types to be
~hypothesis.strategies.register_type_strategy now supports python:typing.TypeVar, which was previously hard-coded, and allows a variety of types to be generated for an unconstrained ~python:typing.TypeVar instead of just ~hypothesis.strategies.text.
Thanks again to Nikita Sobolev for all your work on advanced types!
register_type_strategy() now supports typing.TypeVar , which was previously hard-coded, and allows a variety of types to be generated for an unconstrained TypeVar instead of just text() .
Thanks again to Nikita Sobolev for all your work on advanced types!
This release fixes some hard to trigger bugs in Hypothesis's automata learning code. This code is only run as part of the Hypothesis build process, an
This release fixes some hard to trigger bugs in Hypothesis's automata learning code. This code is only run as part of the Hypothesis build process, and not for user code, so this release has no user visible impact.
This patch adds type annotations to the hypothesis.database module. There is no runtime change, but your typechecker might notice.
This patch adds type annotations to the hypothesis.database module. There is no runtime change, but your typechecker might notice.
This patch tracks some additional information in Hypothesis internals, and has no user-visible impact.
This patch tracks some additional information in Hypothesis internals, and has no user-visible impact.
This release fixes a bug in some Hypothesis internal support code for learning automata. This mostly doesn't have any user visible impact, although it
This release fixes a bug in some Hypothesis internal support code for learning automata. This mostly doesn't have any user visible impact, although it slightly affects the learned shrink passes so shrinking may be subtly different.
This release adds support for entry-points, which allows for smoother integration of third-party Hypothesis extensions and external libraries. Unless
This release adds support for entry-points, which allows for smoother integration of third-party Hypothesis extensions and external libraries. Unless you're publishing a library with Hypothesis integration, you'll probably only ever use this indirectly!
This release adds support for Hypothesis integration via entry points , which allows for smoother integration of third-party Hypothesis extensions and external libraries. Unless you’re publishing a library with Hypothesis integration, you’ll probably only ever use this indirectly!
~hypothesis.strategies.from_type can now resolve ~python:typing.TypeVar instances when the bound is a ~python:typing.ForwardRef, so long as that name
~hypothesis.strategies.from_type can now resolve ~python:typing.TypeVar instances when the bound is a ~python:typing.ForwardRef, so long as that name is in fact defined in the same module as the typevar (no TYPE_CHECKING tricks, sorry). This feature requires Python 3.7 or later.
Thanks to Zac Hatfield-Dodds and Nikita Sobolev for this feature!
This patch adds two new ghostwriters to test binary operations , like python:operator.add, and Numpy ufuncs and gufuncs like np.matmul() .
This patch adds two new ghostwriters to test binary operations, like python:operator.add, and Numpy ufuncs and gufuncs like np.matmul().
This patch adds two new ghostwriters to test binary operations , like operator.add() , and Numpy ufuncs and gufuncs like np.matmul() .
Your coding agent can read these notes before it upgrades. Set up the MCP server →