Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.10
- name: Set up Python 3.13
uses: actions/setup-python@v4
with:
python-version: "3.10.9"
python-version: "3.13.5"
- name: Restore cache
uses: actions/cache@v3
with:
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
with:
name: explicit-example-patches
path: .hypothesis/patches/latest_hypofuzz_*.patch

# Upload the database so it'll be persisted between runs.
# Note that we can also pull it down to use locally via
# https://hypothesis.readthedocs.io/en/latest/database.html#hypothesis.database.GitHubArtifactDatabase
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.10
- name: Set up Python 3.13
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.13"
- name: Restore cache
uses: actions/cache@v3
with:
Expand Down Expand Up @@ -221,10 +221,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.10
- name: Set up Python 3.13
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.13"
- name: Restore cache
uses: actions/cache@v3
with:
Expand Down Expand Up @@ -298,10 +298,10 @@ jobs:
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Set up Python 3.10
- name: Set up Python 3.13
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.13"
- name: Restore cache
uses: actions/cache@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
- name: Set up Python 3.13
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.13'
- name: Update pinned dependencies
run: ./build.sh upgrade-requirements
- name: Open pull request
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ formats:
build:
os: ubuntu-22.04
tools:
python: "3.10"
python: "3.13"
python:
install:
- requirements: requirements/tools.txt
Expand Down
9 changes: 6 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@ SCRIPTS="$ROOT/tooling/scripts"
# shellcheck source=tooling/scripts/common.sh
source "$SCRIPTS/common.sh"

PYTHON_VERSION="3.13.5"

if [ -n "${GITHUB_ACTIONS-}" ] || [ -n "${CODESPACES-}" ] ; then
# We're on GitHub Actions or Codespaces and already set up a suitable Python
PYTHON=$(command -v python)
else
# Otherwise, we install it from scratch
# NOTE: tooling keeps this version in sync with ci_version in tooling
"$SCRIPTS/ensure-python.sh" 3.10.18
PYTHON=$(pythonloc 3.10.18)/bin/python
"$SCRIPTS/ensure-python.sh" "$PYTHON_VERSION"
PYTHON=$(pythonloc "$PYTHON_VERSION")/bin/python
fi

TOOL_REQUIREMENTS="$ROOT/requirements/tools.txt"

TOOL_HASH=$("$PYTHON" "$SCRIPTS/tool-hash.py" < "$TOOL_REQUIREMENTS")
# append PYTHON_VERSION to bust caches when we upgrade versions
TOOL_HASH=$((cat "$TOOL_REQUIREMENTS" && echo "$PYTHON_VERSION") | "$PYTHON" "$SCRIPTS/tool-hash.py")

TOOL_VIRTUALENV="$VIRTUALENVS/build-$TOOL_HASH"
TOOL_PYTHON="$TOOL_VIRTUALENV/bin/python"
Expand Down
3 changes: 3 additions & 0 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
RELEASE_TYPE: patch

Removes some internal ``# type: ignore`` comments as a result of bumping CI packages.
2 changes: 1 addition & 1 deletion hypothesis-python/docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The type annotations for |st.register_type_strategy| now indicate that it accept
6.138.1 - 2025-08-15
--------------------

Internal refactoring and cleanup. As a result, ``hypothesis[black]`` now requires ``black>=20.8b0`` instead of the previous ``black>=19.10b0``.
Internal refactoring and cleanup. As a result, ``hypothesis[cli]`` and ``hypothesis[ghostwriter]`` now require ``black>=20.8b0`` instead of the previous ``black>=19.10b0``.

.. _v6.138.0:

Expand Down
6 changes: 3 additions & 3 deletions hypothesis-python/src/hypothesis/entry_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ def get_entry_points() -> Generator[EntryPoint, None, None]:
try:
eps: Sequence[EntryPoint] = importlib.metadata.entry_points(group="hypothesis")
except TypeError: # pragma: no cover
# Load-time selection requires Python >= 3.10. See also
# https://importlib-metadata.readthedocs.io/en/latest/using.html
eps = importlib.metadata.entry_points().get("hypothesis", [])
# Load-time selection requires Python >= 3.10.
# type ignore since interface differs pre-3.10
eps = importlib.metadata.entry_points().get("hypothesis", []) # type: ignore
yield from eps


Expand Down
8 changes: 4 additions & 4 deletions hypothesis-python/src/hypothesis/extra/_array_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ def valid_tuple_axes(
min_size: int = 0,
max_size: Optional[int] = None,
) -> st.SearchStrategy[tuple[int, ...]]:
"""All tuples will have a length >= ``min_size`` and <= ``max_size``. The default
"""
All tuples will have a length >= ``min_size`` and <= ``max_size``. The default
value for ``max_size`` is ``ndim``.

Examples from this strategy shrink towards an empty tuple, which render most
Expand All @@ -141,7 +142,6 @@ def valid_tuple_axes(
.. code-block:: python

any_axis_strategy = none() | integers(-ndim, ndim - 1) | valid_tuple_axes(ndim)

"""
check_type(int, ndim, "ndim")
check_type(int, min_size, "min_size")
Expand Down Expand Up @@ -352,7 +352,8 @@ def mutually_broadcastable_shapes(
min_side: int = 1,
max_side: Optional[int] = None,
) -> st.SearchStrategy[BroadcastableShapes]:
"""Return a strategy for a specified number of shapes N that are
"""
Return a strategy for a specified number of shapes N that are
mutually-broadcastable with one another and with the provided base shape.

* ``num_shapes`` is the number of mutually broadcast-compatible shapes to generate.
Expand Down Expand Up @@ -385,7 +386,6 @@ def mutually_broadcastable_shapes(
BroadcastableShapes(input_shapes=((), (), ()), result_shape=())
BroadcastableShapes(input_shapes=((3,), (), (3,)), result_shape=(3,))
BroadcastableShapes(input_shapes=((1, 2, 3), (3,), ()), result_shape=(1, 2, 3))

"""
arg_msg = "Pass either the `num_shapes` or the `signature` argument, but not both."
if num_shapes is not not_set:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def build_intervals(intervals: list[int]) -> list[tuple[int, int]]:
if len(intervals) % 2:
intervals = intervals[:-1]
intervals.sort()
return list(batched(intervals, 2, strict=True))
return list(batched(intervals, 2, strict=True)) # type: ignore


def interval_lists(
Expand Down
10 changes: 5 additions & 5 deletions hypothesis-python/src/hypothesis/strategies/_internal/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
except AttributeError: # pragma: no cover
pass # Is missing for `python<3.10`
try:
TypeGuardTypes += (typing.TypeIs,) # type: ignore
TypeGuardTypes += (typing.TypeIs,)
except AttributeError: # pragma: no cover
pass # Is missing for `python<3.13`
try:
Expand All @@ -110,7 +110,7 @@

RequiredTypes: tuple = ()
try:
RequiredTypes += (typing.Required,) # type: ignore
RequiredTypes += (typing.Required,)
except AttributeError: # pragma: no cover
pass # Is missing for `python<3.11`
try:
Expand All @@ -121,7 +121,7 @@

NotRequiredTypes: tuple = ()
try:
NotRequiredTypes += (typing.NotRequired,) # type: ignore
NotRequiredTypes += (typing.NotRequired,)
except AttributeError: # pragma: no cover
pass # Is missing for `python<3.11`
try:
Expand All @@ -132,7 +132,7 @@

ReadOnlyTypes: tuple = ()
try:
ReadOnlyTypes += (typing.ReadOnly,) # type: ignore
ReadOnlyTypes += (typing.ReadOnly,)
except AttributeError: # pragma: no cover
pass # Is missing for `python<3.13`
try:
Expand All @@ -143,7 +143,7 @@

LiteralStringTypes: tuple = ()
try:
LiteralStringTypes += (typing.LiteralString,) # type: ignore
LiteralStringTypes += (typing.LiteralString,)
except AttributeError: # pragma: no cover
pass # Is missing for `python<3.11`
try:
Expand Down
13 changes: 10 additions & 3 deletions hypothesis-python/tests/conjecture/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import math
import sys
import time
import warnings
from contextlib import contextmanager, nullcontext
from random import Random
from threading import RLock
Expand Down Expand Up @@ -798,9 +799,15 @@ def f(n):

@pytest.mark.parametrize("provider", [HypothesisProvider, PrngProvider])
def test_provider_conformance(provider):
run_conformance_test(
provider, settings=settings(max_examples=20, stateful_step_count=20)
)
with warnings.catch_warnings():
# emitted by available_timezones() from st.timezone_keys() on 3.11+
# with tzdata installed. see https://github.com/python/cpython/issues/137841.
# Once cpython fixes this, we can remove this.
if sys.version_info >= (3, 10):
warnings.simplefilter("ignore", EncodingWarning) # noqa: F821
run_conformance_test(
provider, settings=settings(max_examples=20, stateful_step_count=20)
)


# see https://github.com/HypothesisWorks/hypothesis/issues/4462 and discussion
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ignore = [
"hypothesis-python/tests/conjecture/test_data_tree.py" = ["B023"]

[tool.mypy]
python_version = "3.10"
python_version = "3.13"
platform = "linux"

allow_redefinition = true
Expand Down
6 changes: 2 additions & 4 deletions requirements/coverage.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.13
# by the following command:
#
# ./build.sh upgrade-requirements
#
annotated-types==0.7.0
# via -r requirements/coverage.in
async-timeout==5.0.1
# via redis
attrs==25.3.0
# via hypothesis (hypothesis-python/pyproject.toml)
black==25.1.0
Expand Down Expand Up @@ -79,7 +77,7 @@ pytz==2025.2
# via
# -r requirements/coverage.in
# pandas
pyyaml==6.0.2
pyyaml-ft==8.0.0
# via libcst
redis==6.4.0
# via fakeredis
Expand Down
2 changes: 1 addition & 1 deletion requirements/crosshair.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.13
# by the following command:
#
# ./build.sh upgrade-requirements
Expand Down
14 changes: 2 additions & 12 deletions requirements/fuzzing.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.13
# by the following command:
#
# ./build.sh upgrade-requirements
Expand All @@ -8,8 +8,6 @@ annotated-types==0.7.0
# via -r requirements/coverage.in
anyio==4.10.0
# via starlette
async-timeout==5.0.1
# via redis
attrs==25.3.0
# via
# hypothesis
Expand Down Expand Up @@ -131,7 +129,7 @@ pytz==2025.2
# via
# -r requirements/coverage.in
# pandas
pyyaml==6.0.2
pyyaml-ft==8.0.0
# via libcst
redis==6.4.0
# via fakeredis
Expand All @@ -151,14 +149,6 @@ sortedcontainers==2.4.0
# trio
starlette==0.47.2
# via hypofuzz
taskgroup==0.2.2
# via hypercorn
tomli==2.2.1
# via
# black
# coverage
# hypercorn
# pytest
trio==0.30.0
# via hypofuzz
typing-extensions==4.14.1
Expand Down
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.13
# by the following command:
#
# ./build.sh upgrade-requirements
Expand Down
1 change: 1 addition & 0 deletions requirements/tools.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ typing-extensions
watchdog # for typing
build
sortedcontainers-stubs # for typing
tomli # for update_pyproject_toml
-r test.in
Loading
Loading