NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #539 most downloaded on PyPI
The property-based testing library for Python
Last release 4 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 allows strategy-generating functions registered with ~hypothesis.strategies.register_type_strategy to conditionally not return a strategy
This release allows strategy-generating functions registered with ~hypothesis.strategies.register_type_strategy to conditionally not return a strategy, by returning NotImplemented (3767).
This release allows strategy-generating functions registered with register_type_strategy() to conditionally not return a strategy, by returning NotImplemented ( issue #3767 ).
When ~hypothesis.strategies.randoms was called with use_true_randoms=False, calling r.sample([], 0) would result in an error, when it should have retu
When ~hypothesis.strategies.randoms was called with use_true_randoms=False, calling r.sample([], 0) would result in an error, when it should have returned an empty sequence to agree with the normal behaviour of random.sample. This fixes that discrepancy (3765).
One column per quarter.
This patch ensures that the hypothesis codemod CLI will print a warning instead of stopping with an internal error if one of your files contains inval
This patch ensures that the hypothesis codemod CLI will print a warning instead of stopping with an internal error if one of your files contains invalid syntax (3759).
This patch makes some small changes to our NumPy integration to ensure forward compatibility. Thanks to Mateusz Sokół for 3761.
This patch makes some small changes to our NumPy integration to ensure forward compatibility. Thanks to Mateusz Sokół for 3761.
Fixes 3755, where an internal condition turns out to be reachable after all.
Fixes 3755, where an internal condition turns out to be reachable after all.
This release deprecates use of ~hypothesis.assume and reject() outside of property-based tests, because these functions work by raising a special exce…
This release deprecates use of ~hypothesis.assume and reject() outside of property-based tests, because these functions work by raising a special exception (3743). It also fixes some type annotations (3753).
Hotfix for 3747, a bug in explain mode which is so rare that we missed it in six months of dogfooding. Thanks to mygrad for discovering and promptly r
Hotfix for 3747, a bug in explain mode which is so rare that we missed it in six months of dogfooding. Thanks to mygrad for discovering and promptly reporting this!
This patch improves the documentation of @example(...).xfail() by adding a note about 614, similar to @example(...).via() , and adds a warning when a
This patch improves the documentation of @example(...).xfail() by adding a note about 614, similar to @example(...).via(), and adds a warning when a strategy generates a test case which seems identical to one provided by an xfailed example.
This release enables the |Phase.explain| phase by default. We hope it helps you to understand *why* your failing tests have failed!
This release enables the |Phase.explain| phase by default. We hope it helps you to understand why your failing tests have failed!
This patch switches some of our type annotations to use typing.Literal when only a few specific values are allowed, such as UUID or IP address version
This patch switches some of our type annotations to use typing.Literal when only a few specific values are allowed, such as UUID or IP address versions.
This release deprecates the old whitelist/blacklist arguments to ~hypothesis.strategies.characters, in favor of include/exclude arguments which more c…
This release deprecates the old whitelist/blacklist arguments to ~hypothesis.strategies.characters, in favor of include/exclude arguments which more clearly describe their effects on the set of characters which can be generated.
You can use Hypothesis' codemods to automatically upgrade to the new argument names. In a future version, the old names will start to raise a DeprecationWarning.
This patch automatically disables the ~hypothesis.HealthCheck.differing_executors health check for methods which are also pytest parametrized tests, b
This patch automatically disables the ~hypothesis.HealthCheck.differing_executors health check for methods which are also pytest parametrized tests, because those were mostly false alarms (3733).
Building on recent releases, ~hypothesis.strategies.characters now accepts _any_ codec=, not just "utf-8" and "ascii".
Building on recent releases, ~hypothesis.strategies.characters now accepts _any_ codec=, not just "utf-8" and "ascii".
This includes standard codecs from the codecs module and their aliases, platform specific and user-registered codecs if they are available, and python-specific text encodings (but not text transforms or binary transforms).
This patch by Reagan Lee makes st.text(...).filter(str.isidentifier) return an efficient custom strategy (3480).
This patch by Reagan Lee makes st.text(...).filter(str.isidentifier) return an efficient custom strategy (3480).
The ~hypothesis.strategies.from_regex strategy now takes an optional alphabet=characters(codec="utf-8") argument for unicode strings, like ~hypothesis
The ~hypothesis.strategies.from_regex strategy now takes an optional alphabet=characters(codec="utf-8") argument for unicode strings, like ~hypothesis.strategies.text.
This offers more and more-consistent control over the generated strings, removing previously-hard-coded limitations. With fullmatch=False and alphabet=characters(), surrogate characters are now possible in leading and trailing text as well as the body of the match. Negated character classes such as [^A-Z] or \S had a hard-coded exclusion of control characters and surrogate characters; now they permit anything in alphabet= consistent with the class, and control characters are permitted by default.
Add a health check that detects if the same test is executed several times by different executors . This can lead to difficult-to-debug problems such
Add a health check that detects if the same test is executed several times by different executors. This can lead to difficult-to-debug problems such as 3446.
Pretty-printing of failing examples can now use functions registered with IPython.lib.pretty.for_type or ~IPython.lib.pretty.for_type_by_name, as well
Pretty-printing of failing examples can now use functions registered with IPython.lib.pretty.for_type or ~IPython.lib.pretty.for_type_by_name, as well as restoring compatibility with _repr_pretty_ callback methods which were accidentally broken in version 6.61.2 (3721).
Adds a new codec= option in ~hypothesis.strategies.characters, making it convenient to produce only characters which can be encoded as ascii or utf-8
Adds a new codec= option in ~hypothesis.strategies.characters, making it convenient to produce only characters which can be encoded as ascii or utf-8 bytestrings.
Support for other codecs will be added in a future release.
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 patch enables and fixes many more of ruff\ 's lint rules.
This patch enables and fixes many more of ruff's lint rules.
Fixes the error message for missing [cli] extra.
Fixes the error message for missing [cli] extra.
This patch ensures that we always close the download connection in ~hypothesis.database.GitHubArtifactDatabase.
This patch ensures that we always close the download connection in ~hypothesis.database.GitHubArtifactDatabase.
We can now pretty-print combinations of *zero* enum.Flag values, like SomeFlag(0), which has never worked before.
We can now pretty-print combinations of zero enum.Flag values, like SomeFlag(0), which has never worked before.
This patch fixes pretty-printing of combinations of enum.Flag values, which was previously an error (3709).
This patch fixes pretty-printing of combinations of enum.Flag values, which was previously an error (3709).
Improve shrinking of floats in narrow regions that don't cross an integer boundary. Closes 3357.
Improve shrinking of floats in narrow regions that don't cross an integer boundary. Closes 3357.
~hypothesis.strategies.from_regex now supports the atomic grouping ((?>...)) and possessive quantifier (*+, ++, ?+, {m,n}+) syntax added in Python 3.1
~hypothesis.strategies.from_regex now supports the atomic grouping ((?>...)) and possessive quantifier (*+, ++, ?+, {m,n}+) syntax added in Python 3.11.
Thanks to Cheuk Ting Ho for implementing this!
If the HYPOTHESIS_NO_PLUGINS environment variable is set, we'll avoid loading plugins such as the old Pydantic integration __ or HypoFuzz' CLI options
If the HYPOTHESIS_NO_PLUGINS environment variable is set, we'll avoid loading plugins such as the old Pydantic integration or HypoFuzz' CLI options.
This is probably only useful for our own self-tests, but documented in case it might help narrow down any particularly weird bugs in complex environments.
Fixes some lingering issues with inference of recursive types in ~hypothesis.strategies.from_type. Closes 3525.
Fixes some lingering issues with inference of recursive types in ~hypothesis.strategies.from_type. Closes 3525.
Fixes some lingering issues with inference of recursive types in from_type() . Closes issue #3525 .
This release further improves our .patch-file support from version 6.75 , skipping duplicates, tests which use ~hypothesis.strategies.data (and don't
This release further improves our .patch-file support from version 6.75, skipping duplicates, tests which use ~hypothesis.strategies.data (and don't support @example()), and various broken edge-cases.
Because libCST has released version 1.0 which uses the native parser by default, we no longer set the LIBCST_PARSER_TYPE=native environment variable. If you are using an older version, you may need to upgrade or set this envvar for yourself.
This patch updates some internal code for selftests. There is no user-visible change.
This patch updates some internal code for selftests. There is no user-visible change.
This release drops support for Python 3.7, which reached end of life on 2023-06-27 __.
This release drops support for Python 3.7, which reached end of life on 2023-06-27.
Fixes occasional recursion-limit-exceeded errors when validating deeply nested strategies. Closes: 3671
Fixes occasional recursion-limit-exceeded errors when validating deeply nested strategies. Closes: 3671
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.
Improve the type rendered in ~hypothesis.strategies.from_type, which improves the coverage of Ghostwriter.
Improve the type rendered in ~hypothesis.strategies.from_type, which improves the coverage of Ghostwriter.
Improve the type rendered in from_type() , which improves the coverage of Ghostwriter.
We now test against Python 3.12 beta in CI, and this patch fixes some new deprecations.
We now test against Python 3.12 beta in CI, and this patch fixes some new deprecations.
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.
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).
Your coding agent can read these notes before it upgrades. Set up the MCP server →