diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index adf3550b76..75c2410786 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -226,7 +226,7 @@ jobs: NODE_VERSION: 18 # Note that the versions below must be updated in sync; we've automated # that with `update_pyodide_versions()` in our weekly cronjob. - PYODIDE_VERSION: 0.26.3 + PYODIDE_VERSION: 0.26.4 PYTHON_VERSION: 3.12.1 EMSCRIPTEN_VERSION: 3.1.58 steps: @@ -245,7 +245,6 @@ jobs: uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14 with: version: ${{ env.EMSCRIPTEN_VERSION }} - actions-cache-folder: emsdk-cache - name: Build run: | pip install pyodide-build==$PYODIDE_VERSION diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst new file mode 100644 index 0000000000..e688a1472d --- /dev/null +++ b/hypothesis-python/RELEASE.rst @@ -0,0 +1,3 @@ +RELEASE_TYPE: patch + +This patch updates our autoformatting tools, improving our code style without any API changes. \ No newline at end of file diff --git a/hypothesis-python/setup.py b/hypothesis-python/setup.py index 60fc257c16..f9eaaa189f 100644 --- a/hypothesis-python/setup.py +++ b/hypothesis-python/setup.py @@ -60,7 +60,7 @@ def local_file(name): "pytest": ["pytest>=4.6"], "dpcontracts": ["dpcontracts>=0.4"], "redis": ["redis>=3.0.0"], - "crosshair": ["hypothesis-crosshair>=0.0.18", "crosshair-tool>=0.0.77"], + "crosshair": ["hypothesis-crosshair>=0.0.18", "crosshair-tool>=0.0.78"], # zoneinfo is an odd one: every dependency is platform-conditional. "zoneinfo": [ "tzdata>=2024.2 ; sys_platform == 'win32' or sys_platform == 'emscripten'", diff --git a/hypothesis-python/src/hypothesis/__init__.py b/hypothesis-python/src/hypothesis/__init__.py index cfb55119f7..0b62ac8b1d 100644 --- a/hypothesis-python/src/hypothesis/__init__.py +++ b/hypothesis-python/src/hypothesis/__init__.py @@ -36,6 +36,8 @@ "HealthCheck", "Phase", "Verbosity", + "__version__", + "__version_info__", "assume", "currently_in_test_context", "event", @@ -50,8 +52,6 @@ "seed", "settings", "target", - "__version__", - "__version_info__", ] run() diff --git a/hypothesis-python/src/hypothesis/database.py b/hypothesis-python/src/hypothesis/database.py index 4f2f268d87..1964f833d5 100644 --- a/hypothesis-python/src/hypothesis/database.py +++ b/hypothesis-python/src/hypothesis/database.py @@ -37,10 +37,10 @@ __all__ = [ "DirectoryBasedExampleDatabase", "ExampleDatabase", + "GitHubArtifactDatabase", "InMemoryExampleDatabase", "MultiplexedDatabase", "ReadOnlyDatabase", - "GitHubArtifactDatabase", ] diff --git a/hypothesis-python/src/hypothesis/extra/_array_helpers.py b/hypothesis-python/src/hypothesis/extra/_array_helpers.py index 681d55e8f2..78e821a247 100644 --- a/hypothesis-python/src/hypothesis/extra/_array_helpers.py +++ b/hypothesis-python/src/hypothesis/extra/_array_helpers.py @@ -21,18 +21,18 @@ __all__ = [ "NDIM_MAX", - "Shape", - "BroadcastableShapes", "BasicIndex", - "check_argument", - "order_check", - "check_valid_dims", + "BasicIndexStrategy", + "BroadcastableShapes", + "MutuallyBroadcastableShapesStrategy", + "Shape", "array_shapes", - "valid_tuple_axes", "broadcastable_shapes", + "check_argument", + "check_valid_dims", "mutually_broadcastable_shapes", - "MutuallyBroadcastableShapesStrategy", - "BasicIndexStrategy", + "order_check", + "valid_tuple_axes", ] diff --git a/hypothesis-python/src/hypothesis/extra/django/__init__.py b/hypothesis-python/src/hypothesis/extra/django/__init__.py index 39e6e0182e..cb49b7a509 100644 --- a/hypothesis-python/src/hypothesis/extra/django/__init__.py +++ b/hypothesis-python/src/hypothesis/extra/django/__init__.py @@ -24,7 +24,7 @@ "TestCase", "TransactionTestCase", "from_field", + "from_form", "from_model", "register_field_strategy", - "from_form", ] diff --git a/hypothesis-python/src/hypothesis/extra/numpy.py b/hypothesis-python/src/hypothesis/extra/numpy.py index 34f8278c24..da0b119409 100644 --- a/hypothesis-python/src/hypothesis/extra/numpy.py +++ b/hypothesis-python/src/hypothesis/extra/numpy.py @@ -68,26 +68,26 @@ def _try_import(mod_name: str, attr_name: str) -> Any: __all__ = [ "BroadcastableShapes", - "from_dtype", - "arrays", + "array_dtypes", "array_shapes", - "scalar_dtypes", + "arrays", + "basic_indices", "boolean_dtypes", - "unsigned_integer_dtypes", - "integer_dtypes", - "floating_dtypes", + "broadcastable_shapes", + "byte_string_dtypes", "complex_number_dtypes", "datetime64_dtypes", + "floating_dtypes", + "from_dtype", + "integer_array_indices", + "integer_dtypes", + "mutually_broadcastable_shapes", + "nested_dtypes", + "scalar_dtypes", "timedelta64_dtypes", - "byte_string_dtypes", "unicode_string_dtypes", - "array_dtypes", - "nested_dtypes", + "unsigned_integer_dtypes", "valid_tuple_axes", - "broadcastable_shapes", - "mutually_broadcastable_shapes", - "basic_indices", - "integer_array_indices", ] TIME_RESOLUTIONS = tuple("Y M D h m s ms us ns ps fs as".split()) diff --git a/hypothesis-python/src/hypothesis/extra/pandas/__init__.py b/hypothesis-python/src/hypothesis/extra/pandas/__init__.py index 2fd9c627a1..5d8a4361f5 100644 --- a/hypothesis-python/src/hypothesis/extra/pandas/__init__.py +++ b/hypothesis-python/src/hypothesis/extra/pandas/__init__.py @@ -17,4 +17,4 @@ series, ) -__all__ = ["indexes", "range_indexes", "series", "column", "columns", "data_frames"] +__all__ = ["column", "columns", "data_frames", "indexes", "range_indexes", "series"] diff --git a/hypothesis-python/src/hypothesis/internal/cache.py b/hypothesis-python/src/hypothesis/internal/cache.py index 8eb1bdba7e..4b1b66e2dc 100644 --- a/hypothesis-python/src/hypothesis/internal/cache.py +++ b/hypothesis-python/src/hypothesis/internal/cache.py @@ -57,7 +57,7 @@ class GenericCache: on_access and on_evict to implement a specific scoring strategy. """ - __slots__ = ("max_size", "_threadlocal") + __slots__ = ("_threadlocal", "max_size") def __init__(self, max_size): if max_size <= 0: diff --git a/hypothesis-python/src/hypothesis/internal/conjecture/data.py b/hypothesis-python/src/hypothesis/internal/conjecture/data.py index b818719b31..c802f4da7a 100644 --- a/hypothesis-python/src/hypothesis/internal/conjecture/data.py +++ b/hypothesis-python/src/hypothesis/internal/conjecture/data.py @@ -232,7 +232,7 @@ class Example: often dramatically reduce our memory usage, so is worth it. """ - __slots__ = ("owner", "index") + __slots__ = ("index", "owner") def __init__(self, owner: "Examples", index: int) -> None: self.owner = owner @@ -713,7 +713,7 @@ class Blocks: be preferred to using the Block objects directly, as it will not have to allocate the actual object.""" - __slots__ = ("endpoints", "owner", "__blocks", "__count", "__sparse") + __slots__ = ("__blocks", "__count", "__sparse", "endpoints", "owner") owner: "Union[ConjectureData, ConjectureResult, None]" __blocks: Union[dict[int, Block], list[Optional[Block]]] diff --git a/hypothesis-python/src/hypothesis/internal/conjecture/shrinking/__init__.py b/hypothesis-python/src/hypothesis/internal/conjecture/shrinking/__init__.py index 46cc166000..0e12c67591 100644 --- a/hypothesis-python/src/hypothesis/internal/conjecture/shrinking/__init__.py +++ b/hypothesis-python/src/hypothesis/internal/conjecture/shrinking/__init__.py @@ -15,4 +15,4 @@ from hypothesis.internal.conjecture.shrinking.ordering import Ordering from hypothesis.internal.conjecture.shrinking.string import String -__all__ = ["Integer", "Ordering", "Float", "Collection", "String", "Bytes"] +__all__ = ["Bytes", "Collection", "Float", "Integer", "Ordering", "String"] diff --git a/hypothesis-python/src/hypothesis/internal/escalation.py b/hypothesis-python/src/hypothesis/internal/escalation.py index 0fa6454167..e3d364e2ac 100644 --- a/hypothesis-python/src/hypothesis/internal/escalation.py +++ b/hypothesis-python/src/hypothesis/internal/escalation.py @@ -69,8 +69,10 @@ def get_trimmed_traceback(exception=None): tb is None or os.environ.get("HYPOTHESIS_NO_TRACEBACK_TRIM", None) or hypothesis.settings.default.verbosity >= hypothesis.Verbosity.debug - or is_hypothesis_file(traceback.extract_tb(tb)[-1][0]) - and not isinstance(exception, _Trimmable) + or ( + is_hypothesis_file(traceback.extract_tb(tb)[-1][0]) + and not isinstance(exception, _Trimmable) + ) ): return tb while tb.tb_next is not None and ( diff --git a/hypothesis-python/src/hypothesis/internal/scrutineer.py b/hypothesis-python/src/hypothesis/internal/scrutineer.py index e00cc6edcf..c8e801013f 100644 --- a/hypothesis-python/src/hypothesis/internal/scrutineer.py +++ b/hypothesis-python/src/hypothesis/internal/scrutineer.py @@ -54,7 +54,7 @@ def should_trace_file(fname: str) -> bool: class Tracer: """A super-simple branch coverage tracer.""" - __slots__ = ("branches", "_previous_location", "_should_trace") + __slots__ = ("_previous_location", "_should_trace", "branches") def __init__(self, *, should_trace: bool) -> None: self.branches: Trace = set() diff --git a/hypothesis-python/src/hypothesis/strategies/__init__.py b/hypothesis-python/src/hypothesis/strategies/__init__.py index 1d8b1ea76f..dfe8950290 100644 --- a/hypothesis-python/src/hypothesis/strategies/__init__.py +++ b/hypothesis-python/src/hypothesis/strategies/__init__.py @@ -65,6 +65,9 @@ __all__ = [ + "DataObject", + "DrawFn", + "SearchStrategy", "binary", "booleans", "builds", @@ -72,13 +75,11 @@ "complex_numbers", "composite", "data", - "DataObject", "dates", "datetimes", "decimals", "deferred", "dictionaries", - "DrawFn", "emails", "fixed_dictionaries", "floats", @@ -112,7 +113,6 @@ "timezones", "tuples", "uuids", - "SearchStrategy", ] diff --git a/hypothesis-python/src/hypothesis/strategies/_internal/core.py b/hypothesis-python/src/hypothesis/strategies/_internal/core.py index 9991bc6b08..2a367c7add 100644 --- a/hypothesis-python/src/hypothesis/strategies/_internal/core.py +++ b/hypothesis-python/src/hypothesis/strategies/_internal/core.py @@ -341,12 +341,16 @@ def lists( and len(unique_by) == 1 and ( # Introspection for either `itemgetter(0)`, or `lambda x: x[0]` - isinstance(unique_by[0], operator.itemgetter) - and repr(unique_by[0]) == "operator.itemgetter(0)" - or isinstance(unique_by[0], FunctionType) - and re.fullmatch( - get_pretty_function_description(unique_by[0]), - r"lambda ([a-z]+): \1\[0\]", + ( + isinstance(unique_by[0], operator.itemgetter) + and repr(unique_by[0]) == "operator.itemgetter(0)" + ) + or ( + isinstance(unique_by[0], FunctionType) + and re.fullmatch( + get_pretty_function_description(unique_by[0]), + r"lambda ([a-z]+): \1\[0\]", + ) ) ) ): @@ -1299,10 +1303,8 @@ def from_type_guarded(thing): # We've kept it because we turn out to have more type errors from... somewhere. # FIXME: investigate that, maybe it should be fixed more precisely? pass - if ( - hasattr(typing, "_TypedDictMeta") - and type(thing) is typing._TypedDictMeta - or hasattr(types.typing_extensions, "_TypedDictMeta") # type: ignore + if (hasattr(typing, "_TypedDictMeta") and type(thing) is typing._TypedDictMeta) or ( + hasattr(types.typing_extensions, "_TypedDictMeta") # type: ignore and type(thing) is types.typing_extensions._TypedDictMeta # type: ignore ): # pragma: no cover diff --git a/hypothesis-python/src/hypothesis/vendor/pretty.py b/hypothesis-python/src/hypothesis/vendor/pretty.py index 0f0326c435..f09b3178d1 100644 --- a/hypothesis-python/src/hypothesis/vendor/pretty.py +++ b/hypothesis-python/src/hypothesis/vendor/pretty.py @@ -76,9 +76,9 @@ def _repr_pretty_(self, p, cycle): from math import copysign, isnan __all__ = [ - "pretty", "IDKey", "RepresentationPrinter", + "pretty", ] diff --git a/hypothesis-python/tests/array_api/common.py b/hypothesis-python/tests/array_api/common.py index 84742787e6..d4729b3a55 100644 --- a/hypothesis-python/tests/array_api/common.py +++ b/hypothesis-python/tests/array_api/common.py @@ -23,9 +23,9 @@ __all__ = [ "MIN_VER_FOR_COMPLEX", - "installed_array_modules", - "flushes_to_zero", "dtype_name_params", + "flushes_to_zero", + "installed_array_modules", ] diff --git a/hypothesis-python/tests/common/__init__.py b/hypothesis-python/tests/common/__init__.py index 7edb4f204a..06057aa030 100644 --- a/hypothesis-python/tests/common/__init__.py +++ b/hypothesis-python/tests/common/__init__.py @@ -37,7 +37,7 @@ from tests.common.debug import TIME_INCREMENT -__all__ = ["standard_types", "OrderedPair", "TIME_INCREMENT"] +__all__ = ["TIME_INCREMENT", "OrderedPair", "standard_types"] OrderedPair = namedtuple("OrderedPair", ("left", "right")) diff --git a/requirements/coverage.txt b/requirements/coverage.txt index 6c9a2fe114..9d65451dd3 100644 --- a/requirements/coverage.txt +++ b/requirements/coverage.txt @@ -18,7 +18,7 @@ click==8.1.7 # via # -r requirements/coverage.in # black -coverage[toml]==7.6.4 +coverage[toml]==7.6.8 # via pytest-cov dpcontracts==0.6.0 # via -r requirements/coverage.in @@ -34,7 +34,7 @@ iniconfig==2.0.0 # via pytest lark==1.2.2 # via -r requirements/coverage.in -libcst==1.5.0 +libcst==1.5.1 # via -r requirements/coverage.in mypy-extensions==1.0.0 # via black @@ -58,7 +58,7 @@ pluggy==1.5.0 # via pytest ptyprocess==0.7.0 # via pexpect -pyarrow==18.0.0 +pyarrow==18.1.0 # via -r requirements/coverage.in pytest==8.3.3 # via @@ -87,7 +87,7 @@ sortedcontainers==2.4.0 # via # fakeredis # hypothesis (hypothesis-python/setup.py) -tomli==2.0.2 +tomli==2.2.1 # via # black # coverage diff --git a/requirements/fuzzing.txt b/requirements/fuzzing.txt index aa9ddcb393..df3c28a97d 100644 --- a/requirements/fuzzing.txt +++ b/requirements/fuzzing.txt @@ -30,7 +30,7 @@ click==8.1.7 # black # flask # hypothesis -coverage[toml]==7.6.4 +coverage[toml]==7.6.8 # via # hypofuzz # pytest-cov @@ -57,7 +57,7 @@ flask==3.0.3 # via dash hypofuzz==24.9.1 # via -r requirements/fuzzing.in -hypothesis[cli]==6.118.6 +hypothesis[cli]==6.121.1 # via hypofuzz idna==3.10 # via requests @@ -71,7 +71,7 @@ jinja2==3.1.4 # via flask lark==1.2.2 # via -r requirements/coverage.in -libcst==1.5.0 +libcst==1.5.1 # via # -r requirements/coverage.in # hypofuzz @@ -114,7 +114,7 @@ psutil==6.1.0 # via hypofuzz ptyprocess==0.7.0 # via pexpect -pyarrow==18.0.0 +pyarrow==18.1.0 # via -r requirements/coverage.in pygments==2.18.0 # via rich @@ -159,7 +159,7 @@ sortedcontainers==2.4.0 # hypothesis (hypothesis-python/setup.py) tenacity==9.0.0 # via plotly -tomli==2.0.2 +tomli==2.2.1 # via # black # coverage @@ -179,9 +179,9 @@ werkzeug==3.0.6 # via # dash # flask -zipp==3.20.2 +zipp==3.21.0 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: -setuptools==75.3.0 +setuptools==75.6.0 # via dash diff --git a/requirements/test.txt b/requirements/test.txt index e4e46a00ac..51b5827650 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -32,5 +32,5 @@ pytest-xdist==3.6.1 # via -r requirements/test.in sortedcontainers==2.4.0 # via hypothesis (hypothesis-python/setup.py) -tomli==2.0.2 +tomli==2.2.1 # via pytest diff --git a/requirements/tools.txt b/requirements/tools.txt index 7a7edac19b..c27db504cc 100644 --- a/requirements/tools.txt +++ b/requirements/tools.txt @@ -50,9 +50,9 @@ colorama==0.4.6 # via tox com2ann==0.3.0 # via shed -coverage==7.6.4 +coverage==7.6.8 # via -r requirements/tools.in -cryptography==43.0.3 +cryptography==44.0.0 # via # secretstorage # types-pyopenssl @@ -111,7 +111,7 @@ jaraco-context==6.0.1 # via keyring jaraco-functools==4.1.0 # via keyring -jedi==0.19.1 +jedi==0.19.2 # via ipython jeepney==0.8.0 # via @@ -127,7 +127,7 @@ keyring==25.5.0 # via twine lark==1.2.2 # via -r requirements/tools.in -libcst==1.5.0 +libcst==1.5.1 # via # -r requirements/tools.in # shed @@ -151,7 +151,7 @@ mypy-extensions==1.0.0 # via # black # mypy -nh3==0.2.18 +nh3==0.2.19 # via readme-renderer nodeenv==1.9.1 # via pyright @@ -171,7 +171,7 @@ parso==0.8.4 # via jedi pathspec==0.12.1 # via black -pelican[markdown]==4.10.1 +pelican[markdown]==4.10.2 # via -r requirements/tools.in pexpect==4.9.0 # via @@ -213,7 +213,7 @@ pyproject-hooks==1.2.0 # via # build # pip-tools -pyright==1.1.388 +pyright==1.1.389 # via -r requirements/tools.in pytest==8.3.3 # via @@ -252,7 +252,7 @@ rich==13.9.4 # via # pelican # twine -ruff==0.7.3 +ruff==0.8.1 # via -r requirements/tools.in secretstorage==3.3.3 # via keyring @@ -279,11 +279,11 @@ sphinx==8.1.3 # sphinxcontrib-jquery sphinx-codeautolink==0.15.2 # via -r requirements/tools.in -sphinx-hoverxref==1.4.1 +sphinx-hoverxref==1.4.2 # via -r requirements/tools.in sphinx-jsonschema==1.19.1 # via -r requirements/tools.in -sphinx-rtd-theme==3.0.1 +sphinx-rtd-theme==3.0.2 # via -r requirements/tools.in sphinx-selective-exclude==1.0.3 # via -r requirements/tools.in @@ -303,13 +303,13 @@ sphinxcontrib-qthelp==2.0.0 # via sphinx sphinxcontrib-serializinghtml==2.0.0 # via sphinx -sqlparse==0.5.1 +sqlparse==0.5.2 # via django stack-data==0.6.3 # via ipython tokenize-rt==6.1.0 # via pyupgrade -tomli==2.0.2 +tomli==2.2.1 # via # autoflake # black @@ -338,7 +338,7 @@ types-pytz==2024.2.0.20241003 # via -r requirements/tools.in types-redis==4.6.0.20241004 # via -r requirements/tools.in -types-setuptools==75.3.0.20241107 +types-setuptools==75.6.0.20241126 # via types-cffi typing-extensions==4.12.2 # via @@ -357,19 +357,19 @@ urllib3==2.2.3 # via # requests # twine -virtualenv==20.27.1 +virtualenv==20.28.0 # via tox -watchfiles==0.24.0 +watchfiles==1.0.0 # via pelican wcwidth==0.2.13 # via prompt-toolkit -wheel==0.45.0 +wheel==0.45.1 # via pip-tools -zipp==3.20.2 +zipp==3.21.0 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: pip==24.3.1 # via pip-tools -setuptools==75.3.0 +setuptools==75.6.0 # via pip-tools diff --git a/tooling/src/hypothesistooling/__main__.py b/tooling/src/hypothesistooling/__main__.py index a7746fc44a..5bcd70d399 100644 --- a/tooling/src/hypothesistooling/__main__.py +++ b/tooling/src/hypothesistooling/__main__.py @@ -267,6 +267,7 @@ def compile_requirements(*, upgrade=False): p = p.lower().replace("_", "-") if re.fullmatch(r"[a-z-]+", p): assert p + "==" in out_pkgs, f"Package `{p}` deleted from {out_file}" + out_file.write_text(out_pkgs.replace(f"{tools.ROOT}/", "")) def update_python_versions(): @@ -503,7 +504,7 @@ def run_tox(task, version, *args): "3.12": "3.12.7", "3.13": "3.13.0", "3.13t": "3.13t-dev", - "3.14": "3.14.0a1", + "3.14": "3.14.0a2", "3.14t": "3.14t-dev", "pypy3.9": "pypy3.9-7.3.16", "pypy3.10": "pypy3.10-7.3.17",