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.17
Last release today
20 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
1596 releases · first in 2013
Drag across the ruler to compare, or tap a release to open it.
This release changes ~hypothesis.strategies.register_type_strategy for compatibility with 585: we now store only a single strategy or resolver functio
This release changes ~hypothesis.strategies.register_type_strategy for compatibility with 585: we now store only a single strategy or resolver function which is used for both the builtin and the typing module version of each type (3635).
If you previously relied on registering separate strategies for e.g. list vs typing.List, you may need to use explicit strategies rather than inferring them from types.
This release ensures that Ghostwriter does not use the deprecated aliases for the collections.abc classes in collections.
This release ensures that Ghostwriter does not use the deprecated aliases for the collections.abc classes in collections.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
This patch improves Ghostwriter's use of qualified names for re-exported functions and classes, and avoids importing useless ~typing.TypeVar\ s.
This patch improves Ghostwriter's use of qualified names for re-exported functions and classes, and avoids importing useless ~typing.TypeVars.
This patch improves Ghostwriter’s use of qualified names for re-exported functions and classes, and avoids importing useless TypeVar s.
This patch updates our vendored list of top-level domains __, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch updates our vendored list of top-level domains, which is used by the provisional ~hypothesis.provisional.domains strategy.
New input validation for ~hypothesis.strategies.recursive will raise an error rather than hanging indefinitely if passed invalid max_leaves= arguments
New input validation for ~hypothesis.strategies.recursive will raise an error rather than hanging indefinitely if passed invalid max_leaves= arguments.
New input validation for recursive() will raise an error rather than hanging indefinitely if passed invalid max_leaves= arguments.
~hypothesis.strategies.from_type now handles numpy array types: np.typing.ArrayLike , np.typing.NDArray , and parameterized versions including np.ndar
~hypothesis.strategies.from_type now handles numpy array types: np.typing.ArrayLike, np.typing.NDArray, and parameterized versions including np.ndarray[shape, elem_type].
Warn in ~hypothesis.strategies.from_type if the inferred strategy has no variation (always returning default instances). Also handles numpy data types
Warn in ~hypothesis.strategies.from_type if the inferred strategy has no variation (always returning default instances). Also handles numpy data types by calling ~hypothesis.extra.numpy.from_dtype on the corresponding dtype, thus ensuring proper variation for these types.
Warn in from_type() if the inferred strategy has no variation (always returning default instances). Also handles numpy data types by calling from_dtype() on the corresponding dtype, thus ensuring proper variation for these types.
~hypothesis.strategies.from_type now works in cases where we use ~hypothesis.strategies.builds to create an instance and the constructor has an argume
~hypothesis.strategies.from_type now works in cases where we use ~hypothesis.strategies.builds to create an instance and the constructor has an argument which would lead to recursion. Previously, this would raise an error if the argument had a default value.
Thanks to Joachim B Haga for reporting and fixing this problem.
In preparation for supporting JAX in hypothesis.extra.array_api , this release supports immutable arrays being generated via xps.arrays. In particular
In preparation for supporting JAX in hypothesis.extra.array_api, this release supports immutable arrays being generated via xps.arrays. In particular, we internally removed an instance of in-place array modification, which isn't possible for an immutable array.
This release fixes some .patch-file bugs from version 6.75 , and adds automatic support for writing @hypothesis.example() or @example() depending on t
This release fixes some .patch-file bugs from version 6.75, and adds automatic support for writing @hypothesis.example() or @example() depending on the current style in your test file - defaulting to the latter.
Note that this feature requires libcst to be installed, and black is strongly recommended. You can ensure you have the dependencies with pip install "hypothesis[cli,codemods]".
This patch continues the work started in 3651 by adding ruff linter rules for pyflakes, flake8-comprehensions, and flake8-implicit-str-concat.
This patch continues the work started in 3651 by adding ruff linter rules for pyflakes, flake8-comprehensions, and flake8-implicit-str-concat.
This patch updates our linter stack to use ruff, and fixes some previously-ignored lints. Thanks to Christian Clauss for his careful review and 3651!
This patch updates our linter stack to use ruff, and fixes some previously-ignored lints. Thanks to Christian Clauss for his careful review and 3651!
Hypothesis will now record an event for more cases where data is marked invalid, including for exceeding the internal depth limit.
Hypothesis will now record an event for more cases where data is marked invalid, including for exceeding the internal depth limit.
This patch fixes ~hypothesis.strategies.complex_numbers accidentally invalidating itself when passed magnitude arguments for 32 and 64-bit widths, i.e
This patch fixes ~hypothesis.strategies.complex_numbers accidentally invalidating itself when passed magnitude arguments for 32 and 64-bit widths, i.e. 16- and 32-bit floats, due to not internally down-casting numbers (3573).
Improved the documentation regarding how to use ~hypothesis.database.GitHubArtifactDatabase and fixed a bug that occurred in repositories with no exis
Improved the documentation regarding how to use ~hypothesis.database.GitHubArtifactDatabase and fixed a bug that occurred in repositories with no existing artifacts.
Thanks to Agustín Covarrubias for this contribution.
hypothesis.errors will now raise exc:AttributeError when attempting to access an undefined attribute, rather than returning obj:None.
hypothesis.errors will now raise AttributeError when attempting to access an undefined attribute, rather than returning None.
Sick of adding @example() \ s by hand? Our Pytest plugin now writes .patch files to insert them for you, making this workflow __ easier than ever befo
Sick of adding @example()s by hand? Our Pytest plugin now writes .patch files to insert them for you, making this workflow easier than ever before.
Note that you'll need LibCST (via codemods), and that @example().via() requires 614 (Python 3.9 or later).
Sick of adding @example() s by hand? Our Pytest plugin now writes .patch files to insert them for you, making this workflow easier than ever before.
Note that you’ll need LibCST (via hypothesis[codemods] ), and that @example().via() requires PEP 614 (Python 3.9 or later).
This patch provides better error messages for datetime- and timedelta-related invalid dtypes in our Pandas extra (3518). Thanks to Nick Muoh at the Py
This patch provides better error messages for datetime- and timedelta-related invalid dtypes in our Pandas extra (3518). Thanks to Nick Muoh at the PyCon Sprints!
This release adds support for nullable pandas dtypes __ in ~hypothesis.extra.pandas (3604). Thanks to Cheuk Ting Ho for implementing this at the PyCon
This release adds support for nullable pandas dtypes in ~hypothesis.extra.pandas (3604). Thanks to Cheuk Ting Ho for implementing this at the PyCon sprints!
This patch updates our minimum Numpy version to 1.16, and restores compatibility with versions before 1.20, which were broken by a mistake in Hypothes
This patch updates our minimum Numpy version to 1.16, and restores compatibility with versions before 1.20, which were broken by a mistake in Hypothesis 6.72.4 (3625).
This patch fixes type annotations for the ~hypothesis.extra.numpy.arrays strategy. Thanks to Francesc Elies for 3602.
This patch fixes type annotations for the ~hypothesis.extra.numpy.arrays strategy. Thanks to Francesc Elies for 3602.
This patch fixes type annotations for the arrays() strategy. Thanks to Francesc Elies for pull request #3602 .
This patch fixes a bug with ~hypothesis.strategies.from_type() with dict[tuple[int, int], str] (3527). Thanks to Nick Muoh at the PyCon Sprints!
This patch fixes a bug with ~hypothesis.strategies.from_type() with dict[tuple[int, int], str] (3527). Thanks to Nick Muoh at the PyCon Sprints!
This patch refactors our internals to facilitate an upcoming feature.
This patch refactors our internals to facilitate an upcoming feature.
This patch fixes some documentation and prepares for future features.
This patch fixes some documentation and prepares for future features.
This release deprecates Healthcheck.all(), and adds a codemod to automatically replace it with list(Healthcheck) (3596).
This release deprecates Healthcheck.all(), and adds a codemod to automatically replace it with list(Healthcheck) (3596).
This release adds ~hypothesis.database.GitHubArtifactDatabase, a new database backend that allows developers to access the examples found by a Github
This release adds ~hypothesis.database.GitHubArtifactDatabase, a new database backend that allows developers to access the examples found by a Github Actions CI job. This is particularly useful for workflows that involve continuous fuzzing, like HypoFuzz.
Thanks to Agustín Covarrubias for this feature!
This patch clarifies the reporting of time spent generating data. A simple arithmetic mean of the percentage of time spent can be misleading; reportin
This patch clarifies the reporting of time spent generating data. A simple arithmetic mean of the percentage of time spent can be misleading; reporting the actual time spent avoids misunderstandings.
Thanks to Andrea Reina for reporting and fixing 3598!
This patch updates our vendored list of top-level domains __, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch updates our vendored list of top-level domains, which is used by the provisional ~hypothesis.provisional.domains strategy.
This release adds an optional domains= parameter to the ~hypothesis.strategies.emails strategy, and excludes the special-use .arpa domain from the def
This release adds an optional domains= parameter to the ~hypothesis.strategies.emails strategy, and excludes the special-use .arpa domain from the default strategy (3567).
Thanks to Jens Tröger for reporting and fixing this bug!
Passing them to suppress_health_check= is therefore a deprecated no-op. (3568). Thanks to Reagan Lee for the patch!
This release turns HealthCheck.return_value and HealthCheck.not_a_test_method into unconditional errors. Passing them to suppress_health_check= is therefore a deprecated no-op. (3568). Thanks to Reagan Lee for the patch!
Separately, GraalPy can now run and pass most of the hypothesis test suite (3587).
This patch updates our vendored list of top-level domains __, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch updates our vendored list of top-level domains, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch fixes missing imports of the re module, when ghostwriting tests which include compiled patterns or regex flags. Thanks to Jens Heinrich for
This patch fixes missing imports of the re module, when ghostwriting tests which include compiled patterns or regex flags. Thanks to Jens Heinrich for reporting and promptly fixing this bug!
This patch adds some private hooks for use in research on Schemathesis __ (see our preprint here __).
This patch adds some private hooks for use in research on Schemathesis (see our preprint here).
Additionally this release now treats hypothesis.extra.array_api as stable, meaning breaking changes should only happen with major releases of Hypothes…
This release adds support for the Array API's 2022.12 release via the api_version argument in ~hypothesis.extra.array_api.make_strategies_namespace. Concretely this involves complex support in its existing strategies, plus an introduced xps.complex_dtypes strategy.
Additionally this release now treats hypothesis.extra.array_api as stable, meaning breaking changes should only happen with major releases of Hypothesis.
This patch updates our autoformatting tools, improving our code style without any API changes.
This patch updates our autoformatting tools, improving our code style without any API changes.
This release allows for more precise generation of complex numbers using ~hypothesis.extra.numpy.from_dtype, by supporting the width, min_magnitude, a
This release allows for more precise generation of complex numbers using ~hypothesis.extra.numpy.from_dtype, by supporting the width, min_magnitude, and min_magnitude arguments (3468).
Thanks to Felix Divo for this feature!
This patch fixes a rare RecursionError when pretty-printing a multi-line object without type-specific printer, which was passed to a function which re
This patch fixes a rare RecursionError when pretty-printing a multi-line object without type-specific printer, which was passed to a function which returned the same object by .map() or ~hypothesis.strategies.builds and thus recursed due to the new pretty reprs in Hypothesis v6.65.0 (3560). Apologies to all those affected.
This patch fixes a rare RecursionError when pretty-printing a multi-line object without type-specific printer, which was passed to a function which returned the same object by .map() or builds() and thus recursed due to the new pretty reprs in Hypothesis 6.65.0 - 2023-01-24 ( issue #3560 ). Apologies to all those affected.
This makes ~hypothesis.extra.numpy.from_dtype pass through the parameter allow_subnormal for complex dtypes.
This makes ~hypothesis.extra.numpy.from_dtype pass through the parameter allow_subnormal for complex dtypes.
This makes from_dtype() pass through the parameter allow_subnormal for complex dtypes.
This release adds a width parameter to ~hypothesis.strategies.complex_numbers, analogously to ~hypothesis.strategies.floats.
This release adds a width parameter to ~hypothesis.strategies.complex_numbers, analogously to ~hypothesis.strategies.floats.
Thanks to Felix Divo for the new feature!
This release adds a width parameter to complex_numbers() , analogously to floats() .
Thanks to Felix Divo for the new feature!
This patch fixes invalid annotations detected for the tests generated by Ghostwriter . It will now correctly generate Optional types with just one typ
This patch fixes invalid annotations detected for the tests generated by Ghostwriter. It will now correctly generate Optional types with just one type argument and handle union expressions inside of type arguments correctly. Additionally, it now supports code with the from __future__ import annotations marker for Python 3.10 and newer.
This release improves the pretty-printing of enums in falsifying examples, so that they print as their full identifier rather than their repr.
This release improves the pretty-printing of enums in falsifying examples, so that they print as their full identifier rather than their repr.
Hypothesis now reports some failing inputs by showing the call which constructed an object, rather than the repr of the object. This can be helpful wh
Hypothesis now reports some failing inputs by showing the call which constructed an object, rather than the repr of the object. This can be helpful when the default repr does not include all relevant details, and will unlock further improvements in a future version.
For now, we capture calls made via ~hypothesis.strategies.builds, and via |.map|.
The Ghostwriter will now include type annotations on tests for type-annotated code. If you want to force this to happen (or not happen), pass a boolea
The Ghostwriter will now include type annotations on tests for type-annotated code. If you want to force this to happen (or not happen), pass a boolean to the new annotate= argument to the Python functions, or the --[no-]annotate CLI flag.
Thanks to Nicolas Ganz for this new feature!
~hypothesis.extra.pandas.range_indexes now accepts a name= argument, to generate named pandas.RangeIndex objects.
~hypothesis.extra.pandas.range_indexes now accepts a name= argument, to generate named pandas.RangeIndex objects.
Thanks to Sam Watts for this new feature!
This patch tweaks xps.arrays internals to improve PyTorch compatibility. Specifically, torch.full() does not accept integers as the shape argument (n.
This patch tweaks xps.arrays internals to improve PyTorch compatibility. Specifically, torch.full() does not accept integers as the shape argument (n.b. technically "size" in torch), but such behaviour is expected in internal code, so we copy the torch module and patch in a working full() function.
A classic error when testing is to write a test function that can never fail, even on inputs that aren't allowed or manually provided. By analogy to t
A classic error when testing is to write a test function that can never fail, even on inputs that aren't allowed or manually provided. By analogy to the design pattern of:
@pytest.mark.parametrize("arg", [
..., # passing examples
pytest.param(..., marks=[pytest.mark.xfail]) # expected-failing input
])
we now support @example(...).xfail(), with the same (optional) condition, reason, and raises arguments as pytest.mark.xfail().
Naturally you can also write .via(...).xfail(...), or .xfail(...).via(...), if you wish to note the provenance of expected-failing examples.
This patch teaches our enhanced ~typing.get_type_hints function to 'see through' ~functools.partial application, allowing inference from type hints to
This patch teaches our enhanced ~typing.get_type_hints function to 'see through' ~functools.partial application, allowing inference from type hints to work in a few more cases which aren't (yet!) supported by the standard-library version.
This patch teaches our enhanced get_type_hints() function to ‘see through’ partial application, allowing inference from type hints to work in a few more cases which aren’t (yet!) supported by the standard-library version.
This patch improves our pretty-printing of failing examples, including some refactoring to prepare for exciting future features.
This patch improves our pretty-printing of failing examples, including some refactoring to prepare for exciting future features.
This patch brings our ~hypothesis.provisional.domains and ~hypothesis.strategies.emails strategies into compliance with RFC RFC 5890 §2.3.1 <5890>: we
This patch brings our ~hypothesis.provisional.domains and ~hypothesis.strategies.emails strategies into compliance with RFC 5890 §2.3.1: we no longer generate parts-of-domains where the third and fourth characters are -- ("R-LDH labels"), though future versions may deliberately generate xn-- punycode labels. Thanks to python-email-validator for the report!
This release improves our treatment of database keys, which based on (among other things) the source code of your test function. We now post-process t
This release improves our treatment of database keys, which based on (among other things) the source code of your test function. We now post-process this source to ignore decorators, comments, trailing whitespace, and blank lines - so that you can add @example()s or make some small no-op edits to your code without preventing replay of any known failing or covering examples.
This patch updates our vendored list of top-level domains __, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch updates our vendored list of top-level domains, which is used by the provisional ~hypothesis.provisional.domains strategy.
This release improves Hypothesis' ability to resolve forward references in type annotations. It fixes a bug that prevented ~hypothesis.strategies.buil
This release improves Hypothesis' ability to resolve forward references in type annotations. It fixes a bug that prevented ~hypothesis.strategies.builds from being used with pydantic models that possess updated forward references. See 3519.
The @example(...) decorator now has a .via() method, which future tools will use to track automatically-added covering examples (3506).
The @example(...) decorator now has a .via() method, which future tools will use to track automatically-added covering examples (3506).
This patch updates our vendored list of top-level domains __, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch updates our vendored list of top-level domains, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch shifts hypothesis[lark] from depending on the old lark-parser package to the new lark package. There are no code changes in Hypothesis, it'
This patch shifts hypothesis[lark] from depending on the old lark-parser package to the new lark package. There are no code changes in Hypothesis, it's just that Lark got a new name on PyPI for version 1.0 onwards.
~hypothesis.register_random has used weakref since v6.27.1, allowing the ~random.Random-compatible objects to be garbage-collected when there are no o
~hypothesis.register_random has used weakref since v6.27.1, allowing the ~random.Random-compatible objects to be garbage-collected when there are no other references remaining in order to avoid memory leaks. We now raise an error or emit a warning when this seems likely to happen immediately.
The type annotation of ~hypothesis.register_random was also widened so that structural subtypes of ~random.Random are accepted by static typecheckers.
register_random() has used weakref since 6.27.1 - 2021-11-22 , allowing the Random -compatible objects to be garbage-collected when there are no other references remaining in order to avoid memory leaks. We now raise an error or emit a warning when this seems likely to happen immediately.
The type annotation of register_random() was also widened so that structural subtypes of Random are accepted by static typecheckers.
This patch updates some internal type annotations and fixes a formatting bug in the ~hypothesis.Phase.explain phase reporting.
This patch updates some internal type annotations and fixes a formatting bug in the ~hypothesis.Phase.explain phase reporting.
This patch updates some internal type annotations and fixes a formatting bug in the explain phase reporting.
Hypothesis now raises an error if you passed a strategy as the alphabet= argument to ~hypothesis.strategies.text, and it generated something which was
Hypothesis now raises an error if you passed a strategy as the alphabet= argument to ~hypothesis.strategies.text, and it generated something which was not a length-one string. This has never been supported, we're just adding explicit validation to catch cases like this StackOverflow question.
This patch updates some docs, and depends on exceptiongroup 1.0.0 final to avoid a bug in the previous version.
This patch updates some docs, and depends on exceptiongroup 1.0.0 final to avoid a bug in the previous version.
This patch teaches ~hypothesis.strategies.text to rewrite a few more filter predicates (3134). You're unlikely to notice any change.
This patch teaches ~hypothesis.strategies.text to rewrite a few more filter predicates (3134). You're unlikely to notice any change.
This patch teaches text() to rewrite a few more filter predicates ( issue #3134 ). You’re unlikely to notice any change.
One column per quarter.