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/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
matrix:
os:
- ubuntu-24.04
python-version: ["3.11"]
python-version: ["3.14"]
include:
- python-version: "3.11"
- python-version: "3.14"
os: ubuntu-24.04
format-for-github: true
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
matrix:
# reduced matrix for merge queue to avoid repeated full run
os: ${{ fromJSON(github.event_name == 'merge_group' && '["ubuntu-24.04"]' || '["ubuntu-24.04", "windows-2022"]') }}
python-version: ${{ fromJSON(github.event_name == 'merge_group' && '["3.15"]' || '["3.11", "3.12", "3.13", "3.14", "3.15"]') }}
python-version: ${{ fromJSON(github.event_name == 'merge_group' && '["3.15"]' || '["3.14", "3.15"]') }}
is-draft-pr:
- ${{ github.event.pull_request.draft == true }}
exclude:
Expand Down
4 changes: 2 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ inputs:
required: false
default: "false"
python-version:
description: "Python version to install (Defaults to the latest stable version of Python 3.11)"
description: "Python version to install (Defaults to the latest stable version of Python 3.14)"
required: false
default: "3.11.x"
default: "3.14.x"
kpops-version:
description: "KPOps version"
required: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ parameters.
| components | ❌ | - | string | components package path |
| filter-type | ❌ | - | string | Whether to include/exclude the steps defined in KPOPS_PIPELINE_STEPS |
| parallel | ❌ | "false" | string | Whether to run pipelines in parallel |
| python-version | ❌ | "3.11.x" | string | Python version to install (Defaults to the latest stable version of Python 3.11) |
| python-version | ❌ | "3.14.x" | string | Python version to install (Defaults to the latest stable version of Python 3.14) |
| kpops-version | ❌ | latest | string | KPOps version to install |
| helm-version | ❌ | latest | string | Helm version to install |
| token | ❌ | latest | string | secrets.GITHUB_TOKEN, needed for setup-helm action if helm-version is set to latest |
Expand Down
3 changes: 1 addition & 2 deletions kpops/component_handlers/helm/model.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from collections.abc import Iterator
from dataclasses import dataclass
from pathlib import Path
from typing import ClassVar
from typing import ClassVar, override

from pydantic import ConfigDict, Field
from typing_extensions import override

from kpops.component_handlers.helm.exception import ParseError
from kpops.manifests.kubernetes import KubernetesManifest
Expand Down
3 changes: 1 addition & 2 deletions kpops/component_handlers/kafka_connect/model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from enum import StrEnum, auto
from typing import Any, ClassVar
from typing import Any, ClassVar, override

import pydantic
from pydantic import (
Expand All @@ -11,7 +11,6 @@
model_serializer,
)
from pydantic.json_schema import SkipJsonSchema
from typing_extensions import override

from kpops.components.common.topic import KafkaTopic, KafkaTopicStr
from kpops.utils.enum import UpperStrEnum
Expand Down
4 changes: 2 additions & 2 deletions kpops/component_handlers/schema_handler/schema_provider.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from __future__ import annotations

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, TypeAlias
from typing import TYPE_CHECKING

from schema_registry.client.schema import AvroSchema, JsonSchema

if TYPE_CHECKING:
from kpops.components.base_components.models import ModelName, ModelVersion

Schema: TypeAlias = AvroSchema | JsonSchema
type Schema = AvroSchema | JsonSchema


class SchemaProvider(ABC):
Expand Down
3 changes: 1 addition & 2 deletions kpops/component_handlers/utils/exception.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING, Any, override

import httpx2
from typing_extensions import override

from kpops.core.exception import ServiceException

Expand Down
7 changes: 2 additions & 5 deletions kpops/components/base_components/base_defaults_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from dataclasses import asdict
from functools import cached_property
from pathlib import Path
from typing import Any, ClassVar, Self, TypeVar, cast
from typing import Any, ClassVar, Self, cast

import pydantic
import structlog
Expand Down Expand Up @@ -264,10 +264,7 @@ def get_defaults_file_paths(
return default_paths


_T = TypeVar("_T", bound=Hashable)


def deduplicate(seq: Sequence[_T]) -> list[_T]:
def deduplicate[T: Hashable](seq: Sequence[T]) -> list[T]:
"""Deduplicate items of a sequence while preserving its order.

:param seq: Sequence to be 'cleaned'
Expand Down
3 changes: 1 addition & 2 deletions kpops/components/base_components/cleaner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from abc import ABC

from typing_extensions import override
from typing import override

from kpops.component_handlers.helm.model import HelmFlags
from kpops.component_handlers.helm.utils import (
Expand Down
3 changes: 1 addition & 2 deletions kpops/components/base_components/helm_app.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from __future__ import annotations

from functools import cached_property
from typing import Annotated, Any
from typing import Annotated, Any, override

import pydantic
import structlog
from pydantic import Field, computed_field
from typing_extensions import override

from kpops.component_handlers.helm.dry_run_handler import DryRunHandler
from kpops.component_handlers.helm.helm import Helm
Expand Down
2 changes: 1 addition & 1 deletion kpops/components/base_components/kafka_app.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from __future__ import annotations

from abc import ABC
from typing import override

import structlog
from typing_extensions import override

from kpops.component_handlers import get_handlers
from kpops.components.base_components.pipeline_component import PipelineComponent
Expand Down
3 changes: 1 addition & 2 deletions kpops/components/base_components/kafka_connector.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from __future__ import annotations

from abc import ABC
from typing import Any, NoReturn
from typing import Any, NoReturn, override

import structlog
from pydantic import AliasChoices, Field, PrivateAttr, ValidationInfo, field_validator
from typing_extensions import override

from kpops.component_handlers import get_handlers
from kpops.component_handlers.kafka_connect.model import (
Expand Down
3 changes: 1 addition & 2 deletions kpops/components/base_components/kubernetes_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

import re
from abc import ABC
from typing import ClassVar
from typing import ClassVar, override

import structlog
from pydantic import ConfigDict
from typing_extensions import override

from kpops.components.base_components.pipeline_component import PipelineComponent
from kpops.utils.pydantic import CamelCaseConfigModel, DescConfigModel
Expand Down
3 changes: 1 addition & 2 deletions kpops/components/streams_bootstrap/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

import re
from abc import ABC
from typing import Self
from typing import Self, override

import pydantic
import structlog
from pydantic import Field
from typing_extensions import override

from kpops.component_handlers.helm.model import HelmRepoConfig
from kpops.components.base_components import KafkaApp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from functools import cached_property
from typing import override

import structlog
from pydantic import Field, ValidationError
from typing_extensions import override

from kpops.component_handlers.kubernetes.pvc_handler import PVCHandler
from kpops.components.base_components.helm_app import HelmApp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from functools import cached_property
from typing import override

import structlog
from pydantic import ValidationError
from typing_extensions import override

from kpops.component_handlers.kubernetes.pvc_handler import PVCHandler
from kpops.components.base_components.helm_app import HelmApp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from functools import cached_property
from typing import override

import structlog
from pydantic import Field, ValidationError
from typing_extensions import override

from kpops.component_handlers.kubernetes.utils import trim
from kpops.components.common.app_type import AppType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from functools import cached_property
from typing import override

import structlog
from pydantic import ValidationError
from typing_extensions import override

from kpops.component_handlers.kubernetes.pvc_handler import PVCHandler
from kpops.components.base_components.helm_app import HelmApp
Expand Down
3 changes: 1 addition & 2 deletions kpops/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import logging
from pathlib import Path
from typing import ClassVar
from typing import ClassVar, override

import pydantic
import structlog
Expand All @@ -13,7 +13,6 @@
PydanticBaseSettingsSource,
SettingsConfigDict,
)
from typing_extensions import override

from kpops.component_handlers.helm.model import HelmConfig
from kpops.core.exception import ValidationError
Expand Down
10 changes: 6 additions & 4 deletions kpops/core/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ def iter_component_modules() -> Iterator[ModuleType]:
yield from _iter_namespace(kpops.components)


def find_class(modules: Iterable[ModuleType], base: type[_PluginT]) -> type[_PluginT]:
def find_class[PluginT](
modules: Iterable[ModuleType], base: type[PluginT]
) -> type[PluginT]:
try:
return next(_find_classes(modules, base=base))
except StopIteration as e:
Expand All @@ -79,9 +81,9 @@ def import_module(module_name: str) -> ModuleType:
return module


def _find_classes(
modules: Iterable[ModuleType], base: type[_PluginT]
) -> Iterator[type[_PluginT]]:
def _find_classes[PluginT](
modules: Iterable[ModuleType], base: type[PluginT]
) -> Iterator[type[PluginT]]:
for module in modules:
for _, _class in inspect.getmembers(module, inspect.isclass):
if not __filter_internal_kpops_classes(
Expand Down
3 changes: 1 addition & 2 deletions kpops/manifests/kubernetes.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from collections.abc import Iterator
from typing import Any, ClassVar, Self
from typing import Any, ClassVar, Self, override

import pydantic
import yaml
from pydantic import ConfigDict, Field
from typing_extensions import override

from kpops.utils.pydantic import CamelCaseConfigModel, by_alias

Expand Down
4 changes: 2 additions & 2 deletions kpops/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import asyncio
from collections.abc import Callable
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, TypeAlias
from typing import TYPE_CHECKING, Any

import rustworkx as rx
import structlog
Expand Down Expand Up @@ -31,7 +31,7 @@

log = structlog.get_logger("PipelineGenerator")

ComponentFilterPredicate: TypeAlias = Callable[[PipelineComponent], bool]
type ComponentFilterPredicate = Callable[[PipelineComponent], bool]


async def _run_component(
Expand Down
17 changes: 7 additions & 10 deletions kpops/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
from collections.abc import Callable
from functools import cached_property
from typing import TYPE_CHECKING, Any, Concatenate, Generic, TypeVar

_T = TypeVar("_T")
_R = TypeVar("_R")
from typing import TYPE_CHECKING, Any, Concatenate

if TYPE_CHECKING:

def cached_classproperty(
func: Callable[Concatenate[Any, ...], _R], attrname: str | None = None
) -> _R: ...
def cached_classproperty[R](
func: Callable[Concatenate[Any, ...], R], attrname: str | None = None
) -> R: ...

else:

class cached_classproperty(cached_property, Generic[_T, _R]):
def __get__(self, owner_obj: _T, owner_cls: type[_T]) -> _R:
self.func: Callable[[type[_T]], _R]
class cached_classproperty[T, R](cached_property):
def __get__(self, owner_obj: T, owner_cls: type[T]) -> R:
self.func: Callable[[type[T]], R]
return self.func(owner_cls)
26 changes: 11 additions & 15 deletions kpops/utils/dict_differ.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dataclasses import dataclass
from difflib import Differ
from enum import StrEnum, auto
from typing import TYPE_CHECKING, Any, Generic, NamedTuple, TypeVar, cast
from typing import TYPE_CHECKING, Any, NamedTuple, cast

import typer
import yaml
Expand All @@ -28,37 +28,33 @@ def from_str(label: str) -> DiffType:
return DiffType[label.upper()]


_O = TypeVar("_O")
_N = TypeVar("_N")


class Change(NamedTuple, Generic[_O, _N]):
old_value: _O
new_value: _N
class Change[O, N](NamedTuple):
old_value: O
new_value: N

@staticmethod
def factory(
type: DiffType, change: _O | _N | tuple[_O, _N]
) -> Change[_O | None, _N | None]:
type: DiffType, change: O | N | tuple[O, N]
) -> Change[O | None, N | None]:
match type:
case DiffType.ADD:
change = cast(_N, change)
change = cast(N, change)
return Change(None, change)
case DiffType.REMOVE:
change = cast(_O, change)
change = cast(O, change)
return Change(change, None)
case DiffType.CHANGE:
change = cast(tuple[_O, _N], change)
change = cast(tuple[O, N], change)
return Change(*change)
msg = f"{type} is not part of {DiffType}"
raise ValueError(msg)


@dataclass
class Diff(Generic[_O, _N]):
class Diff[O, N]:
diff_type: DiffType
key: str
change: Change[_O, _N]
change: Change[O, N]

@staticmethod
def from_dicts(
Expand Down
Loading
Loading