diff --git a/lightkube/core/resource_registry.py b/lightkube/core/resource_registry.py index 7307135..32c9f7b 100644 --- a/lightkube/core/resource_registry.py +++ b/lightkube/core/resource_registry.py @@ -1,10 +1,12 @@ import importlib -from typing import Union, Type, Optional +from typing import Optional, Type, TypeVar, Union from lightkube.core import resource as res from lightkube.core.exceptions import LoadResourceError AnyResource = Union[res.NamespacedResource, res.GlobalResource] +AnyResourceType = Type[AnyResource] +AnyResourceTypeVar = TypeVar('AnyResourceTypeVar', bound=AnyResourceType) def _load_internal_resource(version, kind): if "/" in version: @@ -40,7 +42,7 @@ class ResourceRegistry: def __init__(self): self._registry = {} - def register(self, resource: Type[AnyResource]) -> Type[AnyResource]: + def register(self, resource: AnyResourceTypeVar) -> AnyResourceTypeVar: """Register a custom resource **parameters** diff --git a/setup.py b/setup.py index f24fa64..d3d525c 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='lightkube', - version="0.15.1", + version="0.15.2", description='Lightweight kubernetes client library', long_description=Path("README.md").read_text(), long_description_content_type="text/markdown",