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 fixes 2395, where under some circumstances targeted property-based testing could cause Hypothesis to get caught in an infinite loop.
This release fixes 2395, where under some circumstances targeted property-based testing could cause Hypothesis to get caught in an infinite loop.
This patch teaches ~hypothesis.strategies.builds and ~hypothesis.strategies.from_type to use the __signature__ attribute of classes where it has been
This patch teaches ~hypothesis.strategies.builds and ~hypothesis.strategies.from_type to use the __signature__ attribute of classes where it has been set, improving our support for pydantic models (in pydantic >= 1.5).
One column per quarter.
This patch teaches builds() and from_type() to use the signature attribute of classes where it has been set, improving our support for pydantic models ( in pydantic >= 1.5 ).
This release improves the performance of the part of the core engine that deliberately generates duplicate values.
This release improves the performance of the part of the core engine that deliberately generates duplicate values.
This patch improves ~hypothesis.strategies.dates shrinking, to simplify year, month, and day like ~hypothesis.strategies.datetimes rather than minimiz
This patch improves ~hypothesis.strategies.dates shrinking, to simplify year, month, and day like ~hypothesis.strategies.datetimes rather than minimizing the number of days since 2000-01-01.
This patch improves dates() shrinking, to simplify year, month, and day like datetimes() rather than minimizing the number of days since 2000-01-01.
This release adds a .hypothesis.fuzz_one_input attribute to @given tests, for easy integration with external fuzzers such as python-afl __ (supporting
This release adds a .hypothesis.fuzz_one_input attribute to @given tests, for easy integration with external fuzzers such as python-afl (supporting 171).
This patch fixes 2341, ensuring that the printed output from a stateful test cannot use variable names before they are defined.
This patch fixes 2341, ensuring that the printed output from a stateful test cannot use variable names before they are defined.
This patch fixes 2375, preventing incorrect failure when a function scoped fixture is overridden with a higher scoped fixture.
This patch fixes 2375, preventing incorrect failure when a function scoped fixture is overridden with a higher scoped fixture.
This release allows the ~hypothesis.extra.numpy.array_dtypes strategy to generate Numpy dtypes which have field titles in addition to field names __.
This release allows the ~hypothesis.extra.numpy.array_dtypes strategy to generate Numpy dtypes which have field titles in addition to field names. We expect this to expose latent bugs where code expects that set(dtype.names) == set(dtype.fields), though the latter may include titles.
This makes model a positional-only argument to ~hypothesis.extra.django.from_model, to support models with a field literally named "model" (2369).
This makes model a positional-only argument to ~hypothesis.extra.django.from_model, to support models with a field literally named "model" (2369).
This makes model a positional-only argument to from_model() , to support models with a field literally named “model” ( issue #2369 ).
This release adds an explicit warning for tests that are both decorated with @given(...) and request a function-scoped pytest fixture , because such f
This release adds an explicit warning for tests that are both decorated with @given(...) and request a function-scoped pytest fixture, because such fixtures are only executed once for all Hypothesis test cases and that often causes trouble (377).
It's very difficult to fix this on the pytest side, so since 2015 our advice has been "just don't use function-scoped fixtures with Hypothesis". Now we detect and warn about the issue at runtime!
This release cleans up the internal machinery for stateful, after we dropped the legacy APIs in Hypothesis 5.0 (2218). There is no user-visible change
This release cleans up the internal machinery for stateful, after we dropped the legacy APIs in Hypothesis 5.0 (2218). There is no user-visible change.
This release cleans up the internal machinery for Stateful tests , after we dropped the legacy APIs in Hypothesis 5.0 ( issue #2218 ). There is no user-visible change.
This patch fixes 2351, ~hypothesis.extra.numpy.arrays would raise a confusing error if we inferred a strategy for datetime64 or timedelta64 values wit
This patch fixes 2351, ~hypothesis.extra.numpy.arrays would raise a confusing error if we inferred a strategy for datetime64 or timedelta64 values with varying time units.
We now infer an internally-consistent strategy for such arrays, and have a more helpful error message if an inconsistent strategy is explicitly specified.
This patch improves the signature of ~hypothesis.strategies.builds by specifying target as a positional-only argument on Python 3.8 (see 570). The sem
This patch improves the signature of ~hypothesis.strategies.builds by specifying target as a positional-only argument on Python 3.8 (see 570). The semantics of ~hypothesis.strategies.builds have not changed at all - this just clarifies the documentation.
This patch improves the signature of builds() by specifying target as a positional-only argument on Python 3.8 (see PEP 570 ). The semantics of builds() have not changed at all - this just clarifies the documentation.
This release makes Hypothesis faster at generating test cases that contain duplicated values in their inputs.
This release makes Hypothesis faster at generating test cases that contain duplicated values in their inputs.
This patch has some tiny internal code clean-ups, with no user-visible change.
This patch has some tiny internal code clean-ups, with no user-visible change.
:gh-file:Our style guide suggests that optional parameters should usually be keyword-only arguments (see 3102) to prevent confusion based on positiona
Our style guide suggests that optional parameters should usually be keyword-only arguments (see 3102) to prevent confusion based on positional arguments - for example, hypothesis.strategies.floats takes up to four boolean flags and many of the Numpy strategies have both dims and side bounds.
This release converts most optional parameters in our API to use keyword-only arguments - and adds a compatibility shim so you get warnings rather than errors everywhere (2130).
This patch fixes compatibility with Python 3.5.2 (2334). Note that we only test the latest patch of each minor version , though as in this case we usu
This patch fixes compatibility with Python 3.5.2 (2334). Note that we only test the latest patch of each minor version, though as in this case we usually accept pull requests for older patch versions.
This patch improves the repr of ~hypothesis.strategies.from_type, so that in most cases it will display the strategy it resolves to rather than from_t
This patch improves the repr of ~hypothesis.strategies.from_type, so that in most cases it will display the strategy it resolves to rather than from_type(...). The latter form will continue to be used where resolution is not immediately successful, e.g. invalid arguments or recursive type definitions involving forward references.
This release removes support for Python 3.5.0 and 3.5.1, where the python:typing module was quite immature (e.g. missing ~python:typing.overload and ~
This release removes support for Python 3.5.0 and 3.5.1, where the python:typing module was quite immature (e.g. missing ~python:typing.overload and ~python:typing.Type).
Note that Python 3.5 will reach its end-of-life in September 2020, and new releases of Hypothesis may drop support somewhat earlier.
Note
pip install hypothesis should continue to give you the latest compatible version. If you have somehow ended up with an incompatible version, you need to update your packaging stack to pip >= 9.0 and setuptools >= 24.2 - see here for details. Then pip uninstall hypothesis && pip install hypothesis will get you back to a compatible version.
This patch does some minor internal cleanup; there is no user-visible change.
This patch does some minor internal cleanup; there is no user-visible change.
The provisional strategies for IP address strings are therefore deprecated.
The standard library ipaddress module is new in Python 3, and this release adds the new ~hypothesis.strategies.ip_addresses strategy to generate ~python:ipaddress.IPv4Addresses and/or ~python:ipaddress.IPv6Addresses (depending on the v and network arguments).
If you use them in type annotations, ~hypothesis.strategies.from_type now has strategies registered for ipaddress address, network, and interface types.
The provisional strategies for IP address strings are therefore deprecated.
The standard library ipaddress module is new in Python 3, and this release adds the new ip_addresses() strategy to generate IPv4Address es and/or IPv6Address es (depending on the v and network arguments).
If you use them in type annotations, from_type() now has strategies registered for ipaddress address, network, and interface types.
The provisional strategies for IP address strings are therefore deprecated.
This patch reverts version 5.2 , due to a strange issue __ where indexing an array of strings can raise an error instead of returning an item which co
This patch reverts version 5.2, due to a strange issue where indexing an array of strings can raise an error instead of returning an item which contains certain surrogate characters.
This release allows ~hypothesis.extra.numpy.from_dtype to generate Unicode strings which cannot be encoded in UTF-8, but are valid in Numpy arrays (wh
This release allows ~hypothesis.extra.numpy.from_dtype to generate Unicode strings which cannot be encoded in UTF-8, but are valid in Numpy arrays (which use UTF-32).
This patch fixes 2320, where from_type(Set[Hashable]) could raise an internal error because Decimal("snan") is of a hashable type, but raises an error
This patch fixes 2320, where from_type(Set[Hashable]) could raise an internal error because Decimal("snan") is of a hashable type, but raises an error when hashed. We now ensure that set elements and dict keys in generic types can actually be hashed.
This patch fixes an internal error when running in an ipython repl or jupyter notebook on Windows (2319), and an internal error on Python 3.5.1 (2318)
This patch fixes an internal error when running in an ipython repl or jupyter notebook on Windows (2319), and an internal error on Python 3.5.1 (2318).
This patch fixes a bug where errors in third-party extensions such as hypothesis-trio or hypothesis-jsonschema were incorrectly considered to be Hypot
This patch fixes a bug where errors in third-party extensions such as hypothesis-trio or hypothesis-jsonschema were incorrectly considered to be Hypothesis internal errors, which could result in confusing error messages.
Thanks to Vincent Michel for reporting and fixing the bug!
This release converts the type hint comments on our public API to 484 type annotations.
This release converts the type hint comments on our public API to 484 type annotations.
Thanks to Ivan Levkivskyi for com2ann - with the refactoring tools from 5.0.1 it made this process remarkably easy!
This patch makes ~hypothesis.stateful.multiple iterable, so that output like a, b = state.some_rule() is actually executable and can be used to reprod
This patch makes ~hypothesis.stateful.multiple iterable, so that output like a, b = state.some_rule() is actually executable and can be used to reproduce failing examples.
Thanks to Vincent Michel for reporting and fixing 2311!
This patch contains many small refactorings to replace our Python 2 compatibility functions with their native Python 3 equivalents. Since Hypothesis i
This patch contains many small refactorings to replace our Python 2 compatibility functions with their native Python 3 equivalents. Since Hypothesis is now Python 3 only, there is no user-visible change.
This release teaches ~hypothesis.strategies.from_type how to generate python:datetime.timezone. As a result, you can now generate python:datetime.tzin
This release teaches ~hypothesis.strategies.from_type how to generate python:datetime.timezone. As a result, you can now generate python:datetime.tzinfo objects without having pytz installed.
If your tests specifically require pytz timezones, you should be using hypothesis.extra.pytz.timezones instead of st.from_type(tzinfo).
This release teaches from_type() how to generate datetime.timezone . As a result, you can now generate datetime.tzinfo objects without having pytz installed.
If your tests specifically require pytz timezones, you should be using hypothesis.extra.pytz.timezones() instead of st.from_type(tzinfo) .
This patch contains mostly-automated refactorings to remove code that we only needed to support Python 2. Since Hypothesis is now Python 3 only (hurra
This patch contains mostly-automated refactorings to remove code that we only needed to support Python 2. Since Hypothesis is now Python 3 only (hurray!), there is no user-visible change.
Our sincere thanks to the authors of autoflake, black, isort, and pyupgrade, who have each and collectively made this kind of update enormously easier.
There are no new features here, as we release those in minor versions. Instead, 5.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, 5.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 4.x without any Hypothesis deprecation warnings, this will be a very boring upgrade. In fact, nothing will change for you at all.
Note
This release drops support for Python 2, which has passed its end of life date. The Python 3 Statement outlines our reasons, and lists many other packages that have made the same decision.
pip install hypothesis should continue to give you the latest compatible version. If you have somehow ended up with Hypothesis 5.0 on Python 2, you need to update your packaging stack to pip >= 9.0 and setuptools >= 24.2 - see here for details. Then pip uninstall hypothesis && pip install hypothesis will get you back to a compatible version.
~hypothesis.strategies.integers bounds must be equal to an integer, though they can still be other types.
If ~hypothesis.strategies.fractions is passed a max_denominator, the bounds must have at most that denominator.
~hypothesis.strategies.floats bounds must be exactly representable as a floating-point number with the given width. If not, the error message includes the nearest such number.
sampled_from([]) is now an error.
The values from the elements and fill strategies for hypothesis.extra.numpy.arrays must be losslessly representable in an array of the given dtype.
The min_size and max_size arguments to all collection strategies must be of type python:int (or max_size may be None).
The .example() method of strategies (intended for interactive exploration) no longer takes a random argument.
It is now an error to apply @example, @seed, or @reproduce_failure without also applying @given.
You may pass either the target or targets argument to stateful rules, but not both.
~hypothesis.settings.deadline must be None (to disable), a ~python:datetime.timedelta, or an integer or float number of milliseconds.
Both of ~hypothesis.settings.derandomize and ~hypothesis.settings.print_blob must be either True or False, where they previously accepted other values.
~hypothesis.settings.stateful_step_count must be at least one.
~hypothesis.settings.max_examples must be at least one. To disable example generation, use the ~hypothesis.settings.phases setting.
hypothesis.stateful.GenericStateMachine in favor of hypothesis.stateful.RuleBasedStateMachine
hypothesis.extra.django.models.models in favor of hypothesis.extra.django.from_model and hypothesis.extra.django.models.add_default_field_mapping in favor of hypothesis.extra.django.register_field_strategy
hypothesis.HealthCheck.hung_test, without replacement
hypothesis.settings.buffer, without replacement
hypothesis.PrintSettings, because hypothesis.settings.print_blob takes True or False
hypothesis.settings.timeout, in favor of hypothesis.settings.deadline
hypothesis.unlimited without replacement (only useful as argument to timeout)
This patch improves the type hints and documentation for the django extra. There is no runtime change.
This patch improves the type hints and documentation for the django extra. There is no runtime change.
This release improves support for the SupportsOp protocols from the python:typing module when using on ~hypothesis.strategies.from_type as outlined in
This release improves support for the SupportsOp protocols from the python:typing module when using on ~hypothesis.strategies.from_type as outlined in 2292. The following types now generate much more varied strategies when called with ~hypothesis.strategies.from_type:
python:typing.SupportsAbs
python:typing.SupportsBytes
python:typing.SupportsComplex
python:typing.SupportsInt
python:typing.SupportsFloat
python:typing.SupportsRound
Note that using ~hypothesis.strategies.from_type with one of the above strategies will not ensure that the specified function will execute successfully (ie : the strategy returned for from_type(typing.SupportsAbs) may include NaNs or things which cause the python:abs function to error. )
Thanks to Lea Provenzano for this patch.
This release improves support for the SupportsOp protocols from the typing module when using on from_type() as outlined in issue #2292 . The following types now generate much more varied strategies when called with from_type() :
typing.SupportsAbs
typing.SupportsBytes
typing.SupportsComplex
typing.SupportsInt
typing.SupportsFloat
typing.SupportsRound
Note that using from_type() with one of the above strategies will not ensure that the specified function will execute successfully (ie : the strategy returned for from_type(typing.SupportsAbs) may include NaNs or things which cause the abs() function to error. )
Thanks to Lea Provenzano for this patch.
This release fixes a small internal bug in shrinking which could have caused it to perform slightly more tests than were necessary. Fixing this should
This release fixes a small internal bug in shrinking which could have caused it to perform slightly more tests than were necessary. Fixing this shouldn't have much effect but it will make shrinking slightly faster.
This release removes an internal heuristic that was no longer providing much benefit. It is unlikely that there will be any user visible effect.
This release removes an internal heuristic that was no longer providing much benefit. It is unlikely that there will be any user visible effect.
This release further improves the optimisation algorithm for targeted property-based testing .
This release further improves the optimisation algorithm for targeted property-based testing.
This release enables deprecation warnings even when the ~hypothesis.settings.verbosity setting is quiet, in preparation for Hypothesis 5.0 (2218).
This release enables deprecation warnings even when the ~hypothesis.settings.verbosity setting is quiet, in preparation for Hypothesis 5.0 (2218).
Warnings can still be filtered by the standard mechanisms provided in the standard-library python:warnings module.
This release enables deprecation warnings even when the verbosity setting is quiet , in preparation for Hypothesis 5.0 ( issue #2218 ).
Warnings can still be filtered by the standard mechanisms provided in the standard-library warnings module.
This release improves Hypothesis's management of the set of test cases it tracks between runs. It will only do anything if you have the ~hypothesis.Ph
This release improves Hypothesis's management of the set of test cases it tracks between runs. It will only do anything if you have the ~hypothesis.Phase.target phase enabled and an example database set. In those circumstances it should result in a more thorough and faster set of examples that are tried on each run.
This release makes Hypothesis better at generating test cases where generated values are duplicated in different parts of the test case. This will be
This release makes Hypothesis better at generating test cases where generated values are duplicated in different parts of the test case. This will be especially noticeable with reasonably complex values, as it was already able to do this for simpler ones such as integers or floats.
This release expands the set of test cases that Hypothesis saves in its database for future runs to include a representative set of "structurally diff
This release expands the set of test cases that Hypothesis saves in its database for future runs to include a representative set of "structurally different" test cases - e.g. it might try to save test cases where a given list is empty or not.
Currently this is unlikely to have much user visible impact except to produce slightly more consistent behaviour between consecutive runs of a test suite. It is mostly groundwork for future improvements which will exploit this functionality more effectively.
This patch fixes 2257, where ~hypothesis.strategies.from_type could incorrectly generate bytestrings when passed a generic python:typing.Sequence such
This patch fixes 2257, where ~hypothesis.strategies.from_type could incorrectly generate bytestrings when passed a generic python:typing.Sequence such as Sequence[set].
This patch fixes issue #2257 , where from_type() could incorrectly generate bytestrings when passed a generic typing.Sequence such as Sequence[set] .
This release adds database support for targeted property-based testing , so the best examples based on the targeting will be saved and reused between
This release adds database support for targeted property-based testing, so the best examples based on the targeting will be saved and reused between runs. This is mostly laying groundwork for future features in this area, but will also make targeted property-based tests more useful during development, where the same tests tend to get run over and over again.
If ~hypothesis.settings.max_examples is large, this may increase memory usage significantly under some circumstances, but these should be relatively rare.
This release also adds a dependency on the sortedcontainers package.
This release improves the optimisation algorithm for targeted property-based testing , so that it will find higher quality results more reliably. Spec
This release improves the optimisation algorithm for targeted property-based testing, so that it will find higher quality results more reliably. Specifically, in cases where it would previously have got near a local optimum, it will now tend to achieve the locally optimal value.
This release is mostly internal changes in support of better testing of the core engine. You are unlikely to see much effect, although some internal h
This release is mostly internal changes in support of better testing of the core engine. You are unlikely to see much effect, although some internal heuristics have changed slightly.
This release adds a dedicated phase for targeted property-based testing , and (somewhat) improves the targeting algorithm so that it will find higher
This release adds a dedicated phase for targeted property-based testing, and (somewhat) improves the targeting algorithm so that it will find higher quality results more reliably. This comes at a cost of making it more likely to get stuck in a local optimum.
This patch fixes ~hypothesis.strategies.from_type with python:typing.Hashable and python:typing.Sized, which previously failed with an internal error
This patch fixes ~hypothesis.strategies.from_type with python:typing.Hashable and python:typing.Sized, which previously failed with an internal error on Python 3.7 or later.
Thanks to Lea Provenzano for both reporting 2272 and writing the patch!
This patch fixes from_type() with typing.Hashable and typing.Sized , which previously failed with an internal error on Python 3.7 or later.
Thanks to Lea Provenzano for both reporting issue #2272 and writing the patch!
This release reorganises a number of the Hypothesis internal modules into a package structure. If you are only depending on the public API it should h
This release reorganises a number of the Hypothesis internal modules into a package structure. If you are only depending on the public API it should have no effect. If you are depending on the internal API (which you shouldn't be, and which we don't guarantee compatibility on) you may have to rename some imports.
This release changes the size distribution of the number of steps run in stateful testing: It will now almost always run the maximum number of steps p
This release changes the size distribution of the number of steps run in stateful testing: It will now almost always run the maximum number of steps permitted.
statistics now include the best score seen for each label, which can help avoid the threshold problem __ when the minimal example shrinks right down t
statistics now include the best score seen for each label, which can help avoid the threshold problem when the minimal example shrinks right down to the threshold of failure (2180).
This release changes the stateful_step_count setting to raise an error if set to 0. This is a backwards compatible change because a value of 0 would n
This release changes the stateful_step_count setting to raise an error if set to 0. This is a backwards compatible change because a value of 0 would never have worked and attempting to run it would have resulted in an internal assertion error.
This release makes a small internal change to the distribution of test cases. It is unlikely to have much user visible impact.
This release makes a small internal change to the distribution of test cases. It is unlikely to have much user visible impact.
This release deprecates use of @example , @seed , or @reproduce_failure without @given .
This release deprecates use of @example, @seed, or @reproduce_failure without @given.
Thanks to Nick Anyos for the patch!
This patch makes certain uses of Bundles more efficient in stateful testing (2078).
This patch makes certain uses of Bundles more efficient in stateful testing (2078).
This release refactors some of Hypothesis's internal interfaces for representing data generation. It should have no user visible effect.
This release refactors some of Hypothesis's internal interfaces for representing data generation. It should have no user visible effect.
This patch removes some old debugging helpers in our Numpy extra which have not been needed since 1963 and 2245.
This patch removes some old debugging helpers in our Numpy extra which have not been needed since 1963 and 2245.
This patch fixes 2229, where Numpy arrays of unsized strings would only ever have strings of size one due to an interaction between our generation log
This patch fixes 2229, where Numpy arrays of unsized strings would only ever have strings of size one due to an interaction between our generation logic and Numpy's allocation strategy.
This patch fixes a rare internal error in strategies for a list of unique items sampled from a short non-unique sequence (2247). The bug was discovere
This patch fixes a rare internal error in strategies for a list of unique items sampled from a short non-unique sequence (2247). The bug was discovered via hypothesis-jsonschema.
This release improves the error message when @settings tries to inherit settings from a parent argument that isn't a settings instance.
This release improves the error message when @settings tries to inherit settings from a parent argument that isn't a settings instance.
This release improves Hypothesis's "Falsifying example" output, by breaking output across multiple lines where necessary, and by removing irrelevant i
This release improves Hypothesis's "Falsifying example" output, by breaking output across multiple lines where necessary, and by removing irrelevant information from the stateful testing output.
Your coding agent can read these notes before it upgrades. Set up the MCP server →