From 82579bbc6913976f1f1ff805764816e1130e2dde Mon Sep 17 00:00:00 2001 From: Sergey Vasilyev Date: Mon, 18 Nov 2024 19:11:34 +0100 Subject: [PATCH 1/4] Unpin urllib3 from the old fixed bug Signed-off-by: Sergey Vasilyev --- docs/requirements.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 4668eb2a..c3fbdce1 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -5,6 +5,3 @@ sphinx>=2.0.0 sphinx-autobuild sphinx-autodoc-typehints sphinx_rtd_theme>=0.5 - -# Added 2023-05-06. TODO: Remove when resolved: https://github.com/psf/requests/issues/6432 -urllib3<2.0.0 From 64e3bec7444f250e63a6c42ea9cdb6bd1653c40f Mon Sep 17 00:00:00 2001 From: Sergey Vasilyev Date: Mon, 18 Nov 2024 20:41:02 +0100 Subject: [PATCH 2/4] Upgrade K8s & K3s in CI Signed-off-by: Sergey Vasilyev --- .github/workflows/ci.yaml | 2 +- .github/workflows/thorough.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0e096030..87529d8d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -103,7 +103,7 @@ jobs: strategy: fail-fast: false matrix: - k3s: [latest, v1.28, v1.27, v1.26] + k3s: [latest, v1.31, v1.30, v1.29] name: K3s ${{matrix.k3s}} runs-on: ubuntu-22.04 timeout-minutes: 10 # usually 4-5 mins diff --git a/.github/workflows/thorough.yaml b/.github/workflows/thorough.yaml index e85c8a4b..30dc7c3a 100644 --- a/.github/workflows/thorough.yaml +++ b/.github/workflows/thorough.yaml @@ -107,7 +107,7 @@ jobs: strategy: fail-fast: false matrix: - k3s: [latest, v1.28, v1.27, v1.26] + k3s: [latest, v1.31, v1.30, v1.29] name: K3s ${{matrix.k3s}} runs-on: ubuntu-22.04 timeout-minutes: 10 # usually 4-5 mins @@ -127,7 +127,7 @@ jobs: strategy: fail-fast: false matrix: - k8s: [latest, v1.28.5, v1.27.9, v1.26.13] + k8s: [latest, v1.31.2, v1.30.6, v1.29.10] name: K8s ${{matrix.k8s}} runs-on: ubuntu-22.04 timeout-minutes: 10 # usually 4-5 mins From 6260e59a7c07d15054db6ae51a82afc7d5cd37c1 Mon Sep 17 00:00:00 2001 From: Sergey Vasilyev Date: Mon, 18 Nov 2024 19:26:26 +0100 Subject: [PATCH 3/4] Upgrade mypy to 1.13.0 Signed-off-by: Sergey Vasilyev --- kopf/_core/intents/callbacks.py | 4 ++-- kopf/_core/reactor/orchestration.py | 24 +++++++++++++++++++----- requirements.txt | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/kopf/_core/intents/callbacks.py b/kopf/_core/intents/callbacks.py index bc19992f..1d3f508a 100644 --- a/kopf/_core/intents/callbacks.py +++ b/kopf/_core/intents/callbacks.py @@ -23,7 +23,7 @@ IndexingFn = Callable[..., invocation.SyncOrAsync[Optional[object]]] WatchingFn = Callable[..., invocation.SyncOrAsync[Optional[object]]] ChangingFn = Callable[..., invocation.SyncOrAsync[Optional[object]]] - WebhookFn = Callable[..., invocation.SyncOrAsync[None]] + WebhookFn = Callable[..., invocation.SyncOrAsync[Optional[object]]] DaemonFn = Callable[..., invocation.SyncOrAsync[Optional[object]]] TimerFn = Callable[..., invocation.SyncOrAsync[Optional[object]]] WhenFilterFn = Callable[..., bool] # strictly sync, no async! @@ -145,7 +145,7 @@ DefaultNamedArg(Any, "param"), KwArg(Any), ], - invocation.SyncOrAsync[None] + invocation.SyncOrAsync[Optional[object]] ] DaemonFn = Callable[ diff --git a/kopf/_core/reactor/orchestration.py b/kopf/_core/reactor/orchestration.py index 1931a202..64bfd9e6 100644 --- a/kopf/_core/reactor/orchestration.py +++ b/kopf/_core/reactor/orchestration.py @@ -27,11 +27,12 @@ import functools import itertools import logging -from typing import Any, Collection, Container, Dict, Iterable, MutableMapping, NamedTuple, Optional +from typing import Any, Collection, Container, Dict, Iterable, \ + MutableMapping, NamedTuple, Optional, Protocol from kopf._cogs.aiokits import aiotasks, aiotoggles from kopf._cogs.configs import configuration -from kopf._cogs.structs import references +from kopf._cogs.structs import bodies, references from kopf._core.engines import peering from kopf._core.reactor import queueing @@ -43,6 +44,19 @@ class EnsembleKey(NamedTuple): namespace: references.Namespace +# Differs from queueing.WatchStreamProcessor by the resource=… kwarg. +class ResourceWatchStreamProcessor(Protocol): + async def __call__( + self, + *, + resource: references.Resource, + raw_event: bodies.RawEvent, + stream_pressure: Optional[asyncio.Event] = None, # None for tests + resource_indexed: Optional[aiotoggles.Toggle] = None, # None for tests & observation + operator_indexed: Optional[aiotoggles.ToggleSet] = None, # None for tests & observation + ) -> None: ... + + @dataclasses.dataclass class Ensemble: @@ -89,7 +103,7 @@ def del_keys(self, keys: Container[EnsembleKey]) -> None: async def ochestrator( *, - processor: queueing.WatchStreamProcessor, + processor: ResourceWatchStreamProcessor, settings: configuration.OperatorSettings, identity: peering.Identity, insights: references.Insights, @@ -122,7 +136,7 @@ async def ochestrator( # for a simulation of the insights (inputs) and an assertion of the tasks & toggles (outputs). async def adjust_tasks( *, - processor: queueing.WatchStreamProcessor, + processor: ResourceWatchStreamProcessor, insights: references.Insights, settings: configuration.OperatorSettings, identity: peering.Identity, @@ -213,7 +227,7 @@ async def spawn_missing_peerings( async def spawn_missing_watchers( *, - processor: queueing.WatchStreamProcessor, + processor: ResourceWatchStreamProcessor, settings: configuration.OperatorSettings, indexed_resources: Container[references.Resource], # only "if in", never "for in"! watched_resources: Iterable[references.Resource], diff --git a/requirements.txt b/requirements.txt index 88ee4ebe..00d3f20b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ freezegun import-linter isort lxml -mypy==1.8.0 +mypy==1.13.0 pre-commit pyngrok pytest>=6.0.0 From c488353060eb096c4fe63fecfdd901f191f10a78 Mon Sep 17 00:00:00 2001 From: Sergey Vasilyev Date: Mon, 18 Nov 2024 19:35:14 +0100 Subject: [PATCH 4/4] Upgrade Ubuntu to 24.04 in CI jobs Signed-off-by: Sergey Vasilyev --- .github/workflows/ci.yaml | 10 +++++----- .github/workflows/thorough.yaml | 12 ++++++------ .readthedocs.yaml | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 87529d8d..e64a767d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,7 @@ on: jobs: linters: name: Linting and static analysis - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 5 # usually 1-2, rarely 3 mins (because of installations) steps: - uses: actions/checkout@v3 @@ -43,7 +43,7 @@ jobs: - install-extras: "uvloop" python-version: "3.13" name: Python ${{ matrix.python-version }} ${{ matrix.install-extras }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 5 # usually 2-3 mins steps: - uses: actions/checkout@v3 @@ -83,7 +83,7 @@ jobs: install-extras: [ "", "full-auth" ] python-version: [ "pypy-3.8", "pypy-3.9", "pypy-3.10" ] name: Python ${{ matrix.python-version }} ${{ matrix.install-extras }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 10 steps: - uses: actions/checkout@v3 @@ -105,7 +105,7 @@ jobs: matrix: k3s: [latest, v1.31, v1.30, v1.29] name: K3s ${{matrix.k3s}} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 10 # usually 4-5 mins steps: - uses: actions/checkout@v3 @@ -122,7 +122,7 @@ jobs: coveralls-finish: name: Finalize coveralls.io needs: [unit-tests, pypy-tests, functional] - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/setup-python@v4 - run: pip install coveralls diff --git a/.github/workflows/thorough.yaml b/.github/workflows/thorough.yaml index 30dc7c3a..7938ac35 100644 --- a/.github/workflows/thorough.yaml +++ b/.github/workflows/thorough.yaml @@ -16,7 +16,7 @@ on: jobs: linters: name: Linting and static analysis - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 5 # usually 1-2, rarely 3 mins (because of installations) steps: - uses: actions/checkout@v3 @@ -47,7 +47,7 @@ jobs: - install-extras: "uvloop" python-version: "3.12" name: Python ${{ matrix.python-version }} ${{ matrix.install-extras }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 5 # usually 2-3 mins steps: - uses: actions/checkout@v3 @@ -87,7 +87,7 @@ jobs: install-extras: [ "", "full-auth" ] python-version: [ "pypy-3.8", "pypy-3.9", "pypy-3.10" ] name: Python ${{ matrix.python-version }} ${{ matrix.install-extras }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 10 steps: - uses: actions/checkout@v3 @@ -109,7 +109,7 @@ jobs: matrix: k3s: [latest, v1.31, v1.30, v1.29] name: K3s ${{matrix.k3s}} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 10 # usually 4-5 mins steps: - uses: actions/checkout@v3 @@ -129,7 +129,7 @@ jobs: matrix: k8s: [latest, v1.31.2, v1.30.6, v1.29.10] name: K8s ${{matrix.k8s}} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 10 # usually 4-5 mins env: K8S: ${{ matrix.k8s }} @@ -145,7 +145,7 @@ jobs: coveralls-finish: name: Finalize coveralls.io needs: [unit-tests, pypy-tests, functional] - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/setup-python@v4 - run: pip install coveralls diff --git a/.readthedocs.yaml b/.readthedocs.yaml index b43296e3..dc736179 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -3,7 +3,7 @@ version: 2 formats: all build: - os: ubuntu-22.04 + os: ubuntu-24.04 tools: python: "3" python: