Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update hypothesis to 6.103.3 #7549

Closed
wants to merge 1 commit into from

Conversation

pyup-bot
Copy link
Collaborator

This PR updates hypothesis from 6.92.1 to 6.103.3.

Changelog

6.103.3

--------------------

This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.

6.103.2

--------------------

This patch improves our deduplication tracking across all strategies (:pull:`4007`). Hypothesis is now less likely to generate the same input twice.

6.103.1

--------------------

Account for time spent in garbage collection during tests, to avoid
flaky ``DeadlineExceeded`` errors as seen in :issue:`3975`.

Also fixes overcounting of stateful run times,
a minor observability bug dating to :ref:`version 6.98.9 <v6.98.9>`
(:pull:`3890`).

6.103.0

--------------------

This release migrates the shrinker to our new internal representation, called the IR layer (:pull:`3962`). This improves the shrinker's performance in the majority of cases. For example, on the Hypothesis test suite, shrinking is a median of 1.38x faster.

It is possible this release regresses performance while shrinking certain strategies. If you encounter strategies which reliably shrink more slowly than they used to (or shrink slowly at all), please open an issue!

You can read more about the IR layer at :issue:`3921`.

6.102.6

--------------------

This patch fixes one of our shrinking passes getting into a rare ``O(n)`` case instead of ``O(log(n))``.

6.102.5

--------------------

This patch fixes some introspection errors new in Python 3.11.9 and
3.13.0b1, for the Ghostwriter and :func:`~hypothesis.strategies.from_type`.

6.102.4

--------------------

Internal developer documentation, no user-visible changes.

6.102.3

--------------------

This patch improves our shrinking of unique collections, such as  :func:`~hypothesis.strategies.dictionaries`,
:func:`~hypothesis.strategies.sets`, and :func:`~hypothesis.strategies.lists` with ``unique=True``.

6.102.2

--------------------

This patch fixes a rare internal error when generating very large elements from strategies (:issue:`3874`).

6.102.1

--------------------

This patch fixes an overly strict internal type assertion.

6.102.0

--------------------

This release improves our support for the :pypi:`annotated-types` iterable
``GroupedMetadata`` protocol.  In order to treat the elements "as if they
had been unpacked", if one such element is a :class:`~hypothesis.strategies.SearchStrategy`
we now resolve to that strategy.  Previously, we treated this as an unknown
filter predicate.

We expect this to be useful for libraries implementing custom metadata -
instead of requiring downstream integration, they can implement the protocol
and yield a lazily-created strategy.  Doing so only if Hypothesis is in
:obj:`sys.modules` gives powerful integration with no runtime overhead
or extra dependencies.

6.101.0

--------------------

The :func:`~hypothesis.extra.django.from_model` function currently
tries to create a strategy for :obj:`~django:django.db.models.AutoField`
fields if they don't have :attr:`~django:django.db.models.Field.auto_created`
set to `True`.  The docs say it's supposed to skip all
:obj:`~django:django.db.models.AutoField` fields, so this patch updates
the code to do what the docs say (:issue:`3978`).

6.100.8

--------------------

This patch adds some internal type annotations (:issue:`3074`).
Thanks to Andrew Sansom for his contribution!

6.100.7

--------------------

This patch fixes a rare internal error when using :func:`~hypothesis.strategies.integers` with a high ``max_examples`` setting (:issue:`3974`).

6.100.6

--------------------

This patch improves our internal caching logic. We don't expect it to result in any performance improvements (yet!).

6.100.5

--------------------

This patch turns off a check in :func:`~hypothesis.register_random` for possibly
unreferenced RNG instances on the free-threaded build of CPython 3.13 because
this check has a much higher false positive rate in the free-threaded build
(:issue:`3965`).

Thanks to Nathan Goldbaum for this patch.

6.100.4

--------------------

This patch turns off a warning for functions decorated with
:func:`typing.overload` and then :func:`~hypothesis.strategies.composite`,
although only in that order (:issue:`3970`).

6.100.3

--------------------

This patch fixes a significant slowdown when using the :func:`~hypothesis.stateful.precondition` decorator in some cases, due to expensive repr formatting internally (:issue:`3963`).

6.100.2

--------------------

Explicitly cast :obj:`numpy.finfo.smallest_normal` to builtin `float` in
preparation for the :pypi:`numpy==2.0 <numpy>` release (:issue:`3950`)

6.100.1

--------------------

This patch improve a rare error message for flaky tests (:issue:`3940`).

6.100.0

--------------------

The :func:`~hypothesis.extra.numpy.from_dtype` function no longer generates
``NaT`` ("not-a-time") values for the ``datetime64`` or ``timedelta64`` dtypes
if passed ``allow_nan=False`` (:issue:`3943`).

6.99.13

--------------------

This patch includes the :obj:`~hypothesis.settings.backend` setting in the
``how_generated`` field of our :doc:`observability output <observability>`.

6.99.12

--------------------

If you were running Python 3.13 (currently in alpha) with :pypi:`pytest-xdist`
and then attempted to pretty-print a ``lambda`` functions which was created
using the :func:`eval` builtin, it would have raised an AssertionError.
Now you'll get ``"lambda ...: <unknown>"``, as expected.

6.99.11

--------------------

This release improves an internal invariant.

6.99.10

--------------------

This patch fixes Hypothesis sometimes raising a ``Flaky`` error when generating collections of unique floats containing ``nan``. See :issue:`3926` for more details.

6.99.9

-------------------

This patch continues our work on refactoring the shrinker (:issue:`3921`).

6.99.8

-------------------

This patch continues our work on refactoring shrinker internals (:issue:`3921`).

6.99.7

-------------------

This release resolves :py:exc:`PermissionError` that come from
creating databases on inaccessible paths.

6.99.6

-------------------

This patch starts work on refactoring our shrinker internals. There is no user-visible change.

6.99.5

-------------------

This patch fixes a longstanding performance problem in stateful testing (:issue:`3618`),
where state machines which generated a substantial amount of input for each step would
hit the maximum amount of entropy and then fail with an ``Unsatisfiable`` error.

We now stop taking additional steps when we're approaching the entropy limit,
which neatly resolves the problem without touching unaffected tests.

6.99.4

-------------------

Fix regression caused by using :pep:`696` default in TypeVar with Python 3.13.0a3.

6.99.3

-------------------

This patch further improves the type annotations in :mod:`hypothesis.extra.numpy`.

6.99.2

-------------------

Simplify the type annotation of :func:`~hypothesis.extra.pandas.column` and
:func:`~hypothesis.extra.pandas.columns` by using :pep:`696` to avoid overloading.

6.99.1

-------------------

This patch implements type annotations for :func:`~hypothesis.extra.pandas.column`.

6.99.0

-------------------

This release adds the **experimental and unstable** :obj:`~hypothesis.settings.backend`
setting.  See :ref:`alternative-backends` for details.

6.98.18

--------------------

This patch fixes :issue:`3900`, a performance regression for
:func:`~hypothesis.extra.numpy.arrays` due to the interaction of
:ref:`v6.98.12` and :ref:`v6.97.1`.

6.98.17

--------------------

This patch improves the type annotations in :mod:`hypothesis.extra.numpy`,
which makes inferred types more precise for both :pypi:`mypy` and
:pypi:`pyright`, and fixes some strict-mode errors on the latter.

Thanks to Jonathan Plasse for reporting and fixing this in :pull:`3889`!

6.98.16

--------------------

This patch paves the way for future shrinker improvements. There is no user-visible change.

6.98.15

--------------------

This release adds support for the Array API's `2023.12 release
<https://data-apis.org/array-api/2023.12/>`_ via the ``api_version`` argument in
:func:`~hypothesis.extra.array_api.make_strategies_namespace`. The API additions
and modifications in the ``2023.12`` spec do not necessitate any changes in the
Hypothesis strategies, hence there is no distinction between a ``2022.12`` and
``2023.12`` strategies namespace.

6.98.14

--------------------

This patch adjusts the printing of bundle values to correspond
with their names when using stateful testing.

6.98.13

--------------------

This patch implements filter-rewriting for :func:`~hypothesis.strategies.text`
and :func:`~hypothesis.strategies.binary` with the :meth:`~re.Pattern.search`,
:meth:`~re.Pattern.match`, or :meth:`~re.Pattern.fullmatch` method of a
:func:`re.compile`\ d regex.

6.98.12

--------------------

This patch implements filter-rewriting for most length filters on some
additional collection types (:issue:`3795`), and fixes several latent
bugs where unsatisfiable or partially-infeasible rewrites could trigger
internal errors.

6.98.11

--------------------

This patch makes stateful testing somewhat less likely to get stuck
when there are only a few possible rules.

6.98.10

--------------------

This patch :pep:`adds a note <678>` to errors which occur while drawing from
a strategy, to make it easier to tell why your test failed in such cases.

6.98.9

-------------------

This patch ensures that :doc:`observability <observability>` outputs include
an informative repr for :class:`~hypothesis.stateful.RuleBasedStateMachine`
stateful tests, along with more detailed timing information.

6.98.8

-------------------

This patch improves :doc:`the Ghostwriter <ghostwriter>` for binary operators.

6.98.7

-------------------

This patch improves import-detection in :doc:`the Ghostwriter <ghostwriter>`
(:issue:`3884`), particularly for :func:`~hypothesis.strategies.from_type`
and strategies from ``hypothesis.extra.*``.

6.98.6

-------------------

This patch clarifies the documentation on stateful testing (:issue:`3511`).

6.98.5

-------------------

This patch improves argument-to-json conversion for :doc:`observability <observability>`
output.  Checking for a ``.to_json()`` method on the object *before* a few other
options like dataclass support allows better user control of the process (:issue:`3880`).

6.98.4

-------------------

This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.

6.98.3

-------------------

This patch fixes an error when generating :doc:`observability <observability>` reports involving large (``n > 1e308``) integers.

6.98.2

-------------------

This patch refactors some internals. There is no user-visible change.

6.98.1

-------------------

This release improves our distribution of generated values for all strategies, by doing a better job of tracking which values we have generated before and avoiding generating them again.

For example, ``st.lists(st.integers())`` previously generated ~5 each of ``[]`` ``[0]`` in 100 examples. In this release, each of ``[]`` and ``[0]`` are generated ~1-2 times each.

6.98.0

-------------------

This release deprecates use of the global random number generator while drawing
from a strategy, because this makes test cases less diverse and prevents us
from reporting minimal counterexamples (:issue:`3810`).

If you see this new warning, you can get a quick fix by using
:func:`~hypothesis.strategies.randoms`; or use more idiomatic strategies
:func:`~hypothesis.strategies.sampled_from`, :func:`~hypothesis.strategies.floats`,
:func:`~hypothesis.strategies.integers`, and so on.

Note that the same problem applies to e.g. ``numpy.random``, but
for performance reasons we only check the stdlib :mod:`random` module -
ignoring even other sources passed to :func:`~hypothesis.register_random`.

6.97.6

-------------------

This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.

6.97.5

-------------------

This patch adds some :doc:`observability information <observability>`
about how many times predicates in :func:`~hypothesis.assume` or
:func:`~hypothesis.stateful.precondition` were satisfied, so that
downstream tools can warn you if some were *never* satisfied by
any test case.

6.97.4

-------------------

This patch improves formatting and adds some cross-references to our docs.

6.97.3

-------------------

Internal test refactoring.

6.97.2

-------------------

This patch slightly changes how we replay examples from
:doc:`the database <database>`: if the behavior of the saved example has
changed, we now keep running the test case instead of aborting at the size
of the saved example.  While we know it's not the *same* example, we might
as well continue running the test!

Because we now finish running a few more examples for affected tests, this
might be a slight slowdown - but correspondingly more likely to find a bug.

We've also applied similar tricks to the :ref:`target phase <phases>`, where
they are a pure performance improvement for affected tests.

6.97.1

-------------------

Improves the performance of the :func:`~hypothesis.extra.numpy.arrays`
strategy when generating unique values.

6.97.0

-------------------

Changes the distribution of :func:`~hypothesis.strategies.sampled_from` when
sampling from a :class:`~python:enum.Flag`. Previously, no-flags-set values would
never be generated, and all-flags-set values would be unlikely for large enums.
With this change, the distribution is more uniform in the number of flags set.

6.96.4

-------------------

This patch slightly refactors some internals. There is no user-visible change.

6.96.3

-------------------

This patch fixes a spurious warning about slow imports when ``HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY`` was set.

6.96.2

-------------------

This patch refactors some more internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change.

6.96.1

-------------------

Fix a spurious warning seen when running pytest's test
suite, caused by never realizing we got out of
initialization due to imbalanced hook calls.

6.96.0

-------------------

Warns when constructing a `repr` that is overly long. This can
happen by accident if stringifying arbitrary strategies, and
is expensive in time and memory. The associated deferring of
these long strings in :func:`~hypothesis.strategies.sampled_from`
should also lead to improved performance.

6.95.0

-------------------

This release adds the ability to pass any object to :func:`~hypothesis.note`, instead of just strings. The pretty-printed representation of the object will be used.

See also :issue:`3843`.

6.94.0

-------------------

This release avoids creating a ``.hypothesis`` directory when using
:func:`~hypothesis.strategies.register_type_strategy` (:issue:`3836`),
and adds warnings for plugins which do so by other means or have
other unintended side-effects.

6.93.2

-------------------

This patch improves :doc:`observability <observability>` reports by moving
timing information from ``metadata`` to a new ``timing`` key, and supporting
conversion of additional argument types to json rather than string reprs
via a ``.to_json()`` method (including e.g. Pandas dataframes).

Additionally, the :obj:`~hypothesis.HealthCheck.too_slow` health check will
now report *which* strategies were slow, e.g. for strategies a, b, c, ...::

     count | fraction |    slowest draws (seconds)
 a |    3  |     65%  |      --      --      --   0.357,  2.000
 b |    8  |     16%  |   0.100,  0.100,  0.100,  0.111,  0.123
 c |    3  |      8%  |      --      --   0.030,  0.050,  0.200
 (skipped 2 rows of fast draws)

6.93.1

-------------------

This patch refactors some internals, continuing our work on supporting alternative backends
(:issue:`3086`). There is no user-visible change.

6.93.0

-------------------

The :func:`~hypothesis.extra.lark.from_lark` strategy now accepts an ``alphabet=``
argument, which is passed through to :func:`~hypothesis.strategies.from_regex`,
so that you can e.g. constrain the generated strings to a particular codec.

In support of this feature, :func:`~hypothesis.strategies.from_regex` will avoid
generating optional parts which do not fit the alphabet.  For example,
``from_regex(r"abc|def", alphabet="abcd")`` was previously an error, and will now
generate only ``'abc'``.  Cases where there are no valid strings remain an error.

6.92.9

-------------------

This patch refactors some internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change.

6.92.8

-------------------

This patch adds a :ref:`test statistics <statistics>` event when a generated example is rejected via :func:`assume <hypothesis.assume>`.

This may also help with distinguishing ``gave_up`` examples in :doc:`observability <observability>` (:issue:`3827`).

6.92.7

-------------------

This introduces the rewriting of length filters on some collection strategies (:issue:`3791`).

Thanks to Reagan Lee for implementing this feature!

6.92.6

-------------------

If a test uses :func:`~hypothesis.strategies.sampled_from` on a sequence of
strategies, and raises a ``TypeError``, we now :pep:`add a note <678>` asking
whether you meant to use :func:`~hypothesis.strategies.one_of`.

Thanks to Vince Reuter for suggesting and implementing this hint!

6.92.5

-------------------

This patch registers explicit strategies for a handful of builtin types,
motivated by improved introspection in PyPy 7.3.14 triggering existing
internal warnings.
Thanks to Carl Friedrich Bolz-Tereick for helping us work out what changed!

6.92.4

-------------------

This patch fixes an error when writing :doc:`observability <observability>` reports without a pre-existing ``.hypothesis`` directory.

6.92.3

-------------------

This patch adds a new environment variable ``HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY_NOCOVER``,
which turns on :doc:`observability <observability>` data collection without collecting
code coverage data, which may be faster on Python 3.11 and earlier.

Thanks to Harrison Goldstein for reporting and fixing :issue:`3821`.

6.92.2

-------------------

This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
Links

@pyup-bot
Copy link
Collaborator Author

Closing this in favor of #7550

@pyup-bot pyup-bot closed this Jun 24, 2024
@Harmon758 Harmon758 deleted the pyup-update-hypothesis-6.92.1-to-6.103.3 branch June 24, 2024 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant