Skip to content

Commit 681ce55

Browse files
committed
Merge branch 'master' into claude/add-min-leaves-parameter-01XYPfenzf6xuY64W4tMDpAT
2 parents 72f5cb7 + 074893e commit 681ce55

66 files changed

Lines changed: 1565 additions & 570 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/CLAUDE.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,19 @@ Run tests using the build system:
2727

2828
## Changelog & Pull Requests
2929

30-
When creating a PR:
30+
When creating a PR that changes `hypothesis-python/src/`:
3131
1. Create `hypothesis-python/RELEASE.rst` with `RELEASE_TYPE: patch` (bugfixes) or `minor` (features)
3232
2. See `RELEASE-sample.rst` for examples
3333
3. **Imitate the style in `changelog.rst`** for consistency
3434
4. Follow all changelog instructions in `CONTRIBUTING.rst`
3535

36+
**Note:** Test-only changes (no modifications to `src/`) do not require a RELEASE.rst file.
37+
3638
## Before Committing
3739

3840
1. Do a final edit pass on all code to ensure it is:
3941
- **Concise** - remove unnecessary verbosity
4042
- **Idiomatic** - follows Python and Hypothesis conventions
4143
- **Minimally commented** - code should be self-documenting; only add comments where truly needed
4244
2. **Run `./build.sh format; ./build.sh lint`** immediately before committing to auto-format and lint code
45+
3. **Do not reference issues or PRs in commit messages** (e.g., avoid `Fixes #1234` or `See #5678`) - this clutters the issue timeline with unnecessary links
File renamed without changes.
File renamed without changes.

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
- check-quality
9191
- check-pytest62
9292
- check-pytest62
93-
- check-django51
93+
- check-django60
9494
- check-django42
9595
- check-pandas22
9696
- check-pandas21

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
.DS_Store
1212
.hypothesis
1313
.vscode/
14+
.claude/settings.local.json
1415

1516
# generic build components
1617

build.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ SCRIPTS="$ROOT/tooling/scripts"
1919
# shellcheck source=tooling/scripts/common.sh
2020
source "$SCRIPTS/common.sh"
2121

22-
if [ -n "${GITHUB_ACTIONS-}" ] || [ -n "${CODESPACES-}" ] ; then
23-
# We're on GitHub Actions or Codespaces and already set up a suitable Python
24-
PYTHON=$(command -v python)
22+
if [ -n "${GITHUB_ACTIONS-}" ] || [ -n "${CODESPACES-}" ] || [ -n "${CLAUDECODE-}" ] ; then
23+
# We're on GitHub Actions, Codespaces, or Claude Code and already have a suitable Python
24+
PYTHON=$(command -v python3 || command -v python)
2525
else
2626
# Otherwise, we install it from scratch
2727
# NOTE: tooling keeps this version in sync with ci_version in tooling
@@ -40,9 +40,14 @@ export PYTHONPATH="$ROOT/tooling/src"
4040

4141
if ! "$TOOL_PYTHON" -m hypothesistooling check-installed ; then
4242
rm -rf "$TOOL_VIRTUALENV"
43-
"$PYTHON" -m pip install --upgrade pip
44-
"$PYTHON" -m pip install --upgrade virtualenv
45-
"$PYTHON" -m virtualenv "$TOOL_VIRTUALENV"
43+
if [ -n "${CLAUDECODE-}" ] ; then
44+
# Claude Code: use venv (available) and skip pip upgrades (debian-managed)
45+
"$PYTHON" -m venv "$TOOL_VIRTUALENV"
46+
else
47+
"$PYTHON" -m pip install --upgrade pip
48+
"$PYTHON" -m pip install --upgrade virtualenv
49+
"$PYTHON" -m virtualenv "$TOOL_VIRTUALENV"
50+
fi
4651
"$TOOL_PYTHON" -m pip install --no-warn-script-location -r requirements/tools.txt
4752
fi
4853

hypothesis-python/docs/changelog.rst

Lines changed: 128 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,130 @@ Hypothesis 6.x
1818

1919
.. include:: ../RELEASE.rst
2020

21+
.. _v6.149.0:
22+
23+
--------------------
24+
6.149.0 - 2026-01-05
25+
--------------------
26+
27+
This release extends the explain-phase ``# or any other generated value`` comments
28+
to sub-arguments within :func:`~hypothesis.strategies.builds`,
29+
:func:`~hypothesis.strategies.tuples`, and :func:`~hypothesis.strategies.fixed_dictionaries`.
30+
31+
Previously, these comments only appeared on top-level test arguments. Now, when
32+
the explain phase determines that a sub-argument can vary freely without affecting
33+
the test failure, you'll see comments like::
34+
35+
Falsifying example: test_foo(
36+
obj=MyClass(
37+
x=0, # or any other generated value
38+
y=True,
39+
),
40+
data=(
41+
'', # or any other generated value
42+
42,
43+
),
44+
)
45+
46+
This makes it easier to understand which parts of complex inputs actually matter
47+
for reproducing a failure.
48+
49+
.. _v6.148.13:
50+
51+
---------------------
52+
6.148.13 - 2026-01-05
53+
---------------------
54+
55+
Clean up an internal helper.
56+
57+
.. _v6.148.12:
58+
59+
---------------------
60+
6.148.12 - 2026-01-04
61+
---------------------
62+
63+
This patch fixes :func:`~hypothesis.strategies.from_type` to properly handle
64+
parameterized type aliases created with Python 3.12+'s :pep:`695` ``type``
65+
statement. For example, ``st.from_type(A[int])`` where ``type A[T] = list[T]``
66+
now correctly resolves to ``lists(integers())`` instead of raising a
67+
``TypeError`` (:issue:`4628`).
68+
69+
.. _v6.148.11:
70+
71+
---------------------
72+
6.148.11 - 2026-01-03
73+
---------------------
74+
75+
Hypothesis now prints a |Verbosity.verbose| log when we switch away from an :ref:`alternative backend <alternative-backends>`.
76+
77+
.. _v6.148.10:
78+
79+
---------------------
80+
6.148.10 - 2026-01-03
81+
---------------------
82+
83+
Fixes :ref:`Ghostwriter <ghostwriter>` output for :pypi:`numpy` >= 2.4.0. Also adds support |st.from_type| for :pypi:`numpy` 2.5.0 nightly (which has not yet been released).
84+
85+
.. _v6.148.9:
86+
87+
--------------------
88+
6.148.9 - 2026-01-01
89+
--------------------
90+
91+
|.example| no longer emits |NonInteractiveExampleWarning| when running a python file directly. This means that e.g. ``python my_sandbox.py`` during exploratory work with |.example| will no longer raise warnings.
92+
93+
.. _v6.148.8:
94+
95+
--------------------
96+
6.148.8 - 2025-12-23
97+
--------------------
98+
99+
Add ``__dict__`` and ``__proto__`` to the list of constant strings Hypothesis sometimes generates.
100+
101+
.. _v6.148.7:
102+
103+
--------------------
104+
6.148.7 - 2025-12-05
105+
--------------------
106+
107+
When multiple explicit |@example| decorators fail with the same error,
108+
Hypothesis now shows only the simplest failing example (by shortlex order)
109+
with a note about how many other examples also failed (:issue:`4520`).
110+
111+
To see all failing examples, use |Verbosity.verbose| or higher.
112+
113+
.. _v6.148.6:
114+
115+
--------------------
116+
6.148.6 - 2025-12-04
117+
--------------------
118+
119+
Fix a bug where we persisted symbolics from solver-based :ref:`alternative backends <alternative-backends>` in |event|.
120+
121+
.. _v6.148.5:
122+
123+
--------------------
124+
6.148.5 - 2025-12-01
125+
--------------------
126+
127+
This patch improves the error message for :class:`~hypothesis.errors.FlakyStrategyDefinition`
128+
when the precondition for a rule is flaky (:issue:`4206`).
129+
130+
.. _v6.148.4:
131+
132+
--------------------
133+
6.148.4 - 2025-12-01
134+
--------------------
135+
136+
This patch improves the type annotations for :func:`~hypothesis.extra.numpy.basic_indices`.
137+
The return type now accurately reflects the ``allow_ellipsis`` and ``allow_newaxis``
138+
parameters, excluding ``EllipsisType`` or ``None`` from the union when those index
139+
types are disabled (:issue:`4607`).
140+
141+
Additionally, :func:`~hypothesis.assume` now has overloaded type annotations:
142+
``assume(True)`` returns ``Literal[True]``, while ``assume(False)`` and
143+
``assume(None)`` return ``NoReturn``.
144+
21145
.. _v6.148.3:
22146

23147
--------------------
@@ -2700,7 +2824,7 @@ This patch fixes a significant slowdown when using the :func:`~hypothesis.statef
27002824
6.100.2 - 2024-04-28
27012825
--------------------
27022826

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

27062830
.. _v6.100.1:
@@ -4287,7 +4411,7 @@ Thanks to Felix Divo for the new feature!
42874411
-------------------
42884412

42894413
This patch fixes invalid annotations detected for the tests generated by
4290-
:ref:`Ghostwritter <ghostwriter>`. It will now correctly generate ``Optional``
4414+
:ref:`Ghostwriter <ghostwriter>`. It will now correctly generate ``Optional``
42914415
types with just one type argument and handle union expressions inside of type
42924416
arguments correctly. Additionally, it now supports code with the
42934417
``from __future__ import annotations`` marker for Python 3.10 and newer.
@@ -4321,7 +4445,7 @@ For now, we capture calls made via :func:`~hypothesis.strategies.builds`, and vi
43214445
6.64.0 - 2023-01-23
43224446
-------------------
43234447

4324-
The :ref:`Ghostwritter <ghostwriter>` will now include type annotations on tests
4448+
The :ref:`Ghostwriter <ghostwriter>` will now include type annotations on tests
43254449
for type-annotated code. If you want to force this to happen (or not happen),
43264450
pass a boolean to the new ``annotate=`` argument to the Python functions, or
43274451
the ``--[no-]annotate`` CLI flag.
@@ -4864,7 +4988,7 @@ This PR was kindly supported by `Ordina Pythoneers
48644988
6.47.0 - 2022-06-07
48654989
-------------------
48664990

4867-
The :ref:`Ghostwritter <ghostwriter>` can now write tests for
4991+
The :ref:`Ghostwriter <ghostwriter>` can now write tests for
48684992
:obj:`@classmethod <classmethod>` or :obj:`@staticmethod <staticmethod>`
48694993
methods, in addition to the existing support for functions and other callables
48704994
(:issue:`3318`). Thanks to Cheuk Ting Ho for the patch.

hypothesis-python/docs/prolog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868

6969
.. |HypothesisException| replace:: :obj:`HypothesisException <hypothesis.errors.HypothesisException>`
7070
.. |HypothesisDeprecationWarning| replace:: :obj:`HypothesisDeprecationWarning <hypothesis.errors.HypothesisDeprecationWarning>`
71+
.. |NonInteractiveExampleWarning| replace:: :obj:`NonInteractiveExampleWarning <hypothesis.errors.NonInteractiveExampleWarning>`
7172
.. |Flaky| replace:: :obj:`Flaky <hypothesis.errors.Flaky>`
7273
.. |FlakyStrategyDefinition| replace:: :obj:`FlakyStrategyDefinition <hypothesis.errors.FlakyStrategyDefinition>`
7374
.. |FlakyFailure| replace:: :obj:`FlakyFailure <hypothesis.errors.FlakyFailure>`
@@ -122,6 +123,7 @@
122123
.. |map| replace:: :func:`.map() <hypothesis.strategies.SearchStrategy.map>`
123124
.. |.map| replace:: :func:`.map() <hypothesis.strategies.SearchStrategy.map>`
124125
.. |.map()| replace:: :func:`.map() <hypothesis.strategies.SearchStrategy.map>`
126+
.. |.example| replace:: :func:`.example() <hypothesis.strategies.SearchStrategy.example>`
125127
.. |.example()| replace:: :func:`.example() <hypothesis.strategies.SearchStrategy.example>`
126128

127129
.. |PrimitiveProvider| replace:: :class:`~hypothesis.internal.conjecture.providers.PrimitiveProvider`

hypothesis-python/docs/reference/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ Custom exceptions raised by Hypothesis.
228228

229229
.. autoclass:: hypothesis.errors.HypothesisException
230230
.. autoclass:: hypothesis.errors.HypothesisDeprecationWarning
231+
.. autoclass:: hypothesis.errors.NonInteractiveExampleWarning
231232
.. autoclass:: hypothesis.errors.Flaky
232233
.. autoclass:: hypothesis.errors.FlakyStrategyDefinition
233234
.. autoclass:: hypothesis.errors.FlakyFailure

hypothesis-python/docs/tutorial/custom-strategies.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Let's see this new strategy in action:
5858
5959
.. note::
6060

61-
Just like all other strategies, we called ``sums_to_one`` before passing it to |@given|. |st.composite| should be thought of as turning its decorated function into a function which returns a stratgy when called. This is actually the same as existing strategies in Hypothesis; |st.integers| is really a function, which returns a strategy for integers when called.
61+
Just like all other strategies, we called ``sums_to_one`` before passing it to |@given|. |st.composite| should be thought of as turning its decorated function into a function which returns a strategy when called. This is actually the same as existing strategies in Hypothesis; |st.integers| is really a function, which returns a strategy for integers when called.
6262

6363
Combining |st.composite| with parameters
6464
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)