From 4eeda017e3e3c4c789ef8e0bec4e9dd732ebab48 Mon Sep 17 00:00:00 2001 From: Dmitry Meyer Date: Fri, 10 Jul 2026 11:15:28 +0000 Subject: [PATCH] Ignore cachetools-related typing error in AWS backend `cachetools<7.1` contstraint introduced in [1] doesn't help since pyright 1.1.410 (the last version it works is 1.1.409). This patch removes the version constraint, which no longer helps, and adds `# pyright: ignore` directive instead. [1]: https://github.com/dstackai/dstack/pull/3846 --- pyproject.toml | 2 +- src/dstack/_internal/core/backends/aws/compute.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 38c4054ae..b61f974ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ dependencies = [ "cryptography", "packaging", "python-dateutil", - "cachetools<7.1.0", # Pin to work around https://github.com/tkem/cachetools/issues/394 + "cachetools", "gitpython", "jsonschema", "paramiko>=3.2.0", diff --git a/src/dstack/_internal/core/backends/aws/compute.py b/src/dstack/_internal/core/backends/aws/compute.py index 6ba23e6dd..f2420ecf1 100644 --- a/src/dstack/_internal/core/backends/aws/compute.py +++ b/src/dstack/_internal/core/backends/aws/compute.py @@ -188,12 +188,13 @@ def _get_offers_cached_key(self, requirements: Requirements) -> int: # Requirements is not hashable, so we use a hack to get arguments hash return hash(requirements.json()) + # For `pyright: ignore` directive, see: https://github.com/tkem/cachetools/issues/394 @cachedmethod( cache=lambda self: self._offers_post_filter_cache.cache, key=_get_offers_cached_key, lock=lambda self: self._offers_post_filter_cache.lock, ) - def get_offers_post_filter( + def get_offers_post_filter( # pyright: ignore[reportIncompatibleMethodOverride] self, requirements: Requirements ) -> Optional[Callable[[InstanceOfferWithAvailability], bool]]: if requirements.reservation: