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 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.
One column per quarter.
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.
This patch uses autoflake to remove some pointless pass statements, which improves our workflow but has no user-visible impact.
This patch uses autoflake to remove some pointless pass statements, which improves our workflow but has no user-visible impact.
This patch fixes an OverflowError in from_type(xrange) on Python 2.
This patch fixes an OverflowError in from_type(xrange) on Python 2.
It turns out that not only do the start and stop values have to fit in a C long, but so does stop - start. We now handle this even on 32bit platforms, but remind users that Python2 will not be supported after 2019 without specific funding.
This release implements the ~hypothesis.strategies.slices strategy, to generate slices of a length-size sequence.
This release implements the ~hypothesis.strategies.slices strategy, to generate slices of a length-size sequence.
Thanks to Daniel J. West for writing this patch at the PyCon 2019 sprints!
This patch exposes ~hypothesis.strategies.DataObject, *solely* to support more precise type hints. Objects of this type are provided by ~hypothesis.st
This patch exposes ~hypothesis.strategies.DataObject, solely to support more precise type hints. Objects of this type are provided by ~hypothesis.strategies.data, and can be used to draw examples from strategies intermixed with your test code.
This patch exposes DataObject , solely to support more precise type hints. Objects of this type are provided by data() , and can be used to draw examples from strategies intermixed with your test code.
This patch fixes the very rare 1798 in ~hypothesis.extra.numpy.array_dtypes, which caused an internal error in our tests.
This patch fixes the very rare 1798 in ~hypothesis.extra.numpy.array_dtypes, which caused an internal error in our tests.
This patch fixes the very rare issue #1798 in array_dtypes() , which caused an internal error in our tests.
This patch fixes a rare bug in from_type(range) .
This patch fixes a rare bug in from_type(range).
Thanks to Zebulun Arendsee for fixing the bug at the PyCon 2019 Sprints.
The unique_by argument to ~hypothesis.strategies.lists now accepts a tuple of callables such that every element of the generated list will be unique w
The unique_by argument to ~hypothesis.strategies.lists now accepts a tuple of callables such that every element of the generated list will be unique with respect to each callable in the tuple (1916).
Thanks to Marco Sirabella for this feature at the PyCon 2019 sprints!
This patch cleans up the internals of ~hypothesis.strategies.one_of. You may see a slight change to the distribution of examples from this strategy bu
This patch cleans up the internals of ~hypothesis.strategies.one_of. You may see a slight change to the distribution of examples from this strategy but there is no change to the public API.
Thanks to Marco Sirabella for writing this patch at the PyCon 2019 sprints!
The ~hypothesis.strategies.from_type strategy now supports python:slice objects.
The ~hypothesis.strategies.from_type strategy now supports python:slice objects.
Thanks to Charlie El. Awbery for writing this feature at the PyCon 2019 Mentored Sprints.
The from_type() strategy now supports slice objects.
Thanks to Charlie El. Awbery for writing this feature at the PyCon 2019 Mentored Sprints .
This release improves the ~hypothesis.extra.numpy.array_shapes strategy, to choose an appropriate default for max_side based on the min_side, and max_
This release improves the ~hypothesis.extra.numpy.array_shapes strategy, to choose an appropriate default for max_side based on the min_side, and max_dims based on the min_dims. An explicit error is raised for dimensions greater than 32, which are not supported by Numpy, as for other invalid combinations of arguments.
Thanks to Jenny Rouleau for writing this feature at the PyCon 2019 Mentored Sprints.
The ~hypothesis.strategies.from_type strategy now supports python:range objects (or xrange on Python 2).
The ~hypothesis.strategies.from_type strategy now supports python:range objects (or xrange on Python 2).
Thanks to Katrina Durance for writing this feature at the PyCon 2019 Mentored Sprints.
The from_type() strategy now supports range objects (or xrange on Python 2).
Thanks to Katrina Durance for writing this feature at the PyCon 2019 Mentored Sprints .
This release fixes a very rare edge case in the test-case mutator, which could cause an internal error with certain unusual tests.
This release fixes a very rare edge case in the test-case mutator, which could cause an internal error with certain unusual tests.
This patch makes Hypothesis compatible with the Python 3.8 alpha, which changed the representation of code objects to support positional-only argument
This patch makes Hypothesis compatible with the Python 3.8 alpha, which changed the representation of code objects to support positional-only arguments. Note however that Hypothesis does not (yet) support such functions as e.g. arguments to ~hypothesis.strategies.builds or inputs to @given.
Thanks to Paul Ganssle for identifying and fixing this bug.
This patch improves the performance of unique collections such as ~hypothesis.strategies.sets when the elements are drawn from a ~hypothesis.strategie
This patch improves the performance of unique collections such as ~hypothesis.strategies.sets when the elements are drawn from a ~hypothesis.strategies.sampled_from strategy (1115).
This patch improves the performance of unique collections such as sets() when the elements are drawn from a sampled_from() strategy ( issue #1115 ).
This release adds the ~hypothesis.strategies.functions strategy, which can be used to imitate your 'real' function for callbacks.
This release adds the ~hypothesis.strategies.functions strategy, which can be used to imitate your 'real' function for callbacks.
This release adds the functions() strategy, which can be used to imitate your ‘real’ function for callbacks.
This release refactors stateful rule selection to share the new machinery with ~hypothesis.strategies.sampled_from instead of using the original indep
This release refactors stateful rule selection to share the new machinery with ~hypothesis.strategies.sampled_from instead of using the original independent implementation.
This release refactors stateful rule selection to share the new machinery with sampled_from() instead of using the original independent implementation.
This patch allows Hypothesis to try a few more examples after finding the first bug, in hopes of reporting multiple distinct bugs. The heuristics desc
This patch allows Hypothesis to try a few more examples after finding the first bug, in hopes of reporting multiple distinct bugs. The heuristics described in 847 ensure that we avoid wasting time on fruitless searches, while still surfacing each bug as soon as possible.
This release adds the strategy ~hypothesis.extra.numpy.broadcastable_shapes, which generates array shapes that are broadcast-compatible _ with a provi
This release adds the strategy ~hypothesis.extra.numpy.broadcastable_shapes, which generates array shapes that are broadcast-compatible with a provided shape.
This release adds the strategy broadcastable_shapes() , which generates array shapes that are broadcast-compatible with a provided shape.
This release allows ~hypothesis.strategies.register_type_strategy to be used with python:typing.NewType instances. This may be useful to e.g. provide
This release allows ~hypothesis.strategies.register_type_strategy to be used with python:typing.NewType instances. This may be useful to e.g. provide only positive integers for from_type(UserId) with a UserId = NewType('UserId', int) type.
Thanks to PJCampi for suggesting and writing the patch!
This release supports passing a ~python:datetime.timedelta as the ~hypothesis.settings.deadline setting, so you no longer have to remember that the nu
This release supports passing a ~python:datetime.timedelta as the ~hypothesis.settings.deadline setting, so you no longer have to remember that the number is in milliseconds (1900).
Thanks to Damon Francisco for this change!
This release supports passing a timedelta as the deadline setting, so you no longer have to remember that the number is in milliseconds ( issue #1900 ).
Thanks to Damon Francisco for this change!
This patch makes the type annotations on hypothesis.extra.dateutil compatible with mypy 0.700.
This patch makes the type annotations on hypothesis.extra.dateutil compatible with mypy 0.700.
This release fixes a bug introduced in Hypothesis 4.14.3 that would sometimes cause sampled_from(...).filter(...) to encounter an internal assertion f
This release fixes a bug introduced in Hypothesis 4.14.3 that would sometimes cause sampled_from(...).filter(...) to encounter an internal assertion failure when there are three or fewer elements, and every element is rejected by the filter.
This patch takes the previous efficiency improvements to sampled_from(...).filter(...) strategies that reject most elements, and generalises them to a
This patch takes the previous efficiency improvements to sampled_from(...).filter(...) strategies that reject most elements, and generalises them to also apply to sampled_from(...).filter(...).filter(...) and longer chains of filters.
Your coding agent can read these notes before it upgrades. Set up the MCP server →