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 7 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 release fixes a bug (2160) where decorators applied after @settings and before @given were ignored.
This release fixes a bug (2160) where decorators applied after @settings and before @given were ignored.
Thanks to Tom Milligan for this bugfix!
This release updates Hypothesis's formatting to the new version of black, and has absolutely no user visible effect.
This release updates Hypothesis's formatting to the new version of black, and has absolutely no user visible effect.
This release fixes a bug in ~hypothesis.strategies.recursive which would have meant that in practice max_leaves was treated as if it was lower than it
Your coding agent can read these notes before it upgrades. Set up the MCP server →
This release fixes a bug in ~hypothesis.strategies.recursive which would have meant that in practice max_leaves was treated as if it was lower than it actually is - specifically it would be capped at the largest power of two smaller than it. It is now handled correctly.
Python 3.8's new python:typing.SupportsIndex type - see 357 for details - is now supported in ~hypothesis.strategies.from_type.
Python 3.8's new python:typing.SupportsIndex type - see 357 for details - is now supported in ~hypothesis.strategies.from_type.
Thanks to Grigorios Giannakopoulos for the patch!
Python 3.8’s new typing.SupportsIndex type - see PEP 357 for details - is now supported in from_type() .
Thanks to Grigorios Giannakopoulos for the patch!
This release significantly simplifies Hypothesis's internal logic for data generation, by removing a number of heuristics of questionable or unproven
This release significantly simplifies Hypothesis's internal logic for data generation, by removing a number of heuristics of questionable or unproven value.
The results of this change will vary significantly from test to test. Most test suites will see significantly faster data generation and lower memory usage. The "quality" of the generated data may go up or down depending on your particular test suites.
If you see any significant regressions in Hypothesis's ability to find bugs in your code as a result of this release, please file an issue to let us know.
Users of the new targeted property-based testing functionality are reasonably likely to see improvements in data generation, as this release changes the search algorithm for targeted property based testing to one that is more likely to be productive than the existing approach.
This patch is to ensure that our internals remain comprehensible to mypy 0.740 - there is no user-visible change.
This patch is to ensure that our internals remain comprehensible to mypy 0.740 - there is no user-visible change.
This patch changes some internal hashes to SHA384, to better support users subject to FIPS-140. There is no user-visible API change.
This patch changes some internal hashes to SHA384, to better support users subject to FIPS-140. There is no user-visible API change.
Thanks to Paul Kehrer for this contribution!
This release makes --hypothesis-show-statistics much more useful for tests using a ~hypothesis.stateful.RuleBasedStateMachine, by simplifying the repr
This release makes --hypothesis-show-statistics much more useful for tests using a ~hypothesis.stateful.RuleBasedStateMachine, by simplifying the reprs so that events are aggregated correctly.
This release upgrades the ~hypothesis.strategies.fixed_dictionaries strategy to support optional keys (1913).
This release upgrades the ~hypothesis.strategies.fixed_dictionaries strategy to support optional keys (1913).
This release upgrades the fixed_dictionaries() strategy to support optional keys ( issue #1913 ).
This release makes some minor internal changes in support of improving the Hypothesis test suite. It should not have any user visible impact.
This release makes some minor internal changes in support of improving the Hypothesis test suite. It should not have any user visible impact.
This release changes how Hypothesis checks if a parameter to a test function is a mock object. It is unlikely to have any noticeable effect, but may r
This release changes how Hypothesis checks if a parameter to a test function is a mock object. It is unlikely to have any noticeable effect, but may result in a small performance improvement, especially for test functions where a mock object is being passed as the first argument.
This release fixes a bug where our example database logic did not distinguish between failing examples based on arguments from a @pytest.mark.parametr
This release fixes a bug where our example database logic did not distinguish between failing examples based on arguments from a @pytest.mark.parametrize(...). This could in theory cause data loss if a common failure overwrote a rare one, and in practice caused occasional file-access collisions in highly concurrent workloads (e.g. during a 300-way parametrize on 16 cores).
For internal reasons this also involves bumping the minimum supported version of pytest to 4.3
Thanks to Peter C Kroon for the Hacktoberfest patch!
This patch improves our type hints on the ~hypothesis.strategies.emails, ~hypothesis.strategies.functions, ~hypothesis.strategies.integers, ~hypothesi
This patch improves our type hints on the ~hypothesis.strategies.emails, ~hypothesis.strategies.functions, ~hypothesis.strategies.integers, ~hypothesis.strategies.iterables, and ~hypothesis.strategies.slices strategies, as well as the .filter() method.
There is no runtime change, but if you use mypy or a similar type-checker on your tests the results will be a bit more precise.
This patch improves our type hints on the emails() , functions() , integers() , iterables() , and slices() strategies, as well as the .filter() method.
There is no runtime change, but if you use mypy or a similar type-checker on your tests the results will be a bit more precise.
This patch improves the performance of unique collections such as ~hypothesis.strategies.sets of ~hypothesis.strategies.just or ~hypothesis.strategies
This patch improves the performance of unique collections such as ~hypothesis.strategies.sets of ~hypothesis.strategies.just or ~hypothesis.strategies.booleans strategies. They were already pretty good though, so you're unlikely to notice much!
This patch improves the performance of unique collections such as sets() of just() or booleans() strategies. They were already pretty good though, so you’re unlikely to notice much!
If a value in a dict passed to ~hypothesis.strategies.fixed_dictionaries is not a strategy, Hypothesis now tells you which one.
If a value in a dict passed to ~hypothesis.strategies.fixed_dictionaries is not a strategy, Hypothesis now tells you which one.
If a value in a dict passed to fixed_dictionaries() is not a strategy, Hypothesis now tells you which one.
This release adds the ~hypothesis.extra.numpy.basic_indices strategy, to generate basic indexes __ for arrays of the specified shape (1930).
This release adds the ~hypothesis.extra.numpy.basic_indices strategy, to generate basic indexes for arrays of the specified shape (1930).
It generates tuples containing some mix of integers, python:slice objects, ... (Ellipsis), and numpy:numpy.newaxis; which when used to index an array of the specified shape produce either a scalar or a shared-memory view of the array. Note that the index tuple may be longer or shorter than the array shape, and may produce a view with another dimensionality again!
Thanks to Lampros Mountrakis, Ryan Soklaski, and Zac Hatfield-Dodds for their collaboration on this surprisingly subtle strategy!
This patch defers creation of the .hypothesis directory until we have something to store in it, meaning that it will appear when Hypothesis is used ra
This patch defers creation of the .hypothesis directory until we have something to store in it, meaning that it will appear when Hypothesis is used rather than simply installed.
Thanks to Peter C Kroon for the Hacktoberfest patch!
This patch bumps our dependency on attrs to >=19.2.0; but there are no user-visible changes to Hypothesis.
This patch bumps our dependency on attrs to >=19.2.0; but there are no user-visible changes to Hypothesis.
This is a comment-only patch which tells mypy 0.730 to ignore some internal compatibility shims we use to support older Pythons.
This is a comment-only patch which tells mypy 0.730 to ignore some internal compatibility shims we use to support older Pythons.
This release adds the hypothesis.target function, which implements targeted property-based testing (1779).
This release adds the hypothesis.target function, which implements targeted property-based testing (1779).
By calling ~hypothesis.target in your test function, Hypothesis can do a hill-climbing search for bugs. If you can calculate a suitable metric such as the load factor or length of a queue, this can help you find bugs with inputs that are highly improbably from unguided generation - however good our heuristics, example diversity, and deduplication logic might be. After all, those features are at work in targeted PBT too!
This release emits a warning if you use the .example() method of a strategy in a non-interactive context.
This release emits a warning if you use the .example() method of a strategy in a non-interactive context.
~hypothesis.given is a much better choice for writing tests, whether you care about performance, minimal examples, reproducing failures, or even just the variety of inputs that will be tested!
This patch disables part of the typing-based inference for the attrs package under Python 3.5.0, which has some incompatible internal details (2095).
This patch disables part of the typing-based inference for the attrs package under Python 3.5.0, which has some incompatible internal details (2095).
This patch fixes a bug in strategy inference for attrs classes where Hypothesis would fail to infer a strategy for attributes of a generic type such a
This patch fixes a bug in strategy inference for attrs classes where Hypothesis would fail to infer a strategy for attributes of a generic type such as Union[int, str] or List[bool] (2091).
Thanks to Jonathan Gayvallet for the bug report and this patch!
This patch deprecates min_len or max_len of 0 in ~hypothesis.extra.numpy.byte_string_dtypes and ~hypothesis.extra.numpy.unicode_string_dtypes. The low…
This patch deprecates min_len or max_len of 0 in ~hypothesis.extra.numpy.byte_string_dtypes and ~hypothesis.extra.numpy.unicode_string_dtypes. The lower limit is now 1.
Numpy uses a length of 0 in these dtypes to indicate an undetermined size, chosen from the data at array creation. However, as the ~hypothesis.extra.numpy.arrays strategy creates arrays before filling them, strings were truncated to 1 byte.
This patch deprecates min_len or max_len of 0 in byte_string_dtypes() and unicode_string_dtypes() . The lower limit is now 1.
Numpy uses a length of 0 in these dtypes to indicate an undetermined size, chosen from the data at array creation. However, as the arrays() strategy creates arrays before filling them, strings were truncated to 1 byte.
This patch improves the messaging that comes from invalid size arguments to collection strategies such as ~hypothesis.strategies.lists.
This patch improves the messaging that comes from invalid size arguments to collection strategies such as ~hypothesis.strategies.lists.
This release improves the ~hypothesis.extra.lark.from_lark strategy, tightening argument validation and adding the explicit argument to allow use with
This release improves the ~hypothesis.extra.lark.from_lark strategy, tightening argument validation and adding the explicit argument to allow use with terminals that use @declare instead of a string or regular expression.
This feature is required to handle features such as indent and dedent tokens in Python code, which can be generated with the hypothesmith package.
The ~hypothesis.strategies.from_type strategy now knows to look up the subclasses of abstract types, which cannot be instantiated directly.
The ~hypothesis.strategies.from_type strategy now knows to look up the subclasses of abstract types, which cannot be instantiated directly.
This is very useful for hypothesmith to support libCST.
This patch works around a crash when an incompatible version of Numpy is installed under PyPy 5.10 (Python 2.7).
This patch works around a crash when an incompatible version of Numpy is installed under PyPy 5.10 (Python 2.7).
If you are still using Python 2, please upgrade to Python 3 as soon as possible - it will be unsupported at the end of this year.
This release improves the ~hypothesis.provisional.domains strategy, as well as the ~hypothesis.provisional.urls and the ~hypothesis.strategies.emails
This release improves the ~hypothesis.provisional.domains strategy, as well as the ~hypothesis.provisional.urls and the ~hypothesis.strategies.emails strategies which use it. These strategies now use the full IANA list of Top Level Domains and are correct as per 1035.
Passing tests using these strategies may now fail.
Thanks to TechDragon for this improvement.
This release improves the domains() strategy, as well as the urls() and the emails() strategies which use it. These strategies now use the full IANA list of Top Level Domains and are correct as per RFC 1035 .
Passing tests using these strategies may now fail.
Thanks to TechDragon for this improvement.
This patch tidies up the repr of several settings-related objects, at runtime and in the documentation, and deprecates the undocumented edge case that…
This patch tidies up the repr of several settings-related objects, at runtime and in the documentation, and deprecates the undocumented edge case that phases=None was treated like phases=tuple(Phase).
It also fixes ~hypothesis.extra.lark.from_lark with lark 0.7.2 and later.
This patch updates some internal comments for mypy 0.720. There is no user-visible impact.
This patch updates some internal comments for mypy 0.720. There is no user-visible impact.
This release changes how the shrinker represents its progress internally. For large generated test cases this should result in significantly less memo
This release changes how the shrinker represents its progress internally. For large generated test cases this should result in significantly less memory usage and possibly faster shrinking. Small generated test cases may be slightly slower to shrink but this shouldn't be very noticeable.
This release makes ~hypothesis.extra.numpy.arrays more pedantic about elements strategies that cannot be exactly represented as array elements.
This release makes ~hypothesis.extra.numpy.arrays more pedantic about elements strategies that cannot be exactly represented as array elements.
In practice, you will see new warnings if you were using a float16 or float32 dtype without passing ~hypothesis.strategies.floats the width=16 or width=32 arguments respectively.
The previous behaviour could lead to silent truncation, and thus some elements being equal to an explicitly excluded bound (1899).
This patch changes an internal use of MD5 to SHA hashes, to better support users subject to FIPS-140. There is no user-visible or API change.
This patch changes an internal use of MD5 to SHA hashes, to better support users subject to FIPS-140. There is no user-visible or API change.
Thanks to Alex Gaynor for this patch.
As a result the print_blob setting now takes a single boolean value, and the use of PrintSettings is deprecated.
This release simplifies the logic of the ~hypothesis.settings.print_blob setting by removing the option to set it to PrintSettings.INFER. As a result the print_blob setting now takes a single boolean value, and the use of PrintSettings is deprecated.
This patch improves the docstrings of several Hypothesis strategies, by clarifying markup and adding cross-references. There is no runtime change.
This patch improves the docstrings of several Hypothesis strategies, by clarifying markup and adding cross-references. There is no runtime change.
Thanks to Elizabeth Williams and Serah Njambi Rono for their contributions at the SciPy 2019 sprints!
This patch improves the behaviour of the ~hypothesis.strategies.text strategy when passed an alphabet which is not a strategy. The value is now interp
This patch improves the behaviour of the ~hypothesis.strategies.text strategy when passed an alphabet which is not a strategy. The value is now interpreted as include_characters to ~hypothesis.strategies.characters instead of a sequence for ~hypothesis.strategies.sampled_from, which standardises the distribution of examples and the shrinking behaviour.
You can get the previous behaviour by using lists(sampled_from(alphabet)).map("".map) instead.
This patch improves the behaviour of the text() strategy when passed an alphabet which is not a strategy. The value is now interpreted as include_characters to characters() instead of a sequence for sampled_from() , which standardises the distribution of examples and the shrinking behaviour.
You can get the previous behaviour by using lists(sampled_from(alphabet)).map("".map) instead.
This release deprecates find(). The .example() method is a better replacement if you want *an* example, and for the rare occasions where you want the…
This release deprecates find(). The .example() method is a better replacement if you want an example, and for the rare occasions where you want the minimal example you can get it from @given.
@given has steadily outstripped find() in both features and performance over recent years, and as we do not have the resources to maintain and test both we think it is better to focus on just one.
This release refactors the implementation of the .example() method, to more accurately represent the data which will be generated by @given .
This release refactors the implementation of the .example() method, to more accurately represent the data which will be generated by @given.
As a result, calling s.example() on an empty strategy s (such as ~hypothesis.strategies.nothing) now raises Unsatisfiable instead of the old NoExamples exception.
This patch ensures that the Pandas extra will keep working when Python 3.8 removes abstract base classes from the top-level python:collections namespa
This patch ensures that the Pandas extra will keep working when Python 3.8 removes abstract base classes from the top-level python:collections namespace. This also fixes the relevant warning in Python 3.7, but there is no other difference in behaviour and you do not need to do anything.
This release fixes 2027, by changing the way Hypothesis tries to generate distinct examples to be more efficient.
This release fixes 2027, by changing the way Hypothesis tries to generate distinct examples to be more efficient.
This may result in slightly different data distribution, and should improve generation performance in general, but should otherwise have minimal user impact.
This release fixes 1864, where some simple tests would perform very slowly, because they would run many times with each subsequent run being progressi
This release fixes 1864, where some simple tests would perform very slowly, because they would run many times with each subsequent run being progressively slower. They will now stop after a more reasonable number of runs without hitting this problem.
Unless you are hitting exactly this issue, it is unlikely that this release will have any effect, but certain classes of custom generators that are currently very slow may become a bit faster, or start to trigger health check failures.
This release adds the strategy ~hypothesis.extra.numpy.integer_array_indices, which generates tuples of Numpy arrays that can be used for advanced ind
This release adds the strategy ~hypothesis.extra.numpy.integer_array_indices, which generates tuples of Numpy arrays that can be used for advanced indexing to select an array of a specified shape.
This release significantly improves the performance of drawing unique collections whose elements are drawn from ~hypothesis.strategies.sampled_from st
This release significantly improves the performance of drawing unique collections whose elements are drawn from ~hypothesis.strategies.sampled_from strategies.
As a side effect, this detects an error condition that would previously have passed silently: When the min_size argument on a collection with distinct elements is greater than the number of elements being sampled, this will now raise an error.
This release removes some defunct internal functionality that was only being used for testing. It should have no user visible impact.
This release removes some defunct internal functionality that was only being used for testing. It should have no user visible impact.
This release deprecates and disables the buffer_size setting, which should have been treated as a private implementation detail all along. We recommen…
This release deprecates and disables the buffer_size setting, which should have been treated as a private implementation detail all along. We recommend simply deleting this settings argument.
This patch makes ~hypothesis.strategies.datetimes more efficient, as it now handles short months correctly by construction instead of filtering.
This patch makes ~hypothesis.strategies.datetimes more efficient, as it now handles short months correctly by construction instead of filtering.
This patch makes datetimes() more efficient, as it now handles short months correctly by construction instead of filtering.
This patch improves the development experience by simplifying the tracebacks you will see when e.g. you have used the .map(...) method of a strategy a
This patch improves the development experience by simplifying the tracebacks you will see when e.g. you have used the .map(...) method of a strategy and the mapped function raises an exception.
No new exceptions can be raised, nor existing exceptions change anything but their traceback. We're simply using if-statements rather than exceptions for control flow in a certain part of the internals!
This patch fixes 2014, where our compatibility layer broke with version 3.7.4 of the typing module backport on PyPI.
This patch fixes 2014, where our compatibility layer broke with version 3.7.4 of the typing module backport on PyPI.
This issue only affects Python 2. We remind users that Hypothesis, like many other packages, will drop Python 2 support on 2020-01-01 and already has several features that are only available on Python 3.
This patch improves the implementation of an internal wrapper on Python 3.8 beta1 (and will break on the alphas; but they're not meant to be stable).
This patch improves the implementation of an internal wrapper on Python 3.8 beta1 (and will break on the alphas; but they're not meant to be stable). On other versions, there is no change at all.
Thanks to Daniel Hahler for the patch, and Victor Stinner for his work on 37032 that made it possible.
Deprecation messages for functions in hypothesis.extra.django.models now explicitly name the deprecated function to make it easier to track down usage…
Deprecation messages for functions in hypothesis.extra.django.models now explicitly name the deprecated function to make it easier to track down usages. Thanks to Kristian Glass for this contribution!
This patch fixes 1999, a spurious bug raised when a @st.composite function was passed a keyword-only argument.
This patch fixes 1999, a spurious bug raised when a @st.composite function was passed a keyword-only argument.
Thanks to Jim Nicholls for his fantastic bug report.
This release deprecates GenericStateMachine, in favor of ~hypothesis.stateful.RuleBasedStateMachine. Rule-based stateful testing is significantly fast…
This release deprecates GenericStateMachine, in favor of ~hypothesis.stateful.RuleBasedStateMachine. Rule-based stateful testing is significantly faster, especially during shrinking.
If your use-case truly does not fit rule-based stateful testing, we recommend writing a custom test function which drives your specific control-flow using ~hypothesis.strategies.data.
This patch fixes a very rare example database issue with file permissions.
This patch fixes a very rare example database issue with file permissions.
When running a test that uses both @given and pytest.mark.parametrize, using pytest-xdist on Windows, with failing examples in the database, two attempts to read a file could overlap and we caught FileNotFound but not other OSErrors.
This patch has a minor cleanup of the internal engine. There is no user-visible impact.
This patch has a minor cleanup of the internal engine. There is no user-visible impact.
This patch clarifies some error messages when the test function signature is incompatible with the arguments to @given , especially when the @settings
This patch clarifies some error messages when the test function signature is incompatible with the arguments to @given, especially when the @settings() decorator is also used (1978).
This release adds the pyupgrade fixer to our code style, for consistent use of dict and set literals and comprehensions.
This release adds the pyupgrade fixer to our code style, for consistent use of dict and set literals and comprehensions.
This release slightly simplifies a small part of the core engine. There is no user-visible change.
This release slightly simplifies a small part of the core engine. There is no user-visible change.
Fixes a minor formatting issue the docstring of ~hypothesis.strategies.from_type
Fixes a minor formatting issue the docstring of ~hypothesis.strategies.from_type
Adds a recipe to the docstring of ~hypothesis.strategies.from_type that describes a means for drawing values for "everything except" a specified type.
Adds a recipe to the docstring of ~hypothesis.strategies.from_type that describes a means for drawing values for "everything except" a specified type. This recipe is especially useful for writing tests that perform input-type validation.
One column per quarter.