diff --git a/latz/image.py b/latz/image.py index ecf1eec..a547aa2 100644 --- a/latz/image.py +++ b/latz/image.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import NamedTuple, Protocol +from typing import NamedTuple class ImageSearchResult(NamedTuple): @@ -22,39 +22,3 @@ class ImageSearchResultSet(NamedTuple): results: tuple[ImageSearchResult, ...] total_number_results: int | None search_backend: str - - -class ImageAPIContextManager(Protocol): - """ - Protocol class used to help plugin authors create compatible context managers. - - In latz, we rely on context managers to perform setup and tear-down operations - for the connections t - - We use a class-based approach here to make sure that plugin authors appropriately - implement the type of context manager the application needs (i.e. one that returns - an implementation of [`ImageAPI`][latz.image.ImageAPI]). - """ - - def __enter__(self) -> ImageAPI: - """ - This must return an implementation of the below [`ImageAPI`][latz.image.ImageAPI] class - """ - - def __exit__(self, exc_type, exc_val, exc_tb) -> None: - """Used to ensure the context manager protocol has been implemented""" - - -class ImageAPI(Protocol): - """ - Protocol class for the image API plugin. This is used to make sure that - objects being returned implement at least the methods defined below with the appropriate - return types. - """ - - def search(self, query: str) -> ImageSearchResultSet: - """ - Used to search for an image via a search term and then return a single result set. - See [`ImageSearchResultSet`][latz.image.ImageSearchResultSet] for more information - about the return type. - """ diff --git a/pyproject.toml b/pyproject.toml index 3cabe84..e099069 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ packages = [ ] [tool.poetry.dependencies] -python = "^3.10" +python = "^3.8" pydantic = "^1.10.2" httpx = "^0.23.1" Pillow = "^9.3.0"