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 the ~hypothesis.extra.django.from_form function, which allows automatic testing against Django forms. (35)
This release adds the ~hypothesis.extra.django.from_form function, which allows automatic testing against Django forms. (35)
Thanks to Paul Stiverson for this feature, which resolves our oldest open issue!
This release deprecates HealthCheck.hung_test and disables the associated runtime check for tests that ran for more than five minutes. Such a check is…
This release deprecates HealthCheck.hung_test and disables the associated runtime check for tests that ran for more than five minutes. Such a check is redundant now that we enforce the deadline and max_examples setting, which can be adjusted independently.
One column per quarter.
This release adds a new module, hypothesis.extra.lark, which you can use to generate strings matching a context-free grammar.
This release adds a new module, hypothesis.extra.lark, which you can use to generate strings matching a context-free grammar.
In this initial version, only lark-parser EBNF grammars are supported, by the new hypothesis.extra.lark.from_lark function.
This patch fixes a very rare overflow bug (1748) which could raise an InvalidArgument error in ~hypothesis.strategies.complex_numbers even though the
This patch fixes a very rare overflow bug (1748) which could raise an InvalidArgument error in ~hypothesis.strategies.complex_numbers even though the arguments were valid.
This release makes some improvements to internal code organisation and documentation and has no impact on behaviour.
This release makes some improvements to internal code organisation and documentation and has no impact on behaviour.
This release adds ~hypothesis.register_random, which registers random.Random instances or compatible objects to be seeded and reset by Hypothesis to e
This release adds ~hypothesis.register_random, which registers random.Random instances or compatible objects to be seeded and reset by Hypothesis to ensure that test cases are deterministic.
We still recommend explicitly passing a random.Random instance from ~hypothesis.strategies.randoms if possible, but registering a framework-global state for Hypothesis to manage is better than flaky tests!
This patch fixes 1387, where bounded ~hypothesis.strategies.integers with a very large range would almost always generate very large numbers. Now, we
This patch fixes 1387, where bounded ~hypothesis.strategies.integers with a very large range would almost always generate very large numbers. Now, we usually use the same tuned distribution as unbounded ~hypothesis.strategies.integers.
This patch fixes issue #1387 , where bounded integers() with a very large range would almost always generate very large numbers. Now, we usually use the same tuned distribution as unbounded integers() .
This release randomizes the order in which the shrinker tries some of its initial normalization operations. You are unlikely to see much difference as
This release randomizes the order in which the shrinker tries some of its initial normalization operations. You are unlikely to see much difference as a result unless your generated examples are very large. In this case you may see some performance improvements in shrinking.
There are no new features here, as we release those in minor versions. Instead, 4.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, 4.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 3.x without any Hypothesis deprecation warnings (or using private APIs), this will be a very boring upgrade. In fact, nothing will change for you at all. Per our deprecation policy, warnings added in the last six months (after 2018-07-05) have not been converted to errors.
hypothesis.extra.datetime has been removed, replaced by the core date and time strategies.
hypothesis.extra.fakefactory has been removed, replaced by general expansion of Hypothesis' strategies and the third-party ecosystem.
The SQLite example database backend has been removed.
The ~hypothesis.settings.deadline is now enforced by default, rather than just emitting a warning when the default (200 milliseconds per test case) deadline is exceeded.
The database_file setting has been removed; use ~hypothesis.settings.database.
The perform_health_check setting has been removed; use ~hypothesis.settings.suppress_health_check.
The max_shrinks setting has been removed; use ~hypothesis.settings.phases to disable shrinking.
The min_satisfying_examples, max_iterations, strict, timeout, and use_coverage settings have been removed without user-configurable replacements.
The elements argument is now required for collection strategies.
The average_size argument was a no-op and has been removed.
Date and time strategies now only accept min_value and max_value for bounds.
~hypothesis.strategies.builds now requires that the thing to build is passed as the first positional argument.
Alphabet validation for ~hypothesis.strategies.text raises errors, not warnings, as does category validation for ~hypothesis.strategies.characters.
The choices() strategy has been removed. Instead, you can use ~hypothesis.strategies.data with ~hypothesis.strategies.sampled_from, so choice(elements) becomes data.draw(sampled_from(elements)).
The streaming() strategy has been removed. Instead, you can use ~hypothesis.strategies.data and replace iterating over the stream with data.draw() calls.
~hypothesis.strategies.sampled_from and ~hypothesis.strategies.permutations raise errors instead of warnings if passed a collection that is not a sequence.
Applying @given to a test function multiple times was really inefficient, and now it's also an error.
Using the .example() method of a strategy (intended for interactive exploration) within another strategy or a test function always weakened data generation and broke shrinking, and now it's an error too.
The HYPOTHESIS_DATABASE_FILE environment variable is no longer supported, as the database_file setting has been removed.
The HYPOTHESIS_VERBOSITY_LEVEL environment variable is no longer supported. You can use the --hypothesis-verbosity pytest argument instead, or write your own setup code using the settings profile system to replace it.
Using @seed or derandomize=True now forces database=None to ensure results are in fact reproducible. If ~hypothesis.settings.database is not None, doing so also emits a HypothesisWarning.
Unused exception types have been removed from hypothesis.errors; namely AbnormalExit, BadData, BadTemplateDraw, DefinitelyNoSuchExample, Timeout, and WrongFormat.
This changes the order that the shrinker tries certain operations in its "emergency" phase which runs late in the process. The new order should be bet
This changes the order that the shrinker tries certain operations in its "emergency" phase which runs late in the process. The new order should be better at avoiding long stalls where the shrinker is failing to make progress, which may be helpful if you have difficult to shrink test cases. However this will not be noticeable in the vast majority of use cases.
This is a pure refactoring release that extracts some logic from the core Hypothesis engine into its own class and file. It should have no user visibl
This is a pure refactoring release that extracts some logic from the core Hypothesis engine into its own class and file. It should have no user visible impact.
This patch fixes some markup in our documentation.
This patch fixes some markup in our documentation.
Introduces hypothesis.stateful.multiple, which allows rules in rule based state machines to send multiple results at once to their target Bundle, or n
Introduces hypothesis.stateful.multiple, which allows rules in rule based state machines to send multiple results at once to their target Bundle, or none at all.
hypothesis.extra.django.models.models() is deprecated in favor of hypothesis.extra.django.from_model.
This release contains a massive cleanup of the Hypothesis for Django extra:
hypothesis.extra.django.models.models() is deprecated in favor of hypothesis.extra.django.from_model.
hypothesis.extra.django.models.add_default_field_mapping() is deprecated in favor of hypothesis.extra.django.register_field_strategy.
~hypothesis.extra.django.from_model does not infer a strategy for nullable fields or fields with a default unless passed infer, like ~hypothesis.strategies.builds. models.models() would usually but not always infer, and a special default_value marker object was required to disable inference.
This release improves some internal logic about when a test case in Hypothesis's internal representation could lead to a valid test case. In some circ
This release improves some internal logic about when a test case in Hypothesis's internal representation could lead to a valid test case. In some circumstances this can lead to a significant speed up during shrinking. It may have some minor negative impact on the quality of the final result due to certain shrink passes now having access to less information about test cases in some circumstances, but this should rarely matter.
This release has no user visible changes but updates our URLs to use HTTPS.
This release has no user visible changes but updates our URLs to use HTTPS.
Hypothesis can now automatically generate values for Django models with a ~django.db.models.URLField, thanks to a new provisional strategy for URLs (1
Hypothesis can now automatically generate values for Django models with a ~django.db.models.URLField, thanks to a new provisional strategy for URLs (1388).
Hypothesis can now automatically generate values for Django models with a URLField , thanks to a new provisional strategy for URLs ( issue #1388 ).
This release is a pure refactoring that extracts some internal code into its own file. It should have no user visible effect.
This release is a pure refactoring that extracts some internal code into its own file. It should have no user visible effect.
This is a docs-only patch, which fixes some typos and removes a few hyperlinks for deprecated features.
This is a docs-only patch, which fixes some typos and removes a few hyperlinks for deprecated features.
This release changes the order in which the shrinker tries to delete data. For large and slow tests this may significantly improve the performance of
This release changes the order in which the shrinker tries to delete data. For large and slow tests this may significantly improve the performance of shrinking.
This release fixes a bug where certain places Hypothesis internal errors could be raised during shrinking when a user exception occurred that suppress
This release fixes a bug where certain places Hypothesis internal errors could be raised during shrinking when a user exception occurred that suppressed an exception Hypothesis uses internally in its generation.
The two known ways to trigger this problem were:
Errors raised in stateful tests' teardown function.
Errors raised in finally blocks that wrapped a call to data.draw.
These cases will now be handled correctly.
This patch is a docs-only change to fix a broken hyperlink.
This patch is a docs-only change to fix a broken hyperlink.
This patch fixes 1732, where ~hypothesis.strategies.integers would always return long values on Python 2.
This patch fixes 1732, where ~hypothesis.strategies.integers would always return long values on Python 2.
This patch fixes issue #1732 , where integers() would always return long values on Python 2.
This release ensures that infinite numbers are never generated by ~hypothesis.strategies.floats with allow_infinity=False, which could previously happ
This release ensures that infinite numbers are never generated by ~hypothesis.strategies.floats with allow_infinity=False, which could previously happen in some cases where one bound was also provided.
The trivially inconsistent min_value=inf, allow_infinity=False now raises an InvalidArgumentError, as does the inverse with max_value. You can still use just(inf) to generate inf without violating other constraints.
Happy new year everyone! This release has no user visible changes but updates our copyright headers to include 2019.
Happy new year everyone! This release has no user visible changes but updates our copyright headers to include 2019.
This release makes a small change to the way the shrinker works. You may see some improvements to speed of shrinking on especially large and hard to s
This release makes a small change to the way the shrinker works. You may see some improvements to speed of shrinking on especially large and hard to shrink examples, but most users are unlikely to see much difference.
This patch fixes 1700, where a line that contained a Unicode character before a lambda definition would cause an internal exception.
This patch fixes 1700, where a line that contained a Unicode character before a lambda definition would cause an internal exception.
Introduces the hypothesis.stateful.consumes function. When defining a rule in stateful testing, it can be used to mark bundles from which values shoul
Introduces the hypothesis.stateful.consumes function. When defining a rule in stateful testing, it can be used to mark bundles from which values should be consumed, i. e. removed after use in the rule. This has been proposed in 136.
Thanks to Jochen Müller for this long-awaited feature.
This patch makes a small internal change to fix an issue in Hypothesis's own coverage tests (1718).
This patch makes a small internal change to fix an issue in Hypothesis's own coverage tests (1718).
There is no user-visible change.
This patch refactors the hypothesis.strategies module, so that private names should no longer appear in tab-completion lists. We previously relied on
This patch refactors the hypothesis.strategies module, so that private names should no longer appear in tab-completion lists. We previously relied on __all__ for this, but not all editors respect it.
This is a follow-up patch to ensure that the deprecation date is automatically recorded for any new deprecations. There is no user-visible effect.
This is a follow-up patch to ensure that the deprecation date is automatically recorded for any new deprecations. There is no user-visible effect.
This patch updates the Hypothesis pytest plugin to avoid a recently deprecated hook interface. There is no user-visible change.
This patch updates the Hypothesis pytest plugin to avoid a recently deprecated hook interface. There is no user-visible change.
This patch fixes the internals for ~hypothesis.strategies.integers with one bound. Values from this strategy now always shrink towards zero instead of
This patch fixes the internals for ~hypothesis.strategies.integers with one bound. Values from this strategy now always shrink towards zero instead of towards the bound, and should shrink much more efficiently too. On Python 2, providing a bound incorrectly excluded long integers, which can now be generated.
This patch adds information about when features were deprecated, but this is only recorded internally and has no user-visible effect.
This patch adds information about when features were deprecated, but this is only recorded internally and has no user-visible effect.
This release changes the stateful testing backend from find() to use @given (1300). This doesn't change how you create stateful tests, but does make t
This release changes the stateful testing backend from find() to use @given (1300). This doesn't change how you create stateful tests, but does make them run more like other Hypothesis tests.
@reproduce_failure and @seed now work for stateful tests.
Stateful tests now respect the ~hypothesis.settings.deadline and ~hypothesis.settings.suppress_health_check settings, though they are disabled by default. You can enable them by using @settings(...) as a class decorator with whatever arguments you prefer.
Hypothesis has adopted black as our code formatter (1686). There are no functional changes to the source, but it's prettier!
Hypothesis has adopted black as our code formatter (1686). There are no functional changes to the source, but it's prettier!
This patch increases the variety of examples generated by ~hypothesis.strategies.from_type.
This patch increases the variety of examples generated by ~hypothesis.strategies.from_type.
This patch increases the variety of examples generated by from_type() .
Our pytest plugin now warns you when strategy functions have been collected as tests, which may happen when e.g. using the @composite decorator when y
Our pytest plugin now warns you when strategy functions have been collected as tests, which may happen when e.g. using the @composite decorator when you should be using @given(st.data()) for inline draws. Such functions always pass when treated as tests, because the lazy creation of strategies mean that the function body is never actually executed!
Hypothesis can now show statistics when running under pytest-xdist. Previously, statistics were only reported when all tests were run in a single proc
Hypothesis can now show statistics when running under pytest-xdist. Previously, statistics were only reported when all tests were run in a single process (700).
This patch fixes 1667, where passing bounds of Numpy dtype int64 to ~hypothesis.strategies.integers could cause errors on Python 3 due to internal rou
This patch fixes 1667, where passing bounds of Numpy dtype int64 to ~hypothesis.strategies.integers could cause errors on Python 3 due to internal rounding.
Hypothesis now seeds and resets the global state of np.random for each test case, to ensure that tests are reproducible.
Hypothesis now seeds and resets the global state of np.random for each test case, to ensure that tests are reproducible.
This matches and complements the existing handling of the python:random module - Numpy simply maintains an independent PRNG for performance reasons.
This is a no-op release to add the new Framework :: Hypothesis trove classifier _ to hypothesis on PyPI.
This is a no-op release to add the new Framework :: Hypothesis trove classifier to hypothesis on PyPI.
You can use it as a filter to find Hypothesis-related packages such as extensions as they add the tag over the coming weeks, or simply visit our curated list.
The Hypothesis for Pandas extension is now listed in setup.py, so you can pip install hypothesis[pandas]. Thanks to jmshi for this contribution.
The Hypothesis for Pandas extension is now listed in setup.py, so you can pip install hypothesis[pandas]. Thanks to jmshi for this contribution.
This patch fixes ~hypothesis.strategies.from_type on Python 2 for classes where cls.__init__ is object.__init__. Thanks to ccxcz for reporting 1656.
This patch fixes ~hypothesis.strategies.from_type on Python 2 for classes where cls.__init__ is object.__init__. Thanks to ccxcz for reporting 1656.
…within the function. Passing None is therefore deprecated.
The alphabet argument for ~hypothesis.strategies.text now uses its default value of characters(exclude_categories=('Cs',)) directly, instead of hiding that behind alphabet=None and replacing it within the function. Passing None is therefore deprecated.
GenericStateMachine and ~hypothesis.stateful.RuleBasedStateMachine now raise an explicit error when instances of ~hypothesis.settings are assigned to
GenericStateMachine and ~hypothesis.stateful.RuleBasedStateMachine now raise an explicit error when instances of ~hypothesis.settings are assigned to the classes' settings attribute, which is a no-op (1643). Instead assign to SomeStateMachine.TestCase.settings, or use @settings(...) as a class decorator to handle this automatically.
GenericStateMachine and RuleBasedStateMachine now raise an explicit error when instances of settings are assigned to the classes’ settings attribute, which is a no-op ( issue #1643 ). Instead assign to SomeStateMachine.TestCase.settings , or use @settings(...) as a class decorator to handle this automatically.
Since version 3.68.0 , ~hypothesis.extra.numpy.arrays checks that values drawn from the elements and fill strategies can be safely cast to the dtype o
Since version 3.68.0, ~hypothesis.extra.numpy.arrays checks that values drawn from the elements and fill strategies can be safely cast to the dtype of the array, and emits a warning otherwise.
This release expands the checks to cover overflow for finite complex64 elements and string truncation caused by too-long elements or trailing null characters (1591).
Tests using @given now shrink errors raised from pytest helper functions, instead of reporting the first example found.
Tests using @given now shrink errors raised from pytest helper functions, instead of reporting the first example found.
This was previously fixed in version 3.56.0, but only for stateful testing.
Traceback elision is now disabled on Python 2, to avoid an import-time python:SyntaxError under Python < 2.7.9 (Python: 21591, Hypothesis 3.79.2 : 164
Traceback elision is now disabled on Python 2, to avoid an import-time python:SyntaxError under Python < 2.7.9 (Python: 21591, Hypothesis 3.79.2: 1648).
We encourage all users to upgrade to Python 3 before the end of 2019.
Traceback elision is now disabled on Python 2, to avoid an import-time SyntaxError under Python < 2.7.9 (Python: bpo-21591 , Hypothesis 3.79.2 : issue #1648 ).
We encourage all users to upgrade to Python 3 before the end of 2019 .
This patch shortens tracebacks from Hypothesis, so you can see exactly happened in your code without having to skip over irrelevant details about our
This patch shortens tracebacks from Hypothesis, so you can see exactly happened in your code without having to skip over irrelevant details about our internals (848).
In the example test (see 1582), this reduces tracebacks from nine frames to just three - and for a test with multiple errors, from seven frames per error to just one!
If you do want to see the internal details, you can disable frame elision by setting ~hypothesis.settings.verbosity to debug.
The abstract number classes ~python:numbers.Number, ~python:numbers.Complex, ~python:numbers.Real, ~python:numbers.Rational, and ~python:numbers.Integ
The abstract number classes ~python:numbers.Number, ~python:numbers.Complex, ~python:numbers.Real, ~python:numbers.Rational, and ~python:numbers.Integral are now supported by the ~hypothesis.strategies.from_type strategy. Previously, you would have to use ~hypothesis.strategies.register_type_strategy before they could be resolved (1636)
The abstract number classes Number , Complex , Real , Rational , and Integral are now supported by the from_type() strategy. Previously, you would have to use register_type_strategy() before they could be resolved ( issue #1636 )
This release adds a CLI flag for verbosity --hypothesis-verbosity to the Hypothesis pytest plugin, applied after loading the profile specified by --hy
This release adds a CLI flag for verbosity --hypothesis-verbosity to the Hypothesis pytest plugin, applied after loading the profile specified by --hypothesis-profile. Valid options are the names of verbosity settings, quiet, normal, verbose or debug.
Thanks to Bex Dunn for writing this patch at the PyCon Australia sprints!
The pytest header now correctly reports the current profile if --hypothesis-profile has been used.
Thanks to Mathieu Paturel for the contribution at the Canberra Python Hacktoberfest.
This release has deprecated the generation of integers, floats and fractions when the conversion of the upper and/ or lower bound is not 100% exact, e…
This release has deprecated the generation of integers, floats and fractions when the conversion of the upper and/ or lower bound is not 100% exact, e.g. when an integer gets passed a bound that is not a whole number. (1625)
Thanks to Felix Grünewald for this patch during Hacktoberfest 2018.
This minor release adds functionality to ~hypothesis.settings allowing it to be used as a decorator on ~hypothesis.stateful.RuleBasedStateMachine and
This minor release adds functionality to ~hypothesis.settings allowing it to be used as a decorator on ~hypothesis.stateful.RuleBasedStateMachine and GenericStateMachine.
Thanks to Tyler Nickerson for this feature in #hacktoberfest!
This minor release adds functionality to settings allowing it to be used as a decorator on RuleBasedStateMachine and GenericStateMachine .
Thanks to Tyler Nickerson for this feature in #hacktoberfest!
This patch fixes some warnings added by recent releases of pydocstyle and mypy.
This patch fixes some warnings added by recent releases of pydocstyle and mypy.
This release deprecates using floats for min_size and max_size.
This release deprecates using floats for min_size and max_size.
The type hint for average_size arguments has been changed from Optional[int] to None, because non-None values are always ignored and deprecated.
This patch adds more internal comments to the core engine's sequence-length shrinker. There should be no user-visible change.
This patch adds more internal comments to the core engine's sequence-length shrinker. There should be no user-visible change.
This patch adds additional comments to some of the core engine's internal data structures. There is no user-visible change.
This patch adds additional comments to some of the core engine's internal data structures. There is no user-visible change.
This patch avoids caching a trivial case, fixing 493.
This patch avoids caching a trivial case, fixing 493.
This patch fixes a broken link in a docstring. Thanks to Benjamin Lee for this contribution!
This patch fixes a broken link in a docstring. Thanks to Benjamin Lee for this contribution!
Your coding agent can read these notes before it upgrades. Set up the MCP server →