From 57289099bb9fb782a78d329186991ed3d313e948 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 4 Sep 2024 10:35:58 +0100 Subject: [PATCH] Make mypy pass on black in `knot_benchmark` (#13235) --- scripts/knot_benchmark/src/benchmark/cases.py | 5 +++++ scripts/knot_benchmark/src/benchmark/projects.py | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/knot_benchmark/src/benchmark/cases.py b/scripts/knot_benchmark/src/benchmark/cases.py index e0930a49929a8..6268a7c1db208 100644 --- a/scripts/knot_benchmark/src/benchmark/cases.py +++ b/scripts/knot_benchmark/src/benchmark/cases.py @@ -204,6 +204,11 @@ def install(self, dependencies: list[str]): "--python", self.python, "--quiet", + # We pass `--exclude-newer` to ensure that type-checking of one of + # our projects isn't unexpectedly broken by a change in the + # annotations of one of that project's dependencies + "--exclude-newer", + "2024-09-03T00:00:00Z", *dependencies, ] diff --git a/scripts/knot_benchmark/src/benchmark/projects.py b/scripts/knot_benchmark/src/benchmark/projects.py index 5a4f96cd3b43e..749ed4a622a9b 100644 --- a/scripts/knot_benchmark/src/benchmark/projects.py +++ b/scripts/knot_benchmark/src/benchmark/projects.py @@ -15,7 +15,11 @@ class Project(typing.NamedTuple): revision: str dependencies: list[str] - """List of type checking dependencies""" + """List of type checking dependencies. + + Dependencies are pinned using a `--exclude-newer` flag when installing them + into the virtual environment; see the `Venv.install()` method for details. + """ include: list[str] = [] """The directories and files to check. If empty, checks the current directory""" @@ -96,7 +100,7 @@ def clone(self, checkout_dir: Path): Project( name="black", repository="https://github.com/psf/black", - revision="c20423249e9d8dfb8581eebbfc67a13984ee45e9", + revision="ac28187bf4a4ac159651c73d3a50fe6d0f653eac", include=["src"], dependencies=[ "aiohttp",